3 ms·
We haven't yet seen the limits of thread-based concurrency because CPUs have only just started to scale-out (by adding more cores). You're not going to experien
by jondubois 11y ago
We haven't yet seen the limits of thread-based concurrency because CPUs have only just started to scale-out (by adding more cores). You're not going to experience any issues if you just have a small number of threads spread out over a small number of cores.
If you had like 100+ cores (just guessing) and several of them tried to access or write to a specific shared memory location, they would spend a lot of time busy-waiting for each other to finish (assuming you're using mutexes).
Maybe using semaphores could work but your code will end up looking like a mess.
With process-based concurrency, each process can only rely on its own memory pool, so that does use-up more memory, but processes are fully independent from each other (fully parallel) so no time is wasted busy-waiting for anything.
See https://en.wikipedia.org/wiki/Amdahl%27s_law https://en.wikipedia.org/wiki/Amdahl%27s_law