If you are reading the description, you found the hidden shelf :D
Most people skip this part, so here is your technical treat:
An interesting fact: more threads can make code slower because “parallel” does not mean “independent.” If two threads keep touching the same shared data, the CPU may spend less time doing the actual work and more time coordinating who gets access, moving cache state around, waiting on locks, and switching between runnable tasks. So the code looks busier, but the useful work per second can go down.
And the weird part is that sometimes the bottleneck is not the amount of work. It is the cost of making workers share the same room.
[Source]: https://man7.org/linux/man-pages/man7/sched.7.html
If you read this, comment "Debug Mode" below. Let's make the non-readers confused ;).
Download
0 formats
No download links available.
Why More Threads Can Make Your Code Slower (Thread vs Process) | NatokHD