- You don't have to tell
PLINQ
how many logical processors you have. It already knows (usingEnvironment.ProcessorCount
), and it will optimize the query accordingly. The intention ofWithDegreeOfParallelism
is to control whatPLINQ
doesn't know, for example if your code is mainlyI/O
intensive and notCPU
intensive. - You can do that if you insist.
- If you have 8 processors why would you limit it to 7?
PLINQ and the logical processors
-
05-10-2022 - |
Pregunta
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?
Solución
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow