- An
attempt is made for accessing the page.
- If
page is present in the memory the usual instructions are followed.
- If
page is not there i.e., is invalid then a page fault is generated.
- Memory
reference to a location in the virtual memory is checked if it is valid or
not. If it’s an illegal memory access then the process is terminated. If
not the requested page has to be paged in.
- The
disk operations are scheduled for reading the requested page in to the
physical memory.
- Restarting
the instruction that raised the page fault trap.
Tuesday, June 25, 2013
Explain about demand paging and page replacements
Posted by
Sunflower
at
6/25/2013 11:49:00 AM
0
comments
Labels: Algorithms, Data, Demand Paging, Logical, Management, Memory, Operating System, Page Replacement, Page table, pages, Paging, Physical, Process, Request, Strategy, Systems, Techniques, Virtual Memory
|
| Subscribe by Email |
|
Monday, January 11, 2010
Performance of Demand Paging
Advantages of Demand Paging :
* Only loads pages that are demanded by the executing process.
* As there is more space in main memory, more processes can be loaded reducing context switching time which utilizes large amounts of resources.
* Less loading latency occurs at program start-up, as less information is accessed from secondary storage and less information is brought into main memory.
* Does not need extra hardware support than what paging needs, since protection fault can be used to get page fault.
Disadvantages of Demand Paging :
* Individual programs face extra latency when they access a page for the first time. So demand paging may have lower performance than anticipatory paging algorithms such as pre-paging.
* Programs running on low-cost, low-power embedded systems may not have a memory management unit that supports page replacement.
* Memory management with page replacement algorithms becomes slightly more complex.
* Possible security risks, including vulnerability to timing attacks.
Performance Of Demand Paging :
Let p be the probability of a page fault (0<=p<=1). We would expect p to be close to zero i.e. there will be only few page faults. The effective access time is then :
effective access time = (1-p) * ma + p * page fault time
To compute the effective access time, we must know how much time is needed to service a page fault. A page fault causes the following sequence to occur :
- Trap to the operating system.
- Save the user registers and process state.
- Determine that the interrupt was a page fault.
- Check that the page reference was legal and determine the location of the page on the disk.
- Issue a read from the disk to a free frame.
- While waiting, allocate the CPU to some other user.
- Interrupt from the disk.
- Save the registers and process state for the other user.
- Determine that the interrupt was from the disk.
- Correct the page table and other tables to show that the desired page is now in memory.
- Wait for the CPU to be allocated to this process again.
- Restore the user registers, process state, and new page table, then resume interrupted instruction.
Posted by
Sunflower
at
1/11/2010 11:08:00 PM
0
comments
Labels: Advantages, CPU, Demand Paging, Disadvantages, Memory, Page, Paging, Process
|
| Subscribe by Email |
|
Overview of Demand Paging
Demand paging follows that pages should only be brought into memory if the executing process demands them. This is often referred to as lazy evaluation as only those pages demanded by the process are swapped from secondary storage to main memory. Contrast this to pure swapping, where all memory for a process is swapped from secondary storage to main memory during the process start-up.
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.
An invalid page is one that currently resides in secondary memory. When a process tries to access a page, the following steps are generally followed:
- Attempt to access page.
- If page is valid (in memory) then continue processing instruction as normal.
- If page is invalid then a page-fault trap occurs.
- Check if the memory reference is a valid reference to a location on secondary memory. If not, the process is terminated (illegal memory access). Otherwise, we have to page in the required page.
- Schedule disk operation to read the desired page into main memory.
- Restart the instruction that was interrupted by the operating system trap.
Posted by
Sunflower
at
1/11/2010 10:44:00 PM
0
comments
Labels: Demand Paging, Invalid, Lazy evaluation, Memory, Page, Swapping, Valid
|
| Subscribe by Email |
|