4 ms·
> Notably, at 1 million tasks, I observed that the overhead of launching tasks became evident, and most programs required more than 12 seconds to complete. I d
by sakras 3y ago
> Notably, at 1 million tasks, I observed that the overhead of launching tasks became evident, and most programs required more than 12 seconds to complete.
I didn’t quite get this part. Even if your runtime has no overhead, the fastest way you can execute 1 million 10-second tasks is 10 * 1 million / num_cores, right? Why would these million tasks only take 12 sec?
- josephg 3y agoBecause the tasks are all running concurrently. (They're all running at the same time).
- hamburglar 3y agoYou can “run” more threads than you have cores when they are all inside sleep()