Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How many parallel process can I run?

I have a corei7 processor with 8 logical processors.

I'm trying to run a parallel task in dotnet core 2.2 using parallel.For. when I measure start time there are 9 tasks started in parallel. Isn't it suppose to be just 8?

below you can see :

i => [ThreadId],[ProcessorNumber] == starttime - endtime

enter image description here

Parallel tasks result

like image 534
Codehaks Avatar asked Dec 28 '18 20:12

Codehaks


1 Answers

You can run however many tasks in parallel that you want, but the processor only has 8 logical cores to process 8 threads simultaneously. The rest will always queue up and wait their turn.

So if you have 16 parallel processes, which each take 200ms to run, then you will run process 1-8 in parallel for 200ms, then 9-16 in parallel for 200ms, totalling at 400ms. If you had 4 logical cores, you would run process 1-4, 5-8, 9-12, 13-16 in parallel, totalling in at 800ms.

like image 192
Karl Johan Vallner Avatar answered Oct 18 '22 18:10

Karl Johan Vallner