How to write .NET applications that use multi-core processors

As multi-core processors are becoming increasingly popular, I think it would be wise to become familiar with how to write code to use them. I am a .NET developer, and I don’t know where to start (seriously, I don’t know where to start). Any suggestions?

+7
multicore
source share
8 answers

Multi-core programming is essentially multi-threaded programming. While your application is multithreaded, the operating system determines which kernel launches this thread.

So your real question should be, which applications will benefit from multithreading? Think of such an application, and then create multiple threads to solve equal parts of the problem.

+12
source share

The best way to get started is to grab the latest CTP parrallel extension platform and start plowing through your sample code.

+3
source share

Read the asynchronous programming model used by .NET. Explore the BeginXXX and EnxXXX paradigm that allows delegates to run in threadpool.

The Stream classes have BeingXXX, EndXXX methods (for example, BeginRead, EndRead) that allow you to perform asynchronous I / O. If you are working on something that is heavily based on IO, you will want to use these methods to increase parallelism.

+2
source share

I do not recommend books very often, but Joe Duffy Concurrent programming in Windows is simply irreplaceable.

+2
source share

Look for information on .net 4.0. He will add various designs for him.

+1
source share

Like JaredPar, concurrent extensions are pretty good. I played with them a bit and they are easy to use and add performance.

The constructs that I really liked were Parallel.ForEach () and PLinq.

Parallel.ForEach is similar to the ForEach (delegate) function found in DotNet 2.0 collections. It takes an action delegate and runs it in parallel.

Plinq allows you to execute any regular Linq query in parallel by adding .AsParallel () to the end of the query.

Check out the links Jared has posted for more information.

+1
source share

This can make a good starting place .

0
source share

Simply dividing your project into different threads, specialized to perform a specific function, will allow you to take advantage of several cores. The OS manages the scheduling of various threads to the most accessible processor core.

0
source share

All Articles