Is there a library that implements lock-free algorithms(queue, linked list and others) written in C (not in C++)? I've taken a look at some libraries like Intel's, but I would like to use generic libraries, at least more generic than Intel's one.
An algorithm is lock-free if infinitely often operation by some processors will succeed in a finite number of steps. For instance, if N processors are trying to execute an operation, some of the N processes will succeed in finishing the operation in a finite number of steps and others might fail and retry on failure.
The lock- free mode is almost as fast as blocking mode under almost all workloads, and significantly faster when threads are over- subscribed (more threads than processors). We also compare with several existing lock-based and lock-free alternatives. CCS Concepts: • Theory of computation → Concurrent algorithms.
Lock-free techniques allow multiple threads to work together in a non-blocking way, often achieving incredible performance. As the name suggests, locks are not used. If the idea of a multithreaded program without mutexes makes you uncomfortable, you are quite sane. Yet lock-free systems are pervasive.
Lock-free queue is a queue applying to concurrency but without locking. When using lock-free queue, slow or stopped processes do not prevent other processes from accessing data in it.
See Practical lock-free data structures from the University of Cambridge
I've written my own, Rig, currently queue, stack and list are there, hash-table will soon follow. While I'm still working on it, it is intended for public consumption, and the API is mostly stable, just use the SVN trunk. :)
The only other such library in C that I know of is liblfds, though I've never used it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With