Computer systems are increasingly incorporating multiprocessing architectures which execute parallel software applications that share access to common data structures. Concurrent queues are used in multiprocessing computing environments. To insure "correctness," concurrent access to shared queues is synchronized. Traditional approaches to synchronizing access to critical regions have incorporated operating system synchronization primitive. These approaches are "blocking" and are not suitable for providing multiprocessor safe synchronization of critical regions between multiple threads of execution in user space (i.e. application software). The blocking characteristic of spinlock methods also reduces software scalability in situations of high contention in critical regions of a multiprocessor environment.
A set of concurrent non-blocking methods which demonstrate good performance over traditional spinlock methods of multiprocessor synchronization have been developed by Maged M. Michael and Michael L. Scott. These methods allow multiple processors to gain concurrent non-blocking access to shared First In First Out (FIFO) queues with immunity from inopportune preemption and are especially useful for parallel software applications requiring shared access to FIFO queues. Furthermore, these methods demonstrate nearly linear scalability under high contention of critical regions in a multiprocessor environment and are incorporated directly in application software. These methods do not affect processor interrupts and do not require spinlock methods to provide mutual exclusion to a shared critical region. These methods are presented and described in greater detail in a publication authored by Maged M. Michael and Michael L. Scott, entitled "Simple, Fast, and Practical Non-Blocking and Blocking Concurrent Queue Algorithms," published in the 15th ACM Symposium on Principles of Distributed Computing (PODC), May 1996, which is incorporated herein by reference.
One shortcoming of these queuing methods involves a condition referred to as an "ABA" condition. The "ABA" condition occurs on computing platforms, such as the Intel 486 and the Pentium class lines of processors, which utilize a Compare-And-Swap (CAS) atomic primitive. The "ABA" condition occurs when a process reads a value "A" from a shared memory location, computes a new value and then attempts the CAS operation. In certain circumstances, the CAS operation may succeed when it should have failed. Such a situation arises when, between the memory read and the CAS operation, some other process or processes change the value "A" to value "B" and then back to value "A." Although the CAS operation succeeds since the value of the shared memory location has returned to value "A," the value in the memory location to which "A" points may have changed. To reduce the probability of encountering the "ABA" condition, the aforementioned queuing methods implement a sequence or count number as part of node address associated with the shared memory location. The count number is incremented with every successful CAS operation so that a determination can be made as to whether the contents of the shared memory location has been altered. While the use of count numbers reduces the probability of encountering the "ABA" condition, the method falls short on the previously mentioned Intel processors due to the frequent incrementing of the count number which causes the count to wrap around and possibly end up at the original count number. The probability of a wrap around condition occurring is especially likely in high contention situations and increases as the speed of the processor increases and the total number of nodes in the queue decreases.
It would be advantageous therefore, to devise a method and apparatus which selectively increments count numbers associated with nodes in a priority queue to reduce the number of times the count numbers are incremented. Such a method and apparatus would increase the time between the occurrence of wrap around conditions and thereby, reduce the likelihood of encountering an "ABA" condition.