Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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_skiplis...

It's used to manage code fragments that need to be accessed in signal handlers.



Thanks, 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?


So that was in some quick benchmarks against the sequential one in the runtime: 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: