Poor scalability of parallel code

I recently analyzed how my parallel computing actually speeds up on a 16-core processor. And the general formula that I concluded - the more threads you have, the lower the speed per core that you get - it bothers me. The following are diagrams of processor load and processing speed:

picture1

So, you can see that the processor load is increasing, but the speed is increasing much more slowly. I want to know why such an effect takes place and how to get a reason for unprecedented behavior. I made sure to use the GC GC mode . I made sure that I parallelized the corresponding code as soon as the code does no more than

  • Loads data from RAM (the server has 96 GB of RAM, the swap file should not be hit)
  • Performs simple calculations
  • Stores data in RAM

I have profiled my application carefully and found no bottlenecks - it seems that each operation becomes slower as the number of threads grows.

I'm stuck, what happened to my script?

I am using .Net 4 parallel task library.

+5
source share
5 answers

The key to linear scalability - in the context of where switching from one to two cores doubles the bandwidth - is to use shared resources as little as possible. It means:

  • do not use hyperthreading (because two threads have the same main resource)
  • ( )
  • , ( )
  • - L1 L2
  • - L3 RAM,
  • / /​​

, , , .

. .

. , L1 L2 , . , , , , .

, Windows NT.

_______ _______

(. ). - . , , , . , OO . ( ) OO WYSIWYG, , , C ( WYSIWYG) , , ( WYSIWYG).

+5

​​, .
, .

, , , . .

+10

- .

- , -, , ?

8 , , CPU 16- 8- , ​​ 2 .

, , , put.

, , .

, , .

? 10 ?

+3

, .

, , , , .

, - (, ) (, , , , ).

+1

? , , . 1 [1], thread2 [2], , , [2] 2 , thread1 [1] - , . http://msdn.microsoft.com/en-us/magazine/cc872851.aspx. , , , , , .

, , , 16x - , , . , , 30% ; , 300%, , . "". 300%.

Also, if you think that hypertext kernels are real kernels, it is not. They only allow threads to change quickly when they are blocked. But they will never allow you to work at double speed if your flows are not blocked one and a half times in any case, in which case this already means that you have the possibility of acceleration.

+1
source

All Articles