parallel

Alex Parrill via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Nov 5 12:41:05 PST 2015


On Thursday, 5 November 2015 at 20:30:05 UTC, Handyman wrote:
> Seems that 4 cores go all out on first 4 dishes, then 1 core 
> deals with the last dish.  With 4 cores I expect diner is ready 
> after 5/4 = 1.25 secs though.  What did I do wrong?

The first four dishes get scheduled, all of them sleep for 1 
second in parallel, then complete at roughly the same time. One 
second has passed.

Now there's one dish left. It gets scheduled, sleeps for 1 
second, and finishes (the other threads remain idle). Two seconds 
have passed.


More information about the Digitalmars-d-learn mailing list