Quick Quiz 11.4:
Wow!
Figure
contains 69 lines of code, compared to only 42 in
Figure
.
Is this extra complexity really worth it?
End Quick Quiz
Use of RCU enables exiting threads to wait until other threads are guaranteed to be done using the exiting threads' __thread variables. This allows the read_count() function to dispense with locking, thereby providing excellent performance and scalability for both the inc_count() and read_count() functions. However, this performance and scalability come at the cost of some increase in code complexity. It is hoped that compiler and library writers employ user-level RCU [Des09] to provide safe cross-thread access to __thread variables, greatly reducing the complexity seen by users of __thread variables.