User:Lokeshgupta1975

Convoying in the context of Multi-threaded programming

In a multi-threaded program, a critical section of code is protected with a mutual exclusion (mutex) lock. The code between the lock and unlock of the mutex is guaranteed to be run by only one thread at a time. If the rate at which the threads request the mutex lock is more than the rate at which individual threads are able to complete the critical section and release the mutex lock, it will result in many threads waiting in a queue to acquire the mutex lock. This is called as convoying. The waiting threads build up a 'convoy'.

Convoying may result in a deadlock if the thread which currently owns the mutex crashes. In this case, the waiting threads will continue to wait in the 'convoy' forever.

Convoying could be minimized by using atomic operations in Multi-threaded programming and minimize the length of time during which a particular lock is acquired.