Friday, April 3, 2015

Digest for comp.programming.threads@googlegroups.com - 1 update in 1 topic

Kaz Kylheku <kaz@kylheku.com>: Apr 02 05:22PM

> ThreadSanitizer detect data race.
 
> C++ code
> http://pastebin.com/fWYjhyyv
 
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.
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.programming.threads+unsubscribe@googlegroups.com.

No comments: