Live data from Hacker News

Properly testing concurrent data structures

matklad.github.io

31–33 of 33 posts

Re: Properly testing concurrent data structures

#31
This is really neat, I’ll have to try it out. It won’t catch all classes of errors though - won’t each call to pause() cause a synchronization between the threads and hide some data race issues? maybe this is a nonissue in Rust.

Re: Properly testing concurrent data structures

#32

One downside of this approach is that the tested code itself has to be modified to accomodate the testing code. I think the same could be achieved by launching two threads and single stepping them with ptrace to "randomly" interleave the execution of their instructions. Something like rr's chaos mode. Some instructions may not be atomic though, so we would need a way to single step on "atomic microcodes" if that's ev…

Sounds like Antithesis's hypervisor.

Re: Properly testing concurrent data structures

#33
post #16

This is great, is there a "loom" like library for C++? I have a set of lock-free data structures that I would like to test.

Yes, the (IMHO) the easiest one to use is the Relacy Race Detector ( https://github.com/dvyukov/relacy and https://www.1024cores.net/home/relacy-race-detector ) It's been around a while and is easy to work with. Written by Dmitry Vyukov, an expert in the concurrency world.

I think he implemented this inside Go
Post reply on HN