Paging is a memory management scheme that permits the physical address space of a memory process to be non-contiguous.
It avoids the problem of fitting memory chunks of varying sizes onto the backing store.
This article explains paging in detail.
It is an efficient memory management technique. It is a non-contiguous memory allocation technique.
- It involves breaking physical memory into fixed-sized blocks called frames and breaking logical memory into blocks of the same size called pages. In paging, the main memory or physical memory is divided into the fixed-size block called a frame, and the logical address space of the user process or user job is divided into a fixed-size block called a page.
- The page size or the frame size should be equal.
- The size of the page and frame is decided by the operating system of the computer.
- The Operating system maintains a data structure called a page table. The information contained in the page table helps in mapping and framing.
- The information included in the page table is allocated frames present in the main memory.
- The page table mainly consists of two fields: page no. and frame no.
- The address generated by the CPU is divided into two parts:
Page no. which maintains indexes in the page table.
Question: Two jobs are present in a ready queue. The size of Job 1 is 16 kb and Job 2 is 28 kb and the size of the main memory is 76kb. How the memory is allocated for required jobs 1 and 16, frame size = 4
Given: Job 1 = 16 kb Job 2 = 28 kb Main memory = 76 kb Frame size = 4
- Virtual memory management.
- Time-sharing system.
- Code reusability by number of processes
The major drawback of paging is caused by the page break.
We can understand page break with an example: Suppose a job size is 17 kb and we assume that size of the page is 4. We need 5 pages for the job and when we load the job into the main memory we need 5 frames. The last frame allocates 1 kb space and for the rest 4 kb is allocated. In this 3 kb is wasted. This is called page break.
Paging involves breaking physical memory into fixed-sized blocks called frames and breaking logical memory into blocks of the same size called pages. When a process is to be executed, the pages are loaded into any available memory frames from the backing store.