7.4.1 Reader/Writer Locking

If synchronization overhead is negligible (for example, if the program uses coarse-grained parallelism), and if only a small fraction of the critical sections modify data, then allowing multiple readers to proceed in parallel can greatly increase scalability. Writers exclude both readers and each other. Figure [*] shows how the hash search might be implemented using reader-writer locking.

Figure: Reader-Writer-Locking Hash Table Search
\begin{figure}{ \scriptsize
\begin{verbatim}1 void thread1(void)
2 {
3 retr...
...pin_unlock(&lock1);
26 spin_unlock(&lock2);
27 }\end{verbatim}
}\end{figure}

Reader/writer locking is a simple instance of asymmetric locking. Snaman [ST87] describes a more ornate six-mode asymmetric locking design used in several clustered systems. Locking in general and reader-writer locking in particular is described extensively in Chapter [*].



Paul E. McKenney 2011-02-12