Previous | Next --- Slide 12 of 24
Back to Lecture Thumbnails
Avesh

Invariants: -Consumer moves head -Producer moves tail -Producer handles all memory allocation and removal

lazyplus

The trick here is that we have another 'head pointer', the 'reclaim' pointer. Consumer drops elements from pointer 'head' by move the 'head' pointer forward. Then the dropped elements will be hidden from consumer. But they can still be accessed via the 'reclaim' pointer. So, the producer can know which element is deleted and do both allocation and deletion.

bottie

The reclaim node pointer in queue is the key of implementing this lock free queue data structure. The producer takes advantage of the reclaim pointer to issue the allocation and deletion in the queue.