, parallelism . ( ) , Parallel.ForEach . , , . , 850 , , Thread 1 425 , Thread 2 - 425 . . : [0, 425, 426, 1, 2, 427, 3, 428, 429, 4,...].
(, ), , .
, , - , , , , . [0, 1, 2, 4, 3, 6, 5,...].
. , .
, . , , .
Parallel.ForEachimplemented in the first way: each thread is assigned its own group of elements for processing. For this, in another way, more overhead would be required, because the list of elements would have to be processed as a general queue with the resulting synchronization costs.
source
share