Anonymous

What Is Demand Paging?

5

5 Answers

Dan Banks Profile
Dan Banks answered

Demand paging is a form of virtual memory, where a page of memory will be paged in if a program tries to access it and the page is not already in the main memory. Therefore, demand paging only loads pages that should be brought into real memory during the execution process, it does not need to swap all the memory for a process from the secondary memory to the main memory during the program start up.

The advantage of this process is that, only pages that are needed during the execution process are loaded, so there is more space in the main memory and therefore more processes can be loaded, reducing context switching time, which normally uses up a large amount of memory resources. However, demand paging means that programs can face extra latency when they attempt to access a page for the first time, this process may also be vulnerable to possible security risks such as timing attacks.

Demand paging process;

1.Program attempts to find a page.

2.If the page is located in the main memory then the program runs as normal.

3.If the page cannot be located then what is known as a page-fault trap occurs.

4.Then the memory reference is checked to determine it is a valid reference to a location on secondary memory, if it is then the page will have to be paged in.

5.The desired page is scheduled to be read into main memory.

6.This operation is restarted at the point before the page-fault trap occurs. (Steps 1 & 2).

7.The program can now access the desired page in the main memory.

Muhammad Azhar Profile
Muhammad Azhar answered
Virtual memory can be implemented by a technique called demanding paging. It is a technique in which a Page is brought into memory when it is actually needed.
A typical life cycle of a process is as follows:

1. When a process is initiated, the operating system must at least load one page in real memory. It is the page containing the execution part of the process.
2. Execution of the process commences and proceeds through subsequent instructions beyond the starting point.

3. This execution continues as long as memory references generated by this page are also within same page. The virtual address created may reference a page that is not in real memory. This is called a page fault. It generates an interrupt that asks for the referenced page to be loaded. This is called demanding page.

4. The operating system will try to load the referenced page into a free real memory frame. When this is achieved the execution can continue.
5. Finally when the process terminates, the operating system releases all the pages belonging to the process. The pages become available to other processes.
In general, the operating system accommodates the new page by removing a currently loaded page that is not in use. This is called page replacement. It is important to remove a page that will not be accessed in a short time. It will reduce the number of page faults in the system.
Anonymous Profile
Anonymous answered
In demand paging, when a process need to be executed then we take that process from secondary memory and we put it into memory. Normally, a disk is used to represent secondary memory. Actually not the whole process is swapped into memory but we use a lazy swapper and the duty of lazy swapper is to move the demanding page from secondary memory into memory.
So we can say that in simple words; a lazy swapper moves does not move a page into memory if that page is not necessary. In pure demand paging a page is never moved from the backing store into main memory until that page is referenced. It is the responsibility of the operating system to check where the page is in main memory and OS uses an internal table for this. Operating system reads that page after finding it, and in order to reflect change, the page table is updated. So by using this process it is possible to run a process even its entire memory image is not taken from backing store into main memory.

In this way demand paging is a better approach then paging and it also increases the degree of multiprogramming and allows a process to run even it exceed the physical space allocated for it.
Anonymous Profile
Anonymous answered
It is actually a process which is used to remove the problem of swapping.in it the program can actually be divides into no. Of pages and only one page is swapped which is currently being used. Gagan cse bksj asr

Answer Question

Anonymous