Professional Documents
Culture Documents
Virtual Memory Os
Virtual Memory Os
Virtual Memory Os
Demand paging:
Def^- It is a memory management technique used by operating system to manage physical
memory more efficiently. It allows the operating system to load only the required parts of a
program into memory at the time of execution. Page that never accessed are never loaded into
the memory
A demand paging system combines the feature of paging and swapping. Thus, it requires the
same hardware as required in paging and swapping. That is, it needs a secondary storage and
page table.
Secondary storage- To facilitate swapping, the entire virtual address space of a process is
stored contiguously on a secondary storage device (usually a disk).
Whenever a process to be executed, an area on secondary storage device is allocated to it on
which its pages are copied. The area known as swap space of the process.
During the execution of a process, whenever a page is required, it is loaded into the main
memory from the swap space. Similarly, when the process is to be removed from main memory,
it is return back into the swap space if it has been modified.
Page table- To differentiate the page that are in memory from those on the disk, and an
additional bit valid is maintained in each page table entry to indicate whether the page is in the
memory or not.
If a page is valid (that is, it
exists in the virtual address space of the process) and is in the memory, the associated valid bit
is set to 1, otherwise it is set to 0.
7
6
5
Page 1
Frame valid 4
Number bit 3
Page 3 Page 3
12M-16M 0 0 2
8M-12M Page 2 1 4 1 1
Page 1 0
4M- 8M 2 0
Page 0 2 1
0M- 4M 3
Logical memory Page table physical memory
[page table in demand paging system]
Whenever a process requests for a paging