Use cases - Small, Fast Tasks (High Volume)
What's the problem?
If you do 1 million tiny tasks one by one, you underutilize your CPU.
Single-threaded issue:
One thread does all tasks → slow throughput.
Multi-threaded solution:
Create a thread pool that processes many tasks in parallel. This increases throughput dramatically.
Example: Prime number calculator
- Each hash takes ~1 microsecond.
- Doing sequentially = slow.
- Spread across 8 threads → process in parallel.
this can finish the batch faster because many threads handle many tasks at once.