如何学习线程安全的C#编程?
我想知道什么是线程安全?如何开始学习c#中的线程安全编程?线程在Web开发中的作用是什么?
I want to know what is thread safe ? how to start to learn thread safe programmimg in c#? what is role of thread in web development ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我希望您阅读此处:线程(C# 和 Visual Basic)
i would prefer you to read here: Threading (C# and Visual Basic)
对于一般的 .NET 线程,我发现以下链接非常有用:Threading in C# by
约瑟夫·阿尔巴哈里.
对于最后一个问题,我将根据您使用的技术从以下文章开始:
另外,以下文章介绍了 ASP.NET 在 IIS 7.0 和 IIS 6.0 上托管时如何使用线程: IIS 7.0 和 6.0 上的 ASP.NET 线程使用。该链接也有点旧,但它涵盖了 .NET 3.5 sp1,因此它也可能是一个很好的起点。
For .NET threading in general, I find the following link very useful: Threading in C# by
Joseph Albahari.
For the last question, I would start with the following articles depending on which technology you are using:
Also, the following article explains how ASP.NET uses threads when hosted on IIS 7.0 and IIS 6.0: ASP.NET Thread Usage on IIS 7.0 and 6.0. The link is also a bit old but it covers up to .NET 3.5 sp1, so it could be a good start point as well.
当然!启动参考:http://msdn.microsoft.com/en-us/库/aa645740.aspx
sure! take reference for startup : http://msdn.microsoft.com/en-us/library/aa645740.aspx
如果您想要比 MSDN 参考更实用的方法,我建议您阅读这本免费的电子书。
If you want a more hands on approach than the MSDN reference I would suggest you read this free ebook .
由于您是编程新手,我建议您阅读一些有关函数式编程和副作用的内容。在 C# 中创建并使用线程很容易,但确保它们安全却很困难。我会推荐这篇文章 http://codebetter.com /matthewpodwysocki/2008/09/12/副作用和功能编程/
As you are new to programming I would recommend you read a bit about functional programming and side effects. Creating threads and using them is easy in C# but making them safe is difficult. I would recommend this article http://codebetter.com/matthewpodwysocki/2008/09/12/side-effects-and-functional-programming/
并发编程是一个广阔且极其复杂的领域。我不会从一开始就专门研究 C#,而是从学习并发的基础知识开始。即)什么是锁定?什么是互斥锁、锁存器和并发队列,为什么我们需要使用它们? IMO,一个很好的起点是澳大利亚斯威本大学创建的此网站。
Concurrent programming is a vast an extremely complicated area. Rather than looking specifically at c# to begin with I would start by learning about the basics of concurrency. IE) What is locking? What is a Mutex, Latch, and Concurrent Queue, and why do we need to use them? IMO, a good place to start would be this site created by Swinburne University in Australia.