Paging in operating system

in #steemstem8 years ago

In computer operating systems , paging is a memory management scheme by which a computer stores and retrieves data from secondary storage for use in main memory.

Paging.jpg

The page table uses page number as an index; each process has its separate page table that maps logical address to the physical address. The page table contains base address of the page stored in the frame of physical memory space.
The main functions of paging are performed when a program tries to access page that are not currently mapped to physical memory (RAM). This situation is known as a page fault. The operation 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. Update the page table to show the new data.
  3. Return control to the program, transparently retrying the instruction that caused the page fault.
  4. Load the requested data into the available page frame.

jV3Wn.png

The diagram shows the process of translating a virtual address to a physical address.
The fat arrow from Program P to CPU symbolizes the program being "fed" into the CPU.
The CPU "points" to a virtual address used by an instruction to address a memory location in the program P . It is divided into two parts:
Page Table Index (p ): the virtual address contains an index into the page table, which maps a page to a page frame ( f). For a description of the mechanism, including multi-level paging, read this .
Offset (o ): as you can see, the offset is directly added to the physical address, since paging's smallest addressable unit is a page , not a byte
Finally, the calculated address is used to address a memory location in physical memory.

Coin Marketplace

STEEM 0.04
TRX 0.32
JST 0.074
BTC 64420.03
ETH 1680.07
USDT 1.00
SBD 0.42