Groups
Groups
Sign in
Groups
Groups
Scalable Synchronization Algorithms
Conversations
About
Send feedback
Help
regarding mpmc bounded queue
115 views
Skip to first unread message
user1990 k
unread,
Oct 15, 2017, 5:41:28 AM
10/15/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to lock...@googlegroups.com
Dear All,
I was trying to understand this.
http://www.1024cores.net/home/lock-free-algorithms/queues/bounded-mpmc-queue
Let me consider enqueue scenario [ both threads ]
Thread 1 in core 0 | Thread 2 in core 0
pos = 0
|
seq = 0
|
dif = 0
|
cas succeed, pos =1 |
<delay/preempted>
yet to increment seq
| pos = 1
|
seq = 0
|
dif = -1
| enqueue fails eventhough the queue is not full
Thank you
Dmitry Vyukov
unread,
Oct 15, 2017, 5:43:45 AM
10/15/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to lock...@googlegroups.com
Hi,
The seq are initialized to their indexes initially, see ctor:
for (size_t i = 0; i != buffer_size; i += 1)
buffer_[i].sequence_.store(i, std::memory_order_relaxed);
So for pos=1 seq will be 1 (diff=0).
Reply all
Reply to author
Forward
0 new messages