8 ms·
Well that was certainly a lot of fluff and FUD. OP says: > Look at your program's CPU usage. If the sum of your threads is <100% of one core, then there is no
by begriffs 6y ago
Well that was certainly a lot of fluff and FUD.
OP says:
> Look at your program's CPU usage. If the sum of your threads is <100% of one core, then there is no reason whatsoever for you to use threads.
Attacking a CPU-bound problem with parallelism is only one reason for using threads. Concurrency (even on one processor) has benefits.
> The shame is in believing ourselves super-human, and reaching for a tool that we don't need, in full knowledge that we're likely to shoot ourselves in the foot with it.
Although synchronization primitives require care, they're not that hard. You don't need super-human powers.
I took some time to understand pthreads and apply them to example programs. For a careful and balanced overview, see my article:
https://begriffs.com/posts/2020-03-23-concurrent-programming.html https://begriffs.com/posts/2020-03-23-concurrent-programming...
- syspec 6y agoGreat blog entry!