Channel 9 example ("baby names")
PLINQ uses the .AsParallel keyword to spread a query over multiple processors
Parallel Extensions to .NET 4.0
What is it?
- .NET types
- no compiler changes necessary
- ThreadPool runtime (new and improved ThreadPool)
- in .NET 4.0, the ThreadPool is still inter-process; you can still run into a situation where each process believes it owns the whole box and will load it up with as many threads as there are cores
- however, there are limiting mechanisms built into the ThreadPool (see TaskManagerPolicy)
- multiple programming model
- declarative data parallelism (PLINQ)
- imperative data and task parallelism (Task Parallel Library)
- coordination/synchronization constructs (Coordination Data Structures)
- Common exception handling model
- Parallel debugging and profiling support
Why is it good?
- supports parallelism in any .NET language
- delivers reduced concept count and complexity, better time to solution
- begins to move parallelism capabilities from concurrency experts to domain experts
Common Concurrency Runtime (Microsoft Robotics) is both a scheduler and an API
Coordination Data Structures
- thread-safe collections, ConcurrentQueue(Of T), ConcurrentStack(Of T), ConcurrentDictionary(Of K, T)
- work exchange: blocking queues
- phased operations
- locks: SpinLock, SpinWait
- initialization: LazyInit