The invention relates to an equipment IO
queue method based on atomic operation. A
queue is composed of an owner pointer, a
tail pointer, data nodes and temporary nodes. The enqueue operation can be simultaneously carried out by a plurality of producers, and the dequeue operation can only be carried out by a
consumer. The dequeue operation needs one temporary node to participate, and the first
data node in the
queue is replaced and taken out. In the process, the atomic compare-and-swap (CAS) operation is used to judge whether the
tail pointer points to the first
data node or not; if yes, the
tail pointer points to the temporary node. The queue further comprises
control power releasing operation, and the
control power releasing operation is as follows: the first node is removed, and the atomic compare-and-swap (CAS) operation is used to judge whether the tail pointer points to the first node or not; if yes, the tail pointer is changed to a null pointer; if the first node is removed, so that the queue is emptied, the
control power is released.