Paging in Operating System

Jasmine Grover logo

Jasmine Grover

Senior Content Specialist

Paging method is the storage mechanism that is used in Operating Systems to retrieve processes from secondary storage to the main memory as pages. The paging permits a process of physical address space to be non-contiguous and refers to a memory management strategy that does away with the need to allocate contiguous physical memory.

  • The paging solves the problem of fitting memory chunks of varying sizes and helps avoid external fragmentation and the need for compaction. 
  • In the paging technique, the secondary and main memory are divided into equal fixed-size partitions which keep track of all the free frames.

Key Terms: Paging, Memory Management Unit, Contiguous, Non-Contiguous


What is Paging in the OS?

[Click Here for Sample Questions]

It is a technique that divides the memory into fixed-sized blocks. The main memory is divided into frames and logical memory is divided into pages. The concept of paging divides each process in the form of pages of equal size and main memory is divided in the form of frames of fixed size.

Paging in the OS

Paging in the OS

CASE-1 (Contiguous Allocation of Pages): In contiguous allocation, a process's memory requirements are satisfied by allocating a single contiguous block of physical memory. 

  • This means that all the required pages for a process are placed together in consecutive memory locations.
  • Contiguous allocation is simpler and often results in more efficient memory access but may lead to fragmentation issues.

CASE-2 (Non-Contiguous Allocation of Pages): In non-contiguous allocation, a process's memory requirements are satisfied by allocating multiple blocks of physical memory that may not be adjacent to each other. 

  • Non-contiguous allocation helps mitigate fragmentation issues but may result in more complex memory management
  • The system needs to keep track of multiple memory locations for a single process

Memory Management Unit

It is the computer hardware component that is responsible for all memory and caching operations that are associated with the CPU. These MMU are usually located in CP but in some cases, they operate on separate IC chips.

Read More:


Benefits of Paging in Operating Systems

[Click Here for Sample Questions]

Few benefits of Paging in OS are mentioned below:

  • Reduces internal fragmentation: It facilitates less internal fragmentation and allocates memory in fixed-size blocks (pages).
  • Enables reminiscence to be allotted on call for: Memory is most effectively allocated when needed.
  • Protection and sharing of memory: This allows the protection and sharing of reminiscence between methods.
  • External fragmentation: This results in outside fragmentation, wherein memory turns fragmented into small, non-contiguous blocks.
  • Overhead: This involves the renovation of the web page table and the translation of logical addresses to physical addresses.

Characteristics of the Page Table

[Click Here for Sample Questions]

The Characteristics of the Page Table are mentioned below:

  • It is stored in the main memory as processes can use all frames in the physical or main memory.
  • The no. of entries in the page table = the no. of pages in which the process is divided.
  • Every page has its own independent page table.
  • Paging in the OS (operating system), the internal fragmentation may occur only on the last page of a process.
  • The physical memory used by a process is no longer contagious (non-contiguous). The logical memory of a process is still contiguous.

Important Features of Paging in PC

[Click Here for Sample Questions]

Some features of Paging inPC are mentioned:

  • Logical to bodily address mapping: In case of paging, a method divides the logical address space into pages of constant size, with each page being linked to a corresponding physical frame in the main memory.
  • Paging employs a fixed page size, typically matching the size of a frame in the main memory which simplifies the memory management process and enhances system performance.
  • Every page in the logical address space of a system is denoted by a page table entry (PTE), providing information about the associated physical frame in the main memory that includes frame number, and control bits that the operating system utilizes to govern memory.
  • The quantity of page table entries in a system's page table corresponds to the number of pages in the logical address space of the process.
  • The page table for each system is commonly stored in the main memory to facilitate efficient access and modification by the OS. Nevertheless, this approach may also bring about overhead, as the page table needs to be updated whenever a process is swapped in or out of the main memory.

Advantages of Paging in OS

[Click Here for Sample Questions]

Advantages of Paging in OS:

  • It is a memory management technique that can store the pages of a single process in a non-contiguous manner.
  • The Paging technique solves the problem of external fragmentation.
  • The allocation of pages within equal and fixed-size frames is easy and simple.

