Implementing Hazard Pointers in Rust (part 3)
Channel: Jon Gjengset
Date: 2021-10-31

We continue our journey implementing Hazard Pointers (https://erdani.org/publications/cuj-2004-12.pdf) in Rust. We follow along with the C++ implementation in Facebook's Folly library (https://github.com/facebook/folly/blob/master/folly/synchronization/Hazptr.h), starting from where we left off last time: https://github.com/jonhoo/haphazard/tree/29b41ba3c3e31a7b044e489a67d61d5a009e9d3f. Much of the stream is catching up with the change to folly since last time (https://github.com/facebook/folly/commits/main?before=d2154674583a01e9d76e2c38e1c37e531132099e+35&branch=main&path%5B%5D=folly&path%5B%5D=synchronization), though we do also get to writing some concurrency tests with loom (https://docs.rs/loom/).

0:00:00 Introduction
0:03:12 Follow-up from last time
0:05:55 Re-visiting the interface
0:17:16 rebase: reset_protection
0:19:17 Folly changes since last time
0:22:50 rebase: hazard pointer constructors
0:41:39 rebase: irrelevant c++ commits
0:42:28 rebase: type renames
0:56:45 rebase: more irrelevant c++ commits
1:02:15 rebase: from push_retire to push_list
2:59:18 Tracking down a segfault with gdb
3:04:37 rebase: sharding the untagged list
3:44:08 rebase: track available hazard pointers
3:57:15 A quick break
4:01:10 cont'd: track available hazard pointers
5:03:48 Concurrency testing with loom
5:45:25 Writing a loom test
6:30:31 Test with two readers
6:40:22 Test dropping a non-global domain
6:45:35 Summary and next steps

You can find the latest code for the implementation at https://github.com/jonhoo/haphazard.

Live version with chat: https://youtu.be/2Iu2BnO9iHg