我是新来的.Net平台。我做了搜索,发现有几种方法可以做到并行计算的净:
I am new to .Net platform. I did a search and found that there are several ways to do parallel computing in .Net:
在任务并行库,这是NET 3.5的并行任务。
Parallel task in Task Parallel Library, which is .Net 3.5.
PLINQ,.NET 4.0中
PLINQ, .Net 4.0
Asynchounous编程,NET 2.0,(异步主要是用来做I / O任务重,F#有一个简洁的语法支持这一点)。我列出了这一点,因为在单声道,但似乎没有TPL和PLINQ。因此,如果我需要编写跨平台并行程序,我可以使用异步。
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.
净线程。不进行版本限制。
.Net threads. No version limitation.
你能不能给这些短期的一些意见或在此列表中添加更多的方法呢?谢谢。
Could you give some short comments on these or add more methods in this list? Thanks.
你需要做的,以便确定如何有效地多线程的研究相当数量。有一些很好的技术文章的,在微软并行计算团队的网站。
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:
发
类。
线程池
,其中也有针对I / O密集型操作和I / O完成端口的支持。
开始*
/ 结束*
异步操作。
基于事件的异步编程(或EBAP)组件,使用的SynchronizationContext
。
的BackgroundWorker
,这是定义一个异步操作的EBAP。
工作
类(任务并行库)在.NET 4中。
并行LINQ。有good在Parallel.ForEach文章(任务并行库)与PLINQ。
接收或LINQ到活动,这还没有一个非Beta版版本,但已接近完成,看起来很有希望。
(F#只)异步流程。
Thread
class.
ThreadPool
, which also has support for I/O-bound operations and an I/O completion port.
Begin*
/End*
asynchronous operations.
Event-based asynchronous programming (or "EBAP") components, which use SynchronizationContext
.
BackgroundWorker
, which is an EBAP that defines an asynchronous operation.
Task
class (Task Parallel Library) in .NET 4.
Parallel LINQ. There is a good article on Parallel.ForEach (Task Parallel Library) vs. PLINQ.
Rx or "LINQ to Events", which does not yet have a non-Beta version but is nearing completion and looks promising.
(F# only) Asynchronous workflows.
更新:有一篇文章Understanding并应用并行模式与.NET Framework 4 可供下载,让一些方向上的解决方案,使用哪种并行的方案(尽管它假定.NET 4中,不包含接收)。
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).