In concurrent programming, an Array-Based Queuing Lock (ABQL) is a synchronization mechanism used to control access to shared resources and ensure fairness among competing threads.
This approach significantly improves scalability and fairness because threads spin on their individual array slots rather than a single shared location, reducing contention and ensuring a first-come, first-served acquisition order.
The common problem with lock implementations is the high network contention due to the processors spinning on a shared synchronization flag or memory location.
The foremost requirement of the implementation of array based queuing lock is to ensure that all the threads spin on unique memory locations.
On a lock release, the hold is passed to the next thread in queue by setting the next element of the array to 1.
Initialization of the first element in the array can_serve to 1, ensures successful lock acquisition by the first thread in the queue.