7.4.2 Hierarchical Locking
Keywords: perfbook_html

##
7.4.2 Hierarchical Locking

The idea behind hierarchical locking is to have a coarse-grained lock that is held only long enough to work out which fine-grained lock to acquire. Figure shows how our hash-table search might be adapted to do hierarchical locking, but also shows the great weakness of this approach: we have paid the overhead of acquiring a second lock, but we only hold it for a short time. In this case, the simpler data-locking approach would be simpler and likely perform better.

Figure: Hierarchical-Locking Hash Table Search

Quick Quiz 7.14: In what situation would hierarchical locking work well? End Quick Quiz