--
You received this message because you are subscribed to the Google Groups "mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mechanical-symp...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Ross,
Generally/theoretically speaking, cas retry loops are unbounded. If you have low contention rate (as you hinted at), then the actual running time will be lower than if the state is highly contended. Depending on what type of work is submitted to the queue, one can make the statement that the system/algorithm as a whole is making progress though even if workers are losing cas attempts (e.g. homogeneous queue).
As Martin mentioned, one way to avoid cas retry is to "claim slots" in the underlying queue, such as by using lock'd xadd instruction (think ringbuffer or circular array backed queue). The problem here, still, is under high contention throughput will go down as cachelines will be bouncing around and RFO traffic will dominate (most likely, if the rest of the work is dirt cheap). Ideally what one wants here is per-cpu partitioning of work.
As for SandyBridge, there's no fairness built in (as far as I know, at least). As Martin's blog states, the drop in throughput is purely because intel improved the interconnect latency between cores and what used to be "bulk" updates by a core no longer are. In my opinion, hardware will never attempt to give fairness if for no other reason than performance implications of that.
Sent from my phone
--
You received this message because you are subscribed to the Google Groups "mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mechanical-sympathy+unsub...@googlegroups.com.
Hi Martin, Sergey,
On 17/04/2014 8:37 PM, Martin Thompson wrote:
> If you want a wait-free multi-producer queue to single-consumer you
> could try the following:
>
> http://www.1024cores.net/home/lock-free-algorithms/queues/non-intrusive-mpsc-node-based-queue
On 17/04/2014 9:45 PM, Sergey Zubarev wrote:
> MPSC lock-free queue based on the linked list
> can be implemented using atomic swap on write side
Thanks for the suggestion. I'm familiar with Mr Vyukov's algorithm. It
has many nice properties. The problem is that it isn't non-blocking. If
the producer is interrupted during mpscq_push at (*) then the consumer
is blocked. (Sergy: is this the algorithm you were thinking of too?)
Thanks,
Ross.
Coherence race is basically a race to claim exclusive access to a cacheline. With cas retry loop, there's a chance that while your loop body is running another core has modified the condition variable; when you get around to CAS your core could get exclusive access to the line, but finds the actual condition value is not the expected one - that's a normal race.
With LL/SC the condition value may be the expected one, but cache line may have been updated in the meantime, even to the expected value; LL/SC will fail here, whereas CAS would succeed. This is a coherence race.
Sent from my phone
mechanical-sympathy+unsub...@googlegroups.com
<mailto:mechanical-sympathy+unsub...@googlegroups.com>. For
more options, visit https://groups.google.com/d/optout.
-- You received this message because you are subscribed to a topic
in the Google Groups "mechanical-sympathy" group. To unsubscribe
from this topic, visit
https://groups.google.com/d/topic/mechanical-sympathy/e9jLWF5rhAM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mechanical-sympathy+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mechanical-sympathy+unsub...@googlegroups.com.
To unsubscribe from this group and all its topics, send an email to mechanical-symp...@googlegroups.com.