01-01-2011, 11:35 AM
Vasundhra jaitly
[attachment=7837]
Introduction to paging:
• Memory is divided into fixed size chunks; FRAMES
• Process is divided into fixed size chunks;PAGES
• A frame can hold one page of data
• Physical address space of a process need not be contiguous
• Very limited internal fragmentation
• No external fragmentation
Paging is one of the memory-management schemes by which a computer can store and retrieve data from secondary storage for use in main memory. In the paging memory-management scheme, the operating system retrieves data from secondary
storage in same-size blocks called pages. The main advantage of paging is that it allows the physical address space of a process to be noncontiguous. Before paging, systems had to fit whole programs into storage contiguously, which caused various storage and fragmentation problems.
Paging is an important part of virtual memory implementation in most contemporary general-purpose operating systems, allowing them to use disk storage for data that does not fit into physical Random-access memory (RAM). Paging is usually implemented as architecture-specific code built into the kernel of the operating system.
The main functions of paging are performed when a program tries to access pages that are not currently mapped to physical memory (RAM). This situation is known as a page fault The operating system must then take control and handle the page fault, in a manner invisible to the program. Therefore, the operating system must:
1. Determine the location of the data in auxiliary storage.
2. Obtain an empty page frame in RAM to use as a container for the data.
3. Load the requested data into the available page frame.
4. Update the page table to show the new data.
5. Return control to the program, transparently retrying the instruction that caused the page fault.
Because RAM is faster than auxiliary storage, paging is avoided until there is not enough RAM to store all the data needed. When this occurs, a page in RAM is moved to auxiliary storage, freeing up space in RAM for use. Thereafter, whenever the page in secondary storage is needed, a page in RAM is saved to auxiliary storage so that the requested page can then be loaded into the space left behind by the old page