4 ms·
If anyone wants one based on Herlihy et al's "The Art of Multiprocessor Programming" there's a well reviewed, tested and heavily commented concurrent lock-free
by sadiq 5y ago
If anyone wants one based on Herlihy et al's "The Art of Multiprocessor Programming" there's a well reviewed, tested and heavily commented concurrent lock-free one in OCaml's runtime now: https://github.com/ocaml/ocaml/blob/trunk/runtime/lf_skiplist.c https://github.com/ocaml/ocaml/blob/trunk/runtime/lf_skiplis...
It's used to manage code fragments that need to be accessed in signal handlers.
- ignoramous 5y agoThanks, I used that neat knuth coin-flip trick from your code. Why does the comment on the file say that its lock-free implementation is half as slow as compared to 'sequential' one? Where does the slowness come from? Is it all those while(1) loops waiting to race atomic operations?
- sadiq 5y agoSo that was in some quick benchmarks against the sequential one in the runtime: https://github.com/ocaml/ocaml/blob/trunk/runtime/skiplist.c https://github.com/ocaml/ocaml/blob/trunk/runtime/skiplist.c I haven't done a huge amount of investigation but I suspect the cost comes from the extra indirection in the lock-free one.