Chase-Lev queue looks like trouble
treeowl opened this issue · comments
Aside from all their other devilish subtleties, it appears to be that Chase-Lev queues don't completely guarantee that left and right pops don't both take the last queue element. If that happens here, I believe two threads could both try to fill the same IVar
, in which case the second one will fill the IVar
with an exception thunk (and then throw an exception). To fix this, we'd need put_
to take care to leave the IVar
value alone when it's full. That's easy enough, but I don't think it's nearly enough: what do we do about the exception? A particularly nasty case involves two IVar
s, A
and B
, and two copies of the same thread, P
and Q
. Suppose P
and Q
each spawn threads to fill A
and B
, and those happen to do so in the opposite orders. Then P
will die because B
is full, and Q
will die because A
is full. I therefore believe that when Chase-Lev queues are enabled, non-determinism errors should be disabled.
Hrmm... Maybe I'm wrong... the implementation we use may be stronger than the original paper. This stuff looks extremely subtle.
It is extremely subtle. Perhaps this issue belongs over on the chaselev-deque
repo instead?