Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lock-free algorithm library

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.

like image 991
user670324 Avatar asked Jul 04 '11 14:07

user670324


People also ask

What is locking free method?

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.

Are lock-free algorithms faster?

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.

What does lock-free mean in C++?

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.

What is a lock-free queue?

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.


2 Answers

See Practical lock-free data structures from the University of Cambridge

like image 105
Doug Currie Avatar answered Sep 19 '22 08:09

Doug Currie


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.

like image 22
llongi Avatar answered Sep 18 '22 08:09

llongi