Thundering herd problem
lastmod 2018-08-17created 2015-10-251 edits
The thundering herd problem occurs when a large number of processes waiting for an event are awoken when that event occurs, but only one process is able to proceed at a time. After the processes wake up, they all demand the resource and a decision must be made as to which process can continue. After the decision is made, the remaining processes are put back to sleep, only to all wake up again to request access to the resource.
This occurs repeatedly, until there are no more processes to be woken up. Because all the processes use system resources upon waking, it is more efficient if only one process was woken up at a time.
This may render the computer unusable, but it can also be used as a technique if there is no other way to decide which process should continue (for example when programming with semaphores).
About
Many processes sit in the Waiting state for a single event, and when that event occurs, all related processes Wake-up and needlessly waste CPU.
To serve multiple users simultaneously, web servers such as Apache launch many processes at once. When there are no user connections, all web server processes are in the Sleep state; when a single user connects, only one web server process is needed to handle it, yet all web server processes wake up and needlessly waste CPU. This phenomenon is called the thundering herd problem.
See also
- Process management (computing)
- Lock convoy
- Sleeping barber problem
- TCP global synchronization
- Cache stampede
- Multi Thread
- Synchronization