Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Available parallel technologies in .Net

I am new to .Net platform. I did a search and found that there are several ways to do parallel computing in .Net:

  1. Parallel task in Task Parallel Library, which is .Net 3.5.

  2. PLINQ, .Net 4.0

  3. Asynchounous Programming, .Net 2.0, (async is mainly used to do I/O heavy tasks, F# has a concise syntax supporting this). I list this because in Mono, there seem to be no TPL or PLINQ. Thus if I need to write cross platform parallel programs, I can use async.

  4. .Net threads. No version limitation.

Could you give some short comments on these or add more methods in this list?

like image 597
Yin Zhu Avatar asked May 21 '10 16:05

Yin Zhu


1 Answers

You do need to do a fair amount of research in order to determine how to effectively multithread. There are some good technical articles, part of the Microsoft Parallel Computing team's site.

Off the top of my head, there are several ways to go about multithreading:

  1. Thread class.
  2. ThreadPool, which also has support for I/O-bound operations and an I/O completion port.
  3. Begin*/End* asynchronous operations.
  4. Event-based asynchronous programming (or "EBAP") components, which use SynchronizationContext.
  5. BackgroundWorker, which is an EBAP that defines an asynchronous operation.
  6. Task class (Task Parallel Library) in .NET 4.
  7. Parallel LINQ. There is a good article on Parallel.ForEach (Task Parallel Library) vs. PLINQ.
  8. Rx or "LINQ to Events", which does not yet have a non-Beta version but is nearing completion and looks promising.
  9. (F# only) Asynchronous workflows.

Update: There is an article Understanding and Applying Parallel Patterns with the .NET Framework 4 available for download that gives some direction on which solutions to use for which kinds of parallel scenarios (though it assumes .NET 4 and doesn't cover Rx).

like image 186
Stephen Cleary Avatar answered Nov 14 '22 14:11

Stephen Cleary