In
computer science, a lock convoy is a performance problem that can occur when using
locks for
concurrency control in a
multithreaded application.
A lock convoy occurs when multiple
threads
Thread may refer to:
Objects
* Thread (yarn), a kind of thin yarn used for sewing
** Thread (unit of measurement), a cotton yarn measure
* Screw thread, a helical ridge on a cylindrical fastener
Arts and entertainment
* ''Thread'' (film), 2016 ...
of equal priority contend repeatedly for the same lock.
Unlike
deadlock and
livelock situations, the threads in a lock convoy do progress; however, each time a thread attempts to acquire the lock and fails, it relinquishes the remainder of its scheduling quantum and forces a context switch. The overhead of repeated context switches and underutilization of scheduling quanta degrade overall performance.
Lock convoys often occur when concurrency control primitives such as
locks serialize access to a commonly used resource, such as a
memory heap
Memory pools, also called fixed-size blocks allocation, is the use of pools for memory management that allows dynamic memory allocation comparable to malloc or C++'s operator new. As those implementations suffer from fragmentation because of ...
or a
thread pool. They can sometimes be addressed by using non-locking alternatives such as
lock-free algorithms or by altering the relative priorities of the contending threads.
See also
*
Thundering herd problem
References
{{DEFAULTSORT:Lock Convoy
Concurrency control