Re:A collection of lock-free data structures written in stan...
by whiteboardma on Wednesday May 10, 2023 @09:08AM
(#35886800)
I've only looked at the queue implementation, but both push and pop contain obvious race conditions; I would highly suggest adding tests that actually use the data structures from multiple threads.
[ Parent
| on HN ]
Re:A collection of lock-free data structures written in stan...
by dnedic on Wednesday May 10, 2023 @09:11AM
(#35886849)
Could you elaborate on the alleged race conditions? Any advice on reliably testing the race conditions? The problem with adding those is the fact that they will give lots of false negatives and if you rely on them you have a problem.
Re:A collection of lock-free data structures written in stan...
by gjadi on Wednesday May 10, 2023 @09:22AM
(#35886971)
You could use TLA+ to model the data structure operations and check the invariant.
Checking the invariant with assert is also useful in my limited experience with concurrency.
Re:A collection of lock-free data structures written in stan...
by dnedic on Wednesday May 10, 2023 @09:24AM
(#35886999)
Thanks a lot, will check this out!
Re:A collection of lock-free data structures written in stan...
by whiteboardma on Wednesday May 10, 2023 @09:21AM
(#35886954)
Looking at the Push operation defined in queue_impl.hpp, if multiple threads perform concurrent pushes, they might end up writing their element to the same slot in _data since the current position _w is not incremented atomically
Re:A collection of lock-free data structures written in stan...
by dnedic on Wednesday May 10, 2023 @09:24AM
(#35886995)
This is a multi producer scenario, the README clearly states that these data structures are only single producer single consumer multi thread/interrupt safe.
I will also add disclaimers to the javadocs comments on methods just to reduce confusion.
Re:A collection of lock-free data structures written in stan...
by whiteboardma on Wednesday May 10, 2023 @09:32AM
(#35887104)
Wops, my bad