Table of contents
1.
Introduction
2.
What is Paging in Operating Systems?
3.
Examples of Paging in Operating System
4.
Memory Management Unit
4.1.
1. Logical Address or Virtual Address
4.2.
2. Logical Address Space or Virtual Address Space
4.3.
3. Physical Address
4.4.
4. Physical Address Space
5.
Features of Paging in PC Reminiscence Management
6.
Advantages of Paging in Operating System
7.
Disadvantages of Paging in Operating System
8.
Frequently Asked Questions
8.1.
What is the paging in the operating system memory management scheme?
8.2.
What are the two types of paging?
8.3.
What problem does paging solve?
8.4.
What does paging avoid?
9.
Conclusion
9.1.
Recommended Reading
Last Updated: Mar 27, 2024
Easy

Paging in Operating System

Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction

Paging in Operating System is a storage mechanism that enables the operating system to retrieve processes from secondary storage and place them in the main memory as pages.

The basic concept behind paging in operating system is to break each process into individual pages. The primary memory will be separated into frames as well.

One page of the process should be saved in one of the memory frames. The pages can be placed in various locations throughout the memory, but finding contiguous frames or holes is always the goal.

Process pages are only brought into the main memory when they are needed; otherwise, they are stored in secondary storage.

Frame sizes fluctuate depending on the operating system. Each frame must have the same size. Because the pages in Paging are mapped to the frames, the page size must be the same as the frame size.

Paging in Operating System

Also Read About, Internal and External Fragmentation

What is Paging in Operating Systems?

Paging in operating system is a storage mechanism that enables the operating system to retrieve processes from secondary storage and place them in the main memory as pages.

The primary memory is partitioned into little fixed-size pieces of physical memory called frames in the Paging method.

To get the most out of the main memory and avoid external fragmentation, the size of a frame should be the same as the size of a page. Paging in operating system is a logical approach for gaining faster access to data.

Examples of Paging in Operating System

Dedicated registers can be used in the hardware implementation of the page table. However, using a register for the page table is only appropriate if the page table is tiny. We can employ TLB (translation Look-aside buffer), a particular, small, fast lookup hardware cache if the page table has a high number of entries.

  • The TLB is a high-speed, associative memory.
     
  • TLB entries are made up of two parts: a tag and a value.
     
  • When this memory is accessed, an item is compared to all tags at the same time.
     
  • If the object is located, the value associated with it is returned.
    Main memory access time = m
    If the page table is kept in the main memory,
    Effective access time = m(for page table) + m(for particular page in page table).
     
Main memory access

For example, if the main memory is 16 KB and the frame memory is 1 KB. The main memory will be partitioned into 16 frames, each with one kB.

The system has four independent processes, 4 KB in size: A1, A2, A3, and A4.

All processes are divided into 1 KB pages for the operating system to store one page in a single frame.

All of the frames are left empty at the start of the process to ensure that all of the process pages are stored in a logical order.

Collection of frames

After some time, A2 and A4 are shifted to the waiting state, as seen in this example. As a result, eight frames become unoccupied, allowing new pages to be loaded into those spaces. In the ready queue is a process A5 with a size of 8 pages (8 KB).

Collection of frames 2

We can see that there are eight non-continuous frames available in the memory in this example, and paging allows us to store the process in multiple locations. This permits us to load process A5 pages instead of A2 and A4 pages.

The address generated by the CPU is divided into

  • Page number(p): Page number or the number of bits necessary to indicate the pages in Logical Address Space.
     
  • Offset(d) on the page: The number of bits necessary to represent a certain word on a page, the size of a page in Logical Address Space, or the word number of a page or the offset of a page.
     

Physical Address is divided into

  • Frame number(f): The number of bits necessary to represent a frame in Physical Address Space, often known as a frame number.
     
  • Frame offset(d): The number of bits necessary to represent a certain word in a frame, or the physical address space frame size or the word number of a frame or the frame offset. With the help of frame offset, the memory management unit can calculate the physical address of a word by combining the frame offset and the frame number. It helps to determine the location of a specific word within a frame.
     

