Copy-One-Write

The Copy-one-Write or copy on writing (often indicated by its English initials " COW") is a strategy of Optimization used in data-processing Programming. The fundamental idea: if appealing multiples require resources initalement impossible to distinguish, you can give them pointer S towards the same one resource. This fiction can be maintained until appealing modifies its " copie" resource. At this time there, one private copy is created. That prevents that the change is visible elsewhere. This occurs in a transparent way for appealing. The principal advantage is that if appealing never makes modifications, the private copy is never created.

The principal use of Copy-one-Write is the virtual Memory of operating systems. When a process created a copy of itself, pages of the memory which must be modified either by the process or by its copy are marked Copy-one-Write. When the process modifies a memory page, the core of the operating system intercepts the operation and copy the memory page so that the changes of the memory of a process do not affect that of another.

Another use is the function Calloc. It can be established by having a physical page of memory filled by zeros. When the memory is allocated, the turned over pages refer all the page of zeros and are marked Copy-one-Write. In this way, the physical quantity of memory allocated for the process does not increase as much as the data are not written in the plug turned over by calloc. Typically, that is done only for the important allowances memory.

Copy-one-Write can be established by saying to the DRIVEN that certain pages in the space of addresses of the process are in reading alone. When data are written in these pages, DRIVEN an exception raises which is managed by the core. This one allocates new space of the physical memory and makes that the written page corresponds to this new place of the physical memory.

The frugal use of the memory is a major advantage of COW. Since the core use physical only increases when data are stored, of the very efficient tables of chopping can be established. They use hardly more memory than them objects which they contain. Nevertheless, such programs risk to fall to court from space from virtual memory. Virtual pages not used by the Table of chopping cannot be used by other parts of the program. The main issue of the COW on the level core is the complexity which he adds, but the concern is similar to those raised by basic problems of virtual memory like to paginate towards the disc. When the core writes these pages, it must to copy as if it were marked Copy-one-Write.

The COW can be used apart from the core, in software Bibliothèques, applicatif software or system. The class String provided by the Standard Template Library of C++ was conceived to support establishment COW. One of the risks of the COW in these contexts comes from the code with several light Processus S where additional bolts are necessary for the objects in various light processes so that they share the same representation. The complexity of induced establishment can cancel the benefit supposed technique COW.

The software of virtualisation/emulation such as Bochs, QEMU or UML uses the COW for virtual storage on disc. That allows a great reduction of the necessary disk space when multiple virtual machines are founded on the same image disc. Moreover performances are increased because the readings on the disc can be hidden in RAM and the following readings for the other virtual machines can be been useful starting from the mask.

External bonds

  • Ext3 Copy-one-Write filesystem

  • ZFS Copy-one-Write filesystem

Random links:Viskan | Lost girls, fatty hair | Solomon of Hungary | Rosolini | Antenna has | Cinemaware