as we have discussed page tables map virtual page


As we have discussed, page tables map virtual page addresses to physical page addresses. One of the advantages of using virtual addresses is that we can achieve complete separation between processes, in terms of address spaces. One drawback to this is that it is convenient to be able to share some things, for example library code which would otherwise be replicated wastefully by many different programs. We don't want to have to load exactly the same library code into every process' address space; we'd prefer to map the library code to its own pages, and let all processes share those pages. This will usually reduce the memory requirements for the system. In order to do this, we need to do some common tricks with page tables.

The ?rst important memory-sharing concept is known as Copy-On-Write, or COW. COW shares pages by default, whenever sharing is still possible. Whenever a new process is created, for example by fork(), we "clone" an old process by making a copy of its page tables and marking all referenced pages as read-only.

Then whenever either of the processes (the original one, or the clone) tries to write to one of the pages, the two processes will differ, and sharing is no longer possible. The OS allocates a new page and changes the mapping in one of the page tables. If neither of the processes ever tries to modify a memory location, however, the processes will share the same (read-only) pages forever! COWtries to maximize the amount of sharing at all times.

Request for Solution File

Ask an Expert for Answer!!
Operating System: as we have discussed page tables map virtual page
Reference No:- TGS0210350

Expected delivery within 24 Hours