Paging ,Demand Paging,
Q What is paging ? How logical address is translated to physical address ? ( 6 m)
Ans :- Paging Entire memory is divided into small parts of equal size. This sections are called as page frames.
In paging, logical address space of a program can be non contiguous. The relation between virtual addresses and physical memory addresses given by page table.
Pages are not loaded continuously in main memory. Each page can be stored in any available page from anywhere in main memory. Memory management unit keeps the track of pages of program. Paging avoids external fragmentation. Operating system maintains a page table for each process. The page table shows the frame location for each page of process.
hardware performs the logical to physical address translation. Logical
address contains page number and offset . The physical address contains
frame number and offset . Offset is a relative factor. Page table
contain page number and index frame number. Page number is used as an
index into a page table
Compare Paging and SegmentationEdit
|1||Program is divided into variable size segments.||Program is divided into fixed size pages.|
|2||Segmentation is slower than paging||Paging is faster than segmentation.|
|3||Segmentation is visible to the user||Paging is invisible to the user.|
|4||Segmentation eliminates internal fragmentation||Paging suffers from internal fragmentation|
|5||Segmentation suffers from external fragmentation||There is no external fragmentation in paging|
Design Issue of PagingEdit
Q Explain the design issue for paging ? --- 6 M
Ans :- Some issues are important for good performance from a paging system.
These issues include:
- a) The working set
- b) Local versus global allocation
- c) Page size.
a) The working set :- The set of pages that a process is currently using is called its working set . If memory, it will run quickly. Execution of a program follows the principle of locality of reference. Locality of reference says that during any phase of execution, the process references only a relatively small fraction of its pages
b) Local Versus Global Allocation Policies :- A local allocation algorithm assigns a fixed number of frames to every running process. In case of page fault, the algorithm considers only the pages allocated to the defaulting process for page replacement. A global allocation algorithm dynamically allocates page frames among run able processes.
c) Page Size :- Page size is an important parameter in designing a paging system. Determining an optimum page size depends on several factors. A large page size will reduce number of pages allocated to a process . This will provide a smaller page allocation table. A smaller page size will increase the size of the page allocation table but wastage due to internal fragmentation in the last page will reduce.
Q Explain demand paging with advantages. ( 3 m)
Ans :- Demand paging :- In this method, a page is loaded into primary memory only when the process reference it. It is the simplest fetch policy implemented in virtual memory. Demand paging guarantees that the system brings into primary memory only those pages that processes actually need. It involves interaction between hardware and software component of the virtual memory paging with swapping method will become as demand paging concept. Process’s logical address space is stored on the secondary storage device.
Advantages of Demand Paging :-
- With demand paging , it is not necessary to load an entire process into main memory.
- It is possible for a process to be larger than the physical size of main memory.
- There is time saving because unused pages are not swapped in and out of memory.
- WikiNote Foundation