Available parallel technologies in .Net

前端 未结 6 1328
星月不相逢
星月不相逢 2021-02-04 10:58

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

6条回答
  •  灰色年华
    2021-02-04 11:41

    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).

提交回复
热议问题