Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
CopyOnWrite
Edit
PageHistory
Diff
Info
LikePages
CopyOnWrite is a concept that allows you to create initially identical incarnations of a piece of data of which you only expect a relatively minor fraction to diverge from then on nearly for free. The idea is that instead of actually copying the original, you organize it as an indirect structure, a collection of pointers to fragments of memory which the data content of the object is strewn across. Now, you can copy this object for much lower cost by copying the pointer collection instead of all of the data. Obviously you'll still need to copy the data once you need to make individual changes, but if the pointer collection includes a flag for each fragment signifying whether it is unique to that incarnation or shared between several, you can simply copy only the one fragment with data to be changed. The canonical example of CopyOnWrite is the implementation of fork(2) in modern [Unix] [Kernel]s. The "pointer collection" in that case is the process's page table. By flagging pages read-only, the [Kernel] can simply postpone copying pages until the [PageFault]s generated by the forked processes trying to write to "their" memory. [FileSystem]s are also amenable to the concept of CopyOnWrite. See http://vserver.13thfloor.at/TBVFS/ for a project to create such a FileSystem for [Linux].
2 pages link to
CopyOnWrite
:
CompilingHowto
PageFault