Disadvantages of Paging in OS

[Click Here for Sample Questions]

Advantages of Paging in OS:

  • During the allocation of the last page of the process internal fragmentation may occur.
  • In the secondary memory, page tables are separated for each process.
  • There is a limited size of page entries within the TLB up to 1024.

Things to Remember

  • The Paging can be stored at the different locations of the memory.
  • The TLB (Translation of look-aside buffer) is associated with a high-speed cache memory.
  • Paging can avoid external fragmentation and internal fragmentation occurs in the OS.
  • The techniques that are used for structuring the page table are Hierarchical Paging, Hashed Page Tables and Inverted Page Table.
  • Page number(p) is the number of bits required to represent the pages in Logical Address Space or Page number
  • Page offset(d) is the number of bits required to represent a particular word in a page or page size of Logical Address Space or word number of a page or page offset.

Also Read:


Sample Questions

Ques. The physical memory gets broken into various fixed-sized blocks known as ___________ (1 mark)
(a) Pages
(b) Backing store
(c) Frames
(d) None of these

Ans: c) Frames

Explanation: The paging technique that divides the memory into fixed-sized blocks. The main memory is divided into frames and logical memory are divided into pages.

Ques. Which of these is used in the form of an index in a given page table? (1 mark)
(a) Page offset
(b) Frame offset
(c) Frame bit
(d) Page number

Ans: d) page number

Explanation: Page number(p): It is the number of bits needed to represent the pages in the Logical Address Space or the page number.

Ques. A page (often known as a memory page, a logical page, or a virtual page) is a __________ virtual memory block with a set length. (1 mark)
(a) Fixed-length
(b) Contagious
(c) Non-contagious
(d) Frame bit

Ans. b) Contagious

Explanation: Paging refers to a memory management strategy that does away with the need for the allocation of contiguous physical memory.

Ques. The smaller page tables can be implemented in the form of a set of which of these? (1 mark)
(a) Counters
(b) Registers
(c) Stacks
(d) Queues

Ans: b) Registers

Explanation: Dedicated registers can be used to implement the page table in hardware and register for the page table is only useful if the page table is tiny.

Ques. Consider a system with byte-addressable memory, 16-bit logical addresses, 4-kilobyte page sizes, and page table entries of 4 bytes each and the size of the page table in the system in megabytes is ___________. (1 mark)
Which one of the following is the maximum number of bits that can be used for storing protection and other information in each page table entry?
(a) 2
(b) 10
(c) 12
(d) 14

Ans. 14

Ques. Consider a machine with 64 MB of physical memory and a 32-bit virtual address space. If the page size is 4KB. The size of the page table in the system in megabytes is ___________ (1 mark)
(a) 2
(b) 4
(c) 18
(d) 16

Ans: 4

Explanation: Number of entries in page table = 232 / 4Kbyte 

= 232 / 212

= 220

Size of page table = (No. page table entries) * (Size of an entry)

= 220 * 4 bytes

= 222

= 4 Megabytes

Ques. What is the address generated by the CPU? (1 mark)
(a) Page number (p) and page offset (d)
(b) Page column (a) and page set (s)
(c) Page text (t) and page offset (o)
(d) None of these

Ans: a. Page number (p) and page offset (d)

Explanation: Page number(p): It is the number of bits required to represent the pages in Logical Address Space or Page number

Page offset(d): It is the number of bits required to represent a particular word in a page or page size of Logical Address Space or word number of a page or page offset.

Ques. What are the types of memory management techniques? (1 mark)
(a) Contiguous and Non-Contiguous
(b) Case -3 and Case – 4
(c) Continuous and Non-Continuous
(d) None of these

Ans: a) Contiguous and Non-Contiguous

Explanation: There are following two types of memory management techniques:

Contiguous: It is a process memory requirement which is satisfied by allocating a single contiguous block of physical memory.

Non-Contiguous: It is a process memory requirement which is satisfied by allocating multiple blocks of physical memory.

For Latest Updates on Upcoming Board Exams, Click Here: https://t.me/class_10_12_board_updates


Check-Out: 

Comments



No Comments To Show