2 ms·
I've been building a library in Rust with a very similar approach called Temper [1], although in order to model the bizarre implications of the full Rust memory
by reitzensteinm 2y ago
I've been building a library in Rust with a very similar approach called Temper [1], although in order to model the bizarre implications of the full Rust memory model you have to go quite a bit further, with bookkeeping tracking which writes each thread has perceived. Based on atomic memory ordering, read and write fences etc, perceiving write X may guarantee that write Y must be perceived.
It contains what I believe to be the largest set of test cases of the C++/Rust memory model, which is essentially everything I could find in books, the C++ standard, Stack Overflow, blogs, etc. E.g. this is the file for Rust Atomics and Locks by Mara Bos [2]
Loom [3], referenced in the article, is a similar and much more complete library, which enables you to exhaustively test higher level constructs like mutexes and queues. Although it doesn't model the memory model as exhaustively as Temper (I've been meaning to port my test cases over to it).
I was inspired by a Foundation DB testing talk by Will Wilson [4], who is now over at Antithesis [5], building a hypervisor based solution to perform this style of testing on arbitrary Docker containers.
I strongly believe we're going to see much more in this domain in the coming decade. WebAssembly is at the perfect intersection of being a platform that's complete enough to be able to compile arbitrary software to, but simple enough that building something like Antithesis isn't a half decade long project from an elite team that's already shipped a database.
[1] https://github.com/reitzensteinm/temper/tree/main https://github.com/reitzensteinm/temper/tree/main
[2] https://github.com/reitzensteinm/temper/blob/main/memlog/tests/atomics_and_locks.rs https://github.com/reitzensteinm/temper/blob/main/memlog/tes...
[3] https://github.com/tokio-rs/loom https://github.com/tokio-rs/loom
[4] https://www.youtube.com/watch?v=4fFDFbi3toc https://www.youtube.com/watch?v=4fFDFbi3toc
[5] https://antithesis.com/ https://antithesis.com/