More threads -> Slower program ??

Yuxuan Shui via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Aug 12 16:06:29 PDT 2015


Here is a small program 
(https://gist.github.com/yshui/a426f73be77d1d699555) that uses 
taskPool to parallely reading from /proc/<pid>/ and sum the swap 
usage.

Individual tasks has zero dependency between each other, but when 
I remove the 'defaultPoolThreads(1)' line, the programs takes 8x 
more CPU time and also runs longer in total (I have 12 cores).

What is wrong here?



More information about the Digitalmars-d-learn mailing list