![]() This article provides a pseudo-code for the lock-free queue algorithm, which is also very small, so it can be easily implemented by various programming languages. Most of the lock-free algorithms are implemented through CAS operations. This implementation employs an efficient non-blocking algorithm based on one described in Simple, Fast, and Practical Non-Blocking and Blocking Concurrent Queue Algorithms by Maged M. It is only worth mentioning that Java’s ConcurrentLinkedQueue is based on this algorithm: This article has been cited nearly 1000 times. Scott’s 1996 paper Simple, Fast, and Practical Non-Blocking and BlockingĬoncurrent Queue Algorithms, which reviews some implementations of concurrent queues and their limitations, proposes a very simple implementation of lock-free queue, and also provides a two-lock queue algorithm on specific machines such as those without CAS instructions. Speaking of lock-free queue algorithms, we have to mention Maged M. The code base can be found on github: smallnest/queue lock-free queue algorithm flag vessels and foreign vessels operating in U.S. The information contained here represents an every 15-minute updated snapshot of Freedom of Information Act (FOIA) data on U.S. This article introduces some background knowledge of the lock-free queue algorithm, and implements three concurrent queues and provides the results of performance tests. The Corps Locks website contains lock and vessel specific information derived from the United States Army Corps of Engineers Lock Performance Monitoring System (LPMS). However, in some cases, by implementing lock-free algorithm, we can further improve the performance of concurrent queues. ![]() Generally, the queue is implemented through pointers and only operates at the head and tail of the queue, so the critical area protected by this out-of-exclusion lock does not have a very complex execution logic and the critical area is processed quickly, so in general the efficiency of the queue is already very high by implementing the out-of-exclusion lock. In a concurrent environment using queues, it is necessary to take into account the multi-threaded (multi-threaded) concurrent read and write problems, there may be multiple write (queue) operation threads, while there may also be multiple threads read operation threads, in this case, we want to ensure that the data is not lost, not duplicated, but also to ensure that the function of the queue remains unchanged, that is, the first-in-first-out logic, as long as there is data, you can get out of the column.Īdmittedly, concurrent access to the queue can be achieved through an out-of-exclusion lock. The end that performs the insert operation is called the tail and the end that performs the delete operation is called the header. Like the stack data structure, a queue is a linear table with restricted operations. A queue is a very common data structure that allows only outgoing ( dequeue) operations at the front end of a table ( head) and incoming ( enqueue) operations at the back end of a table ( tail).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |