《Pro .Net 4 Parallel Programming in C#》笔记
$ 周期性定时任务用
CancellationToken.WaitHandle.WaitOne(TimeSpan)
特点:如果Task被Cancel,WaitOne马上就会返回。
$ 同步元
场景 | 解决方案 |
串行访问边界区域 | lock关键字或System.Threading.Monitor或System.Threading.SpinLock |
增加或减少数值 | System.Threading.Mutex |
跨进程同步 | System.Threading.Mutex |
多个锁的同步 | Threading.WaitHandle.WaitAll() |
同步类中的所有方法 | 声明式的同步([Synchronization])(非常重量级) |
允许多个读者 | 读写锁 |
lock | System.Threading.Monitor的缩写形式,重量级 |
System.Threading.Barrier | 预先设定信号数量,有足够信号量后继续执行。自动重置 |
System.Threading.CountdownEvent | 类似Barrier,但是需要主动重置 |
System.Threading.ManualResetEventSlim | 类似CountdownEvent,但是不设定信号数量,一旦Set,所有等待线程被释放 |
System.Threading.AutoResetEvent | 类似ManualResetEventSlim,但自动重置,每次Set只释放一个等待线程,不能使用CancellationToken等待,不保证哪个线程被释放 |
System.Threading.SemaphoreSlim | 类似AutoResetEvent,同样不保证哪个线程被释放,但可以指定每次Set所释放的线程数,可以用CancellationToken等待 |
$ TaskScheduler用于指定由哪个线程执行Task,以及并发Task的数量和顺序
$ 利用Thread Local Storage(TLS,Parallel.For) 可减少对竞态数据的访问,只在每个分支线程结束时访问,从而提高性能。
$ 当操作很简单时,可以通过指定数据的分块模式(chunking partitioner),来降低调用委托(delegate)的开销。
相关推荐
Pro .NET 4 Parallel Programming in C#
.net 并行开发新技术,.NET Parallel Task
Pro .NET 4 Parallel Programming c# 4 并行编程
.NET 4 Parallel Programming in CSharp
C# 4 and .NET Framework 4 allow you to shift to a modern task-based programming model to express parallelism. It is easier to write code that takes advantage of multicore microprocessors. Now, you ...
Modern tools and techniques on the .NET platform, including parallel LINQ, functional programming, asynchronous programming, and the Task Parallel Library, offer powerful alternatives to traditional ...
Professional Parallel Programming with C#.pdf
c# 并行编程书籍,包括了: <Pro dotNET.4.Parallel.Programming.in.C#> <Patterns_of_Parallel_Programming_CSharp> <Parallel.Guide.20100708> <ParallelProgramsinNET4_CodingGuidelines>
这本书介绍.Net的TPL库,用来实现并发的库,该书每一章节以多个demo的方式介绍了方法的使用,是一本通俗易懂的技术书,该书高清,无水印
这本精品书籍浓墨重彩地描述如何使用C# 4、Visual Studio 2010和.NET Framework 4高效地创建基于任务的并行应用程序,详细讲述最新的单指令、多数据流指令和向量化等并行编程技术,介绍现代并行库,讨论如何珠联璧合...
Parallel Programming in OpenMP
The mission of this text is to provide you with a rock-solid foundation in the C# programming language and the core aspects of the .NET platform (assemblies, remoting, Windows Forms, Web Forms, ADO...
C#并行编程高级教程:精通.NET 4 Parallel Extensions 源代码
Parallel Programming with .NET 4 Samples
Concurrency in .NET Modern patterns of concurrent and parallel programming
.net高级并行编程 Apress.Pro.dotNET.4.Parallel.Programming.in.CSharp.May.2010
This essential classic title provides a comprehensive foundation in the C# programming language and the frameworks it lives in. Now in its 8th edition, you’ll find all the very latest C# 7.1 and .NET...
Professional Parallel Programming with C# 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权...
我搜集到的并行编程技术的资料 Parallel Programming