Introduction to Operating Systems: Unit III: Memory Management

Copy on Write

Memory Management - Introduction to Operating Systems

The fork () system call works by creating a copy of parent's address space for the child process.

Copy on Write

• The fork () system call works by creating a copy of parent's address space for the child process. Instead of copying the entire memory, the child copies just the page tables of the parent process and points to all of the same pages. The pages are by marked with a special Copy on Write (COW) bit.

• Fig. 4.11.1 shows copy on write implementation.

• When the contents of memory are to be updated, the COW bit is checked. If it is set, a new page is allocated, the data from the old page copied, the update is made on the new page and the "copy-on-write" bit is cleared for the new page.

• If one process tries to alter a page, a memory error occurs. The operating system receives an interrupt, sees that the page is shared, makes a copy of the page by physically copying the contents to another page frame and mapping the second page frame to the current process and gets the process to retry the memory access.

• In this way the simple case of fork() and then exec of a simple program does not use any more memory resource except that needed to hold the page tables which is a small percentage of the total virtual memory used.

• Linux, Solaris and Windows operating system used copy on write method.

Introduction to Operating Systems: Unit III: Memory Management : Tag: : Memory Management - Introduction to Operating Systems - Copy on Write


Introduction to Operating Systems: Unit III: Memory Management



Under Subject


Introduction to Operating Systems

CS3451 4th Semester CSE Dept | 2021 Regulation | 4th Semester CSE Dept 2021 Regulation



Related Subjects


Environmental Sciences and Sustainability

GE3451 ESS 4th Semester | 2021 Regulation | 4th Semester EEE Dept 2021 Regulation


Theory of Computation

CS3452 4th Semester CSE Dept | 2021 Regulation | 4th Semester CSE Dept 2021 Regulation


Artificial Intelligence and Machine Learning

CS3491 4th Semester CSE/ECE Dept | 2021 Regulation | 4th Semester CSE/ECE Dept 2021 Regulation


Database Management System

CS3492 4th Semester CSE Dept | 2021 Regulation | 4th Semester CSE Dept 2021 Regulation


Algorithms

CS3401 4th Semester CSE Dept | 2021 Regulation | 4th Semester CSE Dept 2021 Regulation


Introduction to Operating Systems

CS3451 4th Semester CSE Dept | 2021 Regulation | 4th Semester CSE Dept 2021 Regulation