我正在尝试新的System.Threading.Parallel方法,如parallel和foreach。
他们似乎很好地工作,但我需要一种方法来增加执行的并发线程数为8(我有一个四核心)。
我知道有一种方法我可以找到你隐藏该死的财产的地方。
吉拉德。
I'm experimenting with the new System.Threading.Parallel methods like parallel for and foreach.
They seem to work nicely but I need a way to increase the number of concurrent threads that are executed which are 8 (I have a Quad core).
I know there is a way I just can find the place thy hidden the damn property.
Gilad.
最满意答案
引用:
var query = from item in source.AsParallel().WithDegreeOfParallelism(10) where Compute(item) > 42 select item;在查询执行大量非计算限制工作(如文件I / O)的情况下,指定比机器上的内核数量多的并行度可能会有所帮助。
来自: MSDN
quote:
var query = from item in source.AsParallel().WithDegreeOfParallelism(10) where Compute(item) > 42 select item;In cases where a query is performing a significant amount of non-compute-bound work such as File I/O, it might be beneficial to specify a degree of parallelism greater than the number of cores on the machine.
from: MSDN
更多推荐
发布评论