Crate rs_lockfree[−][src]
Lock-Free lib based on practical Hazard Pointers
algorithm for Rust
Hazard Pointers
algorithm
firstly saves the pointer of shared object to local thread, and then accessed it, and removes it
after accessing is over. An object can be released only when there is no thread contains its
reference, which solve the ABA problem
.
Theoretically, Hazard Pointers
resolve the performance bottleneck problem causing by atomic
reference counting, but also has some Inadequacies: It costs lot of time to traverse global
array when reclaiming memory; Traversing global array doesn't guarantee atomicity; Each shared
object should maintain relationships with all threads, which increases the cost of usage.
We provide HazardEpoch
, a practical implementation of Hazard Pointers
, which make further
improvement and provide an easier way for usage.
LockFreeQueue
and LockFreeStack
, implemented based on HazardEpoch
, contain a few simple
methods like push
, pop
.
Modules
error |
Definition of error and status. |
hazard_epoch |
Definition and implementations of of |
lockfree_queue |
Definition and implementations of |
lockfree_stack |
Definition and implementations of |
spin_lock |
Definition and implementations of |
spin_rwlock |
Definition and implementations of |
util |
Utility of project |