Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.programming.threads
Please check out my algorithm unbounded SPSC (wait free?) queue
Dmitry Knyaginin
4/2/2015 5:37:00 AM
Please check out my algorithm unbounded SPSC (wait free?) queue.
This implementation is wait free?
I tested this code on os x, windows, ubuntu.
Everywhere works!
ThreadSanitizer detect data race.
C++ code
http://pastebin.co...
1 Answer
Kaz Kylheku
4/2/2015 5:22:00 PM
0
On 2015-04-02, Dmitry Knyaginin <knyaginin@gmail.com> wrote:
> Please check out my algorithm unbounded SPSC (wait free?) queue.
> This implementation is wait free?
> I tested this code on os x, windows, ubuntu.
> Everywhere works!
> ThreadSanitizer detect data race.
>
> C++ code
>
http://pastebin.co...
Complete junk, I'm afraid.
Your code assumes that you can just magically stick a node into the shared
data structure without worrying about what another thread is doing.
You've written an ordinary doubly-linked list and simply *called*
it "wait-free".
What if two processors execute "last->v = v" at the same time?
What if two processors execute "last->next = tmp" at around the same time?
What if two processors execute "last = tmp" at the same time?
What if you have this scenario:
Processor A Processor B
last->next = tmp
last->next = tmp
last = tmp
last = tmp
How about this one:
Processor A Processor B
last->next = tmp
last->next = tmp
last = tmp
last = tmp
It is baffling as to how you can neglect such questions in code that
is supposed to be concurrent programming.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Please check out my algorithm unbounded SPSC (wait free?) queue
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password