Dirty bit

A dirty bit or modified bit is a bit that is associated with a block of computer memory and indicates whether the corresponding block of memory has been modified.[1] The dirty bit is set when the processor writes to (modifies) this memory. The bit indicates that its associated block of memory has been modified and has not been saved to storage yet. When a block of memory is to be replaced, its corresponding dirty bit is checked to see if the block needs to be written back to secondary memory before being replaced or if it can simply be removed. Dirty bits are used by the CPU cache and in the page replacement algorithms of an operating system.

Dirty bits can also be used in Incremental computing by marking segments of data that need to be processed or have yet to be processed. This technique can be used with delayed computing to avoid unnecessary processing of objects or states that have not changed. When the model is updated (usually by multiple sources), only the segments that need to be reprocessed will be marked dirty. Afterwards, an algorithm will scan the model for dirty segments and process them, marking them as clean. This ensures the unchanged segments are not recalculated and saves processor time.

Page replacement

When speaking about page replacement, each page may have a modify bit associated with it in the hardware. The dirty bit for a page is set by the hardware whenever any word or byte in the page is written into, indicating that the page has been modified. When a page is selected for replacement, the modify bit is examined. If the bit is set, the page has been modified since it was read in from the disk. In this case, the page must be written to the disk. If the dirty bit is not set, however, the page has not been modified since it was read into memory. Therefore, if the copy of the page on the disk has not been overwritten (by some other page, for example), then there is no need to write the memory page to the disk: it is already there.[2]


References

  1. Laplante, Philip A. (2001). Dictionary of Computer Science, Engineering, and Technology. CRC Press. p. 138. ISBN 0-8493-2691-5.
  2. Silberschatz, Abraham; Galvin, Peter Baer; Gagne, Greg (2002). Operating System Concepts: Sixth Edition. p. 333. ISBN 0-471-41743-2.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.