Subscribe by Email

Friday, April 19, 2013

What is Paging? Why it is used?

- Paging is a very important concept for the computer operating systems required for managing the memory. 
- It is essentially a memory management scheme which is used for storing as well as retrieving data from the secondary memory devices.
- Under this scheme, the data is retrieved from the secondary storage devices and handed over to the operating systems. 
- The data is in the form of blocks all having the same size. 
- These data blocks are called as the pages. 
- In paging, for a process the physical address space can be kept as non–contiguous itself. 
- Paging is a very important concept for implementing the virtual memory in the operating systems designed for contemporary and general use. 
- This allows the disk storage to be used for the data that is not able to fit in to the RAM. 
- The main functions of the paging technique are carried out when a program attempts to access the pages that have no mapping to the physical RAM. 
- This situation is commonly known as the page fault. 
- In this situation, the OS comes to take control of the error. 
- This is done in a way that is invisible to the application. 

The operating system carries out the following tasks in paging:
Ø  Locates the data address in an auxiliary storage.
Ø Obtains a vacant page frame in the physical memory to be used for storing the data.
Ø  Loads the data requested by the application in to the page frame obtained in the previous step.
Ø  Make updates to the page table for showing the new data.
Ø Gives back the execution control to the program.This maintains a transparency. it again tries to execute the instruction because of which the fault occurred.

- If space is not available on RAM for storing all the requested data, then another page from RAM cannot be removed. 
- If all of the page frames are filled up, then a page frame can be obtained from the table which contains data that will be shortly emptied. 
- A page frame is said to become dirty if it is modified since its last read operation in to the RAM. 
- In such a case it has to be written back in to its original location in the drive before it is freed. 
- If this is not done, a fault will occur which will require obtaining an empty frame and reading the contents from drive in to this page. 
- The paging systems must be efficient so as to determine which frames are to be emptied. 
- Presently many page replacement algorithms have been designed for accomplishing this task. 
- Some of the mostly used for replacement are:
Ø  LRU or least recently used
Ø  FIFO or first in first out
Ø  LFU or least frequently used.

- To further increase responsiveness, paging systems may employ various strategies to predict which pages will be needed soon. 
- Such systems will attempt to load pages into main memory preemptively, before a program references them. 
- When demand paging is used, paging takes place only when some data request and not prior to it. 
- In a demand pager, execution of a program begins with none of the pages loaded in to the RAM. 

No comments:

Facebook activity