[fpc-devel] LockFree Queue algorithm
darekm at emadar.com
Sun Jan 27 14:51:35 CET 2008
Micha Nelissen pisze:
> DarekM wrote:
>> This is my proposition of algorithm and its implementing multithreaded
>> FIFO queue without lock.
> Hmm 'Push' and 'Pop' sound like a stack, but the implementation seems to
> implement a FIFO indeed, with a head and tail.
It should be enqueue and dequeue. I was left because first I try
> You're sure about the situation where two threads are accessing head and
> tail at the same time, and there is only one item in your FIFO ?
Of course (if CAS (interlockedCompareExchange) has proper
implementation , that, I think, should be avoided
Queue is empty when tail=head,
when is not equal only one thread can receive object form queue, second
make again iteration
The same with ABA problem.
More information about the fpc-devel