Hashing and Natural Parallism
Sequential Closed Hash Map
Add an Item
Add Another: Collision
More Collisions
More Collisions
Resizing
Resizing
Resizing
Resizing
Resizing
Resizing
Fields
Constructor
Constructor
Constructor
Add Method
Add Method
Add Method
No Brainer?
No Brainer?
Is Resizing Necessary?
Set Method Mix
When to Resize?
Coarse-Grained Locking
Fine-grained Locking
Resize This
Resize This
Resize This
Resize This
Observations
Read/Write Locks
Read/Write Locks
Read/Write Locks
Lock Safety Properties
Read/Write Lock
FIFO R/W Lock
The Story So Far
Optimistic Synchronization
Optimistic Synchronization
Stop The World Resizing
Lock-Free Resizing Problem
Lock-Free Resizing Problem
Lock-Free Resizing Problem
Lock-Free Resizing Problem
Don’t move the items
Recursive Split Ordering
Recursive Split Ordering
Recursive Split Ordering
Recursive Split Ordering
Recursive Split Ordering
Recursive Split Ordering
Recursive Split Ordering
Split-Order
When Table Splits
A Bit of Magic
A Bit of Magic
A Bit of Magic
A Bit of Magic
A Bit of Magic
Split Ordered Hashing
Parent Always Provides a Short Cut
Sentinel Nodes
Sentinel Nodes
Sentinel vs Regular Keys
Splitting a Bucket
Initialization of Buckets
Initialization of Buckets
Adding 10
Recursive Initialization
Lock-Free List
Lock-Free List
Lock-Free List
Main List
Lock-Free List
Lock-Free List
Lock-Free List
Lock-Free List
Split-Ordered Set: Fields
Fields
Fields
Fields
Fields
Fields
add()
add()
add()
add()
add()
add()
add()
Resize
Initialize Buckets
Recall: Recursive Initialization
Initialize Bucket
Initialize Bucket
Initialize Bucket
Initialize Bucket
Correctness
Closed (Chained) Hashing
Linear Probing*
Linear Probing
Linear Probing
Linear Probing
Cuckoo Hashing
Cuckoo Hashing
Hopscotch Hashing
Hopscotch Hashing
Hopscotch Hashing
Hopscotch Hashing
Hopscotch Hashing
Hopscotch Hashing
Advantages
Recall: Concurrent Chained Hashing
Concurrent Simple Hopscotch
Concurrent Simple Hopscotch
Concurrent Simple Hopscotch
Concurrent Simple Hopscotch
Is performance dominated by cache behavior?
Summary