Languages  >>  .net

Parellel Extensions .NET

Language: English Quality: Average Has Audio: true Source: SkillMatter Media: Flash Posted On: 06 Feb 09
Looking forward to having an 8 core processor in your desktop box? Maybe your server already does? Unfortunately unless your application is designed to use them 7 of those cores are going to be sitting idle. How do you write multi-threaded programs for .NET without the headaches of race conditions and manually tracking threads?

Parallel Extensions for .NET to the rescue! .NET 4.0 will feature a new library to simplify parallel programming and allow your applications to take advantage of multiple cores. This talk will explain what's on offer.

Parallel extensions for .NET is all about making the most of your cores. Clockspeeds arenít predictors of pure speed and with Windows 2008R2 supporting up to 256 cores, developers can move away from using (often painful) threads to obtain a performance advantage. In this talk, Ben Lamb takes us through what we can expect in .NET 4.0 Visual Studio 2010. With a library designed to make parallel programming easier, the debugging support, and concurrency profiler, it is possible to develop applications that are lightweight. Using parallel extensions with this new release will ultimately allow you to develop light resident applications to ultimately make the most of your cores.

In his first demo, Ben demonstrates how to waste half your computer power by using sequential processing, making it multi-threaded with each thread having a copy of the stack and equaling 1mb of memory per thread. This makes your app a "bad citizen."

Thread pools donít provide much control, Ben goes on to say... In his second demo, he uses fine-grained parallelism using tasks such as Wait, WaitAny, WaitAll, ContinueWith, Cancel showing the differences. The tasks are a unit of work and not a unit of scheduling, so you can create hundreds whist keeping everything lightweight. This method automatically maintains the parent-child relationship, so cancellations are easy and they can be chained together.

Structured Parallelism is very useful for modifying existing code and makes uses of task under the hood. Parallel.For and Parallel.ForEach enables you to parallelise loops and support cancellation. However, you still need to handle locking on shared data structures. Parallel Invoke executes many statements in parallel

Benís 4th demo shows how to use parallel states. You might be asking yourself if threads are now dead? Fear not - all existing threads will work as they do today. under .NET 4.0 you will be able to take advantage of the improved debugging support in VS2010 and there will still be occasions when you might prefer using threads.

Tags: SkillMatter, screencast, parallel, .net, debugging,     [SUGGEST  A  TAG]

Created : 2008-11-26      Resolution : 420x339   Format : Flash