Better mutual exclusion on the filesystem using Boost.AFIO
summary
A shared-memory-map mutual exclusion implementation for Boost.AFIO that detects networked-drive users and falls back to byte-range/lock-file locking is built using mmap, spinlocks, and an FMV-1A hasher to map 63-bit entities to slots; it achieves ~10–20 million ops/s uncontended and far outperforms byte-range and lock-file methods but is anti-social mutual exclusion (high atomic pressure, CPU/battery cost), has known constructor/destructor races and temp-directory/posix-lock caveats, and works fast but with portability risks.
AI-written summary · about
chapters (10)
- 0:00Introduction and setup
- 3:54History and motivation
- 13:02Boost.AFIO V2 design
- 20:02Prerequisites: monads and locks
- 26:30Shared filesystem mutex API
- 33:09Algorithm overview
- 41:07Memory map implementation
- 50:34Lock and unlock mechanics
- 53:46Benchmarks and results
- 1:01:51Conclusion and Q&A
related talks
13mLockify: Understanding Linux Distributed Lock Management Overheads in Shared Storage
28mBFFFS: a novel SMR-native file system written in Rust
12mRethinking File Mapping for Persistent Memory
20mWas file locking ever meant to work?
01h 27mFile IO - Past, Present and Future
19mWould 'reserve'/'upgrade'/'downgrade' Methods Improve 'std::shared_mutex'?
17mCoFS: A Filesystem for Fast Container Startup
12mEvery Mapping Counts in Large Amounts: Folio Accounting
