292
Find Operation
The find operation is a read-only event that does not change the hash map state.
Therefore, data consistency is maintained while performing a find request. The find
operation works by first calculating the hash value for a target key and acquires read
lock for the corresponding bucket. The read lock guarantees that there is no concurrent
modifications to the bucket while we are reading it. Inside the bucket, the find operation
performs a linear search through the list of nodes.
Insert Operation
The insert method of the concurrent hash map uses the same technique to support
data consistency as the concurrent skip list data structure. The operation consists of the
following steps:
1. Allocate the new node, and assign a pointer to the new node to
persistent thread-local storage.
2. Calculate the hash value of the new node, and find the
corresponding bucket.
Figure 14-6. The concurrent hash map data structure
Chapter 14 ConCurrenCy and persistent MeMory
Précédent

- 316/457

Suivant