The Read CopyUpdate Mechanism
Read-copy-update (RCU) is a rather new synchronization mechanism that was added during the development of kernel 2.5, but has been very favorably accepted by the kernel community. It is by now used in numerous places all over the kernel. RCU performs very well in terms of performance impact, if at a slight cost in memory requirements, which is, however, mostly negligible. This is a good thing, but good things are always accompanied by a number of not-so-good things. This time, it's the constraints that RCU places on potential users:
□ Accesses to the shared resource should be Read Only most of the time, and writes should be correspondingly rare.
□ The kernel cannot go to sleep within a region protected by RCU.
□ The protected resource must be accessed via a pointer.
The principle of RCU is simple: The mechanism keeps track of all users of the pointer to the shared data structure. When the structure is supposed to change, a copy (or a new instance that is filled in appropriately, this does not make any difference) is first created and the change is performed there. After all previous readers have finished their reading work on the old copy, the pointer can be replaced by a pointer to the new, modified copy. Notice that this allows read access to happen concurrently with write updates!
Continue reading here: Core API
Was this article helpful?