Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming.threads > #2950 > unrolled thread
| Started by | Dmitry Knyaginin <knyaginin@gmail.com> |
|---|---|
| First post | 2015-04-01 22:36 -0700 |
| Last post | 2015-04-02 17:22 +0000 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.programming.threads
Please check out my algorithm unbounded SPSC (wait free?) queue Dmitry Knyaginin <knyaginin@gmail.com> - 2015-04-01 22:36 -0700
Re: Please check out my algorithm unbounded SPSC (wait free?) queue Kaz Kylheku <kaz@kylheku.com> - 2015-04-02 17:22 +0000
| From | Dmitry Knyaginin <knyaginin@gmail.com> |
|---|---|
| Date | 2015-04-01 22:36 -0700 |
| Subject | Please check out my algorithm unbounded SPSC (wait free?) queue |
| Message-ID | <785a0132-5d2d-41b5-973e-f1fde6dced1b@googlegroups.com> |
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.com/fWYjhyyv
[toc] | [next] | [standalone]
| From | Kaz Kylheku <kaz@kylheku.com> |
|---|---|
| Date | 2015-04-02 17:22 +0000 |
| Message-ID | <20150402095708.956@kylheku.com> |
| In reply to | #2950 |
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.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.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.programming.threads
csiph-web