Re: [GD-General] Totally Safe lock-free FIFO for arbitrary-sized items.
Brought to you by:
vexxed72
|
From: Jon W. <hp...@mi...> - 2006-08-21 17:25:58
|
Andras Balogh wrote:
> Now, the other barrier after the increment is the one that is not needed,
> because it doesn't really matter if the head has been incremented or not.
> In the worst case, the receiver won't know that there's a new element in
> the queue until later, but it will by no means result in data loss or
> corrupton, no matter what architecture you are running on.
>
There may be architectures where the other side wouldn't learn about the
change until the following happens:
1) the cache line with the update gets evicted
2) the other side attempts to modify the cache line that was evicted (so
it's re-loaded)
This is more likely in "NUMA" or "multiple bus master shared memory"
architectures, than traditional SMP. Call it AMP for asymmetric
multi-processing :-)
Without the second barrier, such an architecture could get into
live-lock. The barrier in that case serves as an explicit notification.
Cheers,
/ h+
|