Performance and Working of Paging
Last Updated :
23 Apr, 2025
Paging is a memory management technique used in operating systems to divide a process's virtual memory into fixed-sized pages. The performance of paging depends on various factors, such as:
- Page size: The larger the page size, the less the number of page tables required, which can result in faster memory access times.
However, larger page sizes also result in internal fragmentation, where memory is wasted due to the difference between the actual size of a process and the size of a page.
- Page replacement algorithms: The performance of paging depends on the page replacement algorithm used. Common algorithms include FIFO, LRU, and LFU. The choice of algorithm will affect the number of page faults and the time taken to access a page.
- Page table size: The size of the page table used to map virtual addresses to physical addresses affects the speed of memory access. A larger page table results in slower memory access times.
- Page table organization: The organization of the page table can also affect the performance of paging. A hierarchical page table, for example, can reduce the size of the page table and increase the speed of memory access.
In general, paging can improve the performance of a system by allowing processes to access more memory than is physically available and by improving the utilization of memory. However, excessive paging can result in slow performance due to a high number of page faults and the overhead associated with accessing the page table.
Evaluating the performance of paging is crucial for understanding how efficiently memory is being used in a system.
When we talk about Effective Memory Access Time (E.M.A.T), we’re measuring how long it takes to access data in memory, considering both the page table lookup and the actual memory access.
let’s assume:
- The time to access the main memory is m.
- The page table (which stores the mapping between logical and physical addresses) is also kept in main memory.
Now, since accessing data requires two steps:
- First, we have to access the page table to find the location of the required data.
- Then, we access the actual data in memory using the address obtained from the page table.
This means that we’re performing two memory accesses for every data access. So, the formula for Effective Memory Access Time (E.M.A.T) becomes:
E.M.A.T = 2 * m
- Translation lookaside buffer(TLB) is added to improve the performance of paging.
- The TLB is a hardware device implemented using associative registers.
- TLB access time will be very less compared to the main memory access time.
- TLB contains frequently referred page numbers and corresponding frame numbers.
Working of Paging
1. Paging:
- Paging is a memory management technique that divides the process's address space into equal-sized blocks called pages.
- Each page size is a power of 2.
- Main memory is also divided into fixed-sized blocks called frames, and the frame size matches the page size to optimize memory usage and avoid external fragmentation.
2. Address Translation:
The logical address (used by the process) consists of:
- Page number (identifies which page of the process).
- Page offset (identifies the specific byte within the page).
The physical address (used by the system) consists of:
- Frame number (points to the location in main memory).
- Page offset (remains the same as the logical address).
3. Page Table:
- A page table is a data structure that keeps track of the mapping between the process's pages and the physical memory frames.
- It helps in translating logical addresses into physical addresses during execution.
4. Frame Allocation: When a page is allocated a frame in memory, the logical address is translated into a physical address using the page table. This mapping is maintained throughout the program’s execution.
5. Memory Management During Execution:
- If a program (e.g., 8KB in size) cannot fit completely into memory (say, only 5KB can be loaded at once), the system uses paging to manage this.
- The OS moves idle pages to secondary memory (like disk storage) when RAM is full, freeing up space for active pages.
- When the program needs those pages again, the OS retrieves them from secondary memory and loads them back into RAM.
6. Continuous Paging: This process of swapping pages between RAM and secondary memory continues throughout the execution of the program to ensure the system runs efficiently despite limited RAM.
Now, let's see the diagram given below of the performance of paging for a better understanding.
pagingA process runs, and the OS divides it into fixed-size pages. Then the pages are mapped to the respective page frames in physical memory with the help of the page table and when a page is requested either it is a hit or it will be a miss given below:
- Page Hit: If the page is present in memory, the execution continues.
- Page Fault: If not present it result into a miss and the OS:
- Finds the page’s location via the page table.
- Loads it into a page frame.
- Updates the page table.
- Resumes the process.
Evaluating Expression for the performance of paging :
Consider the TLB access time is 'c'. And the TLB hit ratio is 'x' then the Evaluating Expression for the performance of paging is as follows.
Effective Memory Access Time (E.M.A.T) with TLB = x(c+m) + (1-x) (c + 2m)
Advantages of Paging
- The main advantage of paging is it reduces external fragmentation.
- Paging provides a way for the operating system to manage the memory used by a process, ensuring that each process has enough memory to run effectively.
- Improved Memory Utilization: By dividing a process's virtual memory into pages, paging allows the operating system to use memory more efficiently.
- Improved Process Isolation: By separating a process's virtual memory into pages, paging provides a degree of isolation between processes.
- Reduced Memory Fragmentation: Paging helps to reduce memory fragmentation by allocating memory in fixed-sized pages, rather than as a continuous block.
Disadvantages of Paging
- The main disadvantage of Paging is it suffers from Internal fragmentation because pages have a fixed size, there may be unused space within a page.
- Overhead: Paging introduces overhead in the form of additional data structures (e.g., page tables) and disk I/O operations required to swap pages in and out of memory.
- Page Faults: Paging can result in a large number of page faults, where the operating system needs to access the disk to retrieve a page that is not currently in memory.
- Limited Address Space: The use of paging can limit the size of the virtual address space available to a process, as the virtual address space is divided into pages of a fixed size.
Similar Reads
Performance of 2-level Paging
Two-level paging is a memory management technique used in operating systems to handle large virtual address spaces efficiently. By breaking down the page table into multiple levels, it reduces the memory overhead required to store page tables compared to single-level pagingIt is a hierarchical pagin
5 min read
Working Set in Paging
When pages are exchanged in and out of main memory too frequently for a process, slowing down its execution, it is called Thrashing. A process generally requires a lot of pages. But in a certain span of time, only a certain subset of these pages is used repeatedly. This is called the locality model
4 min read
Difference between Spooling and Buffering
In computing, efficient management is crucial when processing data or transmitting it. Two ways by which Input/output subsystems can improve the computer's performance and efficiency by using memory space in the main memory or on the disk are spooling and buffering. These are two techniques widely u
5 min read
Paged Segmentation and Segmented Paging
INTRODUCTION: Paged Segmentation and Segmented Paging are two different memory management techniques that combine the benefits of paging and segmentation. Paged Segmentation is a memory management technique that divides a process's address space into segments and then divides each segment into pages
6 min read
Two Level Paging and Multi Level Paging in OS
Paging is the process in which we convert the entire process into equal-sized pages. Each page further consists of a fixed number of words (if it is word addressable). The Pages are represented by the Virtual Address generated by the CPU. These Pages are mapped to the Physical Address by the MMU. So
3 min read
Performance of Computer in Computer Organization
In computer organization, performance refers to the speed and efficiency at which a computer system can execute tasks and process data. A high-performing computer system is one that can perform tasks quickly and efficiently while minimizing the amount of time and resources required to complete these
5 min read
Difference Between Paging and Segmentation
Paging divides memory into fixed-size blocks called pages, which simplifies management by treating memory as a uniform structure. In contrast, segmentation divides memory into variable-sized segments based on logical units such as functions, arrays, or data structures.Both methods offer distinct adv
4 min read
Prepaging in Operating System
Prerequisite â Virtual Memory in Operating System As suggested by the concept of virtual memory, it is not necessary that the entire process should be loaded into the main memory at the given time. The process can be executed efficiently if only some of the pages are present in the main memory at a
4 min read
Swap Space in Operating System
A computer has a sufficient amount of physical memory but most of the time we need more so we swap some memory on disk. Swap space is a space on a hard disk that is a substitute for physical memory. It is used as virtual memory which contains process memory images. Whenever our computer runs short o
6 min read
Paging in Operating System
Paging is the process of moving parts of a program, called pages, from secondary storage (like a hard drive) into the main memory (RAM). The main idea behind paging is to break a program into smaller fixed-size blocks called pages.To keep track of where each page is stored in memory, the operating s
8 min read