Crate sync42

source ·
Expand description

§sync42

sync42 provides synchronization tools.

§Status

Active development. sync 42 is likely to expand to include new data structures. Existing data structures are maintenance-track.

§Scope

sync42 provides core types for synchronization. Any synchronization pattern general enough to be generalized is candidate for inclusion.

§Warts

  • The library is currently missing some critical data structures.
  • The documentation needs work.

§Documentation

The latest documentation is always available at docs.rs.

§Updating

  • 0.3.0 -> 0.4.0: Changes to StateHashTable and WaitList.
  • 0.2.0 -> 0.3.0: Added the StateHashTable. Backwards compatible for existing structures.

Modules§

  • Manage background-threads.
  • A RCU-like quiescent state detector.
  • A concurrent Least Recently Used cache that holds a limited number of entries, according to the size of each entry. The implementation is a concurrent, but not lock-free, structure that marries a map with a linked list.
  • Implementation of a monitor in classic Hoare-style.
  • An efficient FIFO spin lock. Threads will contend in much the same way as an MCU lock, relying on the caching system to shoot down the cache line when it gets written.
  • StateHashTable solves the rendezvous problem.
  • WaitList provides a collection for synchronizing threads. Internally, the collection owns MAX_CONCURRENCY positions of rendezvous called Waiter (private). You can call WaitList::link to allocate a waiter and return a WaitGuard. Holding a wait guard allows one to construct an iterator or random-accessor over all subsequent threads in the data structure. In this way, the head of the list can iterate the list, batching operations together, and then iterate the list again to distribute the batched work.
  • A work coalescing queue batches work to be done together, for purposes of performance.

Constants§

  • The maximum concurrency expected by any type in sync42. Performance is allowed to degrade if there are more than this many concurrent threads accessing a structure.

Functions§