PLINQ and the logical processors

97 views Asked by At

My system's configuration is this: Intel(R) Core(TM) i7-3820QM CPU @ 2.70GHz, 2694 Mhz, 4 Core(s), 8 Logical Processor(s)

You may notice that my machine has 4 cores and 8 logical processors.

If I'm going to use a PLINQ query to take advantage of the parallelism, can I specify 7 for the WithDegreeOfParallelism so the query will take advantage of all the logical processors by creating one thread for each logical processor?

1

There are 1 answers

5
i3arnon On BEST ANSWER
  1. You don't have to tell PLINQ how many logical processors you have. It already knows (using Environment.ProcessorCount), and it will optimize the query accordingly. The intention of WithDegreeOfParallelism is to control what PLINQ doesn't know, for example if your code is mainly I/O intensive and not CPU intensive.
  2. You can do that if you insist.
  3. If you have 8 processors why would you limit it to 7?