The invention discloses a method for achieving an unlocked concurrence
message processing mechanism. An
annular array is used as a data buffering area, caching and pre-reading can be facilitated, meanwhile, the defect that memory needs to be applied or released at each node operation caused by a chain table structure is overcome, and the efficiency is improved. In order to solve the concurrence control problem of a multiple-producer and single-
consumer mode, a CAS and a
memory barrier are used for guaranteeing
mutual exclusion, a locking mode is not used, and performance deterioration caused by low efficiency of locking is avoided. In order to solve the common ABA problem in the unlocked technology, a double-insurance CAS technology is used for avoiding the occurrence of the ABA problem. In order to solve the
false sharing problem, the method that cache lines are filled between a head pointer, a
tail pointer and capacity is used for avoiding the
false sharing problem due to the fact that the head pointer, the
tail pointer and the capacity are in the same cache line. Meanwhile, the length of the array is set to be the index times of two, the bit operation of 'and operation' is used for acquiring the subscript of the array, and the
overall efficiency is improved.