Jump to content

Read-copy-update

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Halmonster (talk | contribs) at 17:42, 29 July 2003. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Read-copy-update is an operating system kernel technology for improving performance on computers with more than one CPU.

The basic idea is as follows. Assume you have a data structure which is shared by multiple threads of execution. When a thread wants to read the structure, it uses a pointer to the structure and continues on. When a thread wants to write to the structure, it creates a new structure, copies the data from the old structure into the new one, saves a pointer to the old structure, updates the global pointer to refer to the new structure, and then sleeps until the kernel determines that there are no readers left using the old structure. When the thread which made the copy is woken up by the kernel, it can safely deallocate the old structure.

This technique is great for data with many readers and very few writers, but is likely to be less efficient in other cases.