Here are a few important points about paging in the operating system:

1. Reduces internal fragmentation: Paging divides memory into a fixed size of pages. This eliminates the wasted space within each page and it improves the memory utilization.
 

2. Enables reminiscence to be allotted on call for:  When a process needs more memory, the operating system provides more pages to the process as per the need. This on-demand allocation feature makes memory utilization efficient.
 

3 Protection and sharing of memory:  Paging provides memory protection by preventing it from unauthorized access. It also shares memory between the processed by mapping multiple logical addresses to the same physical memory pages.
 

4. External fragmentation: It occurs when the free memory blocks become scattered. Paging reduces external fragmentation by allocating memory to the fixed-sized pages.
 

5. Overhead: Overhead occurs at the time of paging due to maintaining the page table and performing address translation.

Memory Management Unit

1. Logical Address or Virtual Address

The logical address is an address that is generated by the CPU in the context of a computer system’s memory management. A process or program uses this address at the time of accessing memory.

2. Logical Address Space or Virtual Address Space

The logical address space is the total range of logical addresses that a program can access. It represents the memory address and it can be larger than the physical memory.

3. Physical Address

The Physical address is a real location in the physical memory hardware where the data is stored. It is used by the hardware components to read from or write to the physical memory.

4. Physical Address Space

The Physical address space is the total range of physical addresses that are present in the physical memory. Physical address space is determined by the capacity and the architecture of the computer system.

Features of Paging in PC Reminiscence Management

Here are some features of Paging:

  • Page desk entries:: A page table entry (PTE) is used to represent each page in a method's logical address.
     
  • Number of page desk entries: The number of entries in a method's page desk equals the number of pages inside the logical address region of the method.
     
  • Fixed web page and frame length: The page length used for paging is often the same as the size of a frame in the most crucial memory.
     
  • Logical to bodily address mapping: Paging enables a process's logical address space to be non-contiguous, which allows the process to occupy physical memory.
     
  • Page table stored in important memory: Page table is stored in the main memory that allows fast-access memory of the computer.
     

Advantages of Paging in Operating System

The following are some advantages of Paging in Operating System:-

  • Efficient memory management
     
  • Simplified allocation and deallocation
     
  • Supports virtual memory systems
     
  • Provides better utilization of physical memory

Disadvantages of Paging in Operating System

The following are some disadvantages of Paging in Operating System:-

  • Overhead due to page table maintenance
     
  • May lead to increased disk I/O
     
  • Potential for fragmentation in page allocation
     
  • Complexity in page replacement policies

 

Must Read Process Management in OS

Frequently Asked Questions

What is the paging in the operating system memory management scheme?

Paging is a memory management scheme in operating systems that divides physical memory and processes into fixed-size blocks (pages) to manage memory allocation efficiently.

What are the two types of paging?

The two types of paging in operating systems are "Hierarchical Paging," which uses a multi-level page table, and "Hashed Page Tables," which employ a hash function for page mapping.

What problem does paging solve?

Paging enables a process's logical address space to be non-contiguous, which allots the process's physical memory. We separate the processes into pages to put this strategy into practise. Blocks with defined size make up pages.

What does paging avoid?

Although paging reduces external fragmentation, internal fragmentation still exists. When memory is divided up into fixed-sized blocks, internal fragmentation occurs. It happens when a process uses less space or requires more space than the memory block size provided.

Conclusion

In this article, we learned about the important concept of memory management in operating systems. We learned about paging in operating system and Advantages and Disadvantages of Operating System. We also saw the concept of segmentation in the operating systems.

Recommended Reading

Apart from this, you can also expand your knowledge by referring to these articles on Operating System Guided Paths.

For more information about operating systems, get into the entire Operating Systems Course.

Happy Learning!

Live masterclass