4 ms·
I wrote a parallel communicating thread actor model in Java that doesn't use mutuexes. I am yet to prove it is waitfree but it doesn't block, it always tries to
by samsquire 4y ago
I wrote a parallel communicating thread actor model in Java that doesn't use mutuexes. I am yet to prove it is waitfree but it doesn't block, it always tries to move towards forward progress.
I wrote a model checker in Python and it's slow (it's not finished yet!) as it tests every possible interleaving of the threads. (I test some interleavings I was worried about explicitly with manual specifications) I've run it a lot but there's the possibility there is a rare bug. But my model checker needs parallelising to run in reasonable time to prove the algorithm correct. So I need to parallelise my parallel algorithm checker.
It's kind of based on https://www.cs.technion.ac.il/~erez/Papers/wfquque-ppopp.pdf https://www.cs.technion.ac.il/~erez/Papers/wfquque-ppopp.pdf in terms of work stealing (or helping)
Every thread can communicate with every other thread and I load balance the pool with a simple atomic counter and modulo.
https://github.com/samsquire/multiversion-concurrency-control/blob/main/src/main/java/main/Main.java https://github.com/samsquire/multiversion-concurrency-contro...
For 100 parallel threads on a hexacore I get 1.75-2.3 million communication events a second (depending on CPU load, when I'm running the model checker, I get around ~1.5 million requests a second) on an Intel Processor Intel(R) Core(TM) i7-10710U CPU @ 1.10GHz, 1608 Mhz, 6 Core(s), 12 Logical Processor(s). Yes it's an Intel NUC. Communication costs 500 nanoseconds. I plan to implement bidirectional communication so threads swap messages with each other, for double the throughput. The plan is that threads/actors have multiple event streams or sources of work, so they always have work to do even if there is contention.
I don't know if it is fast or slow, as I haven't benchmarked golang channels, erlang actors or akka or any other actor framework but I do wonder what is the raw performance of a multithreaded actor model.
If you found this comment useful or interesting, check out my profile. I write of this stuff everyday.