TheHingineer

  • Operating System


  • OS Part-1

  • OS Part-2

  • OS Part-3

  • OS Part-4

  • OS Part-5

  • Structure & Implementation of Page Table in Operating System

    🔹 Introduction

    Paging ek memory management technique hai jo logical address space ko equal-sized pages me divide karti hai, aur physical memory ko frames me todti hai. Page Table ek data structure hota hai jo har process ke pages ka mapping store karta hai.

    ✅ Why Page Table?

    • Process ka Logical Address → Physical Address me translate karne ke liye Page Table ka use hota hai.

    • Har page ka corresponding frame number store hota hai.

    • Efficient Memory Access aur Protection provide karta hai.


    🔹 Structure of Page Table

    Page Table ek array hota hai jo har page ke liye ek entry store karta hai.
    Ek Page Table Entry (PTE) me following information hoti hai:

    Page Table EntryDescription
    Frame NumberPage ko kaunse physical frame me store kiya gaya hai
    Present/Absent BitPage memory me hai ya nahi
    Protection BitsRead/Write/Execute permissions
    Dirty BitPage modify kiya gaya hai ya nahi
    Access BitPage recently access hua hai ya nahi
    Cache Disabled BitPage cache me store hoga ya nahi

    👉 Diagram: Page Table Example

    Logical AddressPage Number | Offset

    Page Table:
    +--------+---------+----------+
    |Page No.|Frame No.|Protection|
    +--------+---------+----------+
    0      | 5       |Read-Write|
    | 1      | 9       |Read-Only |
    | 2      | 3       |Read-Write|
    | 3      | 7       |Read-Write|
    +--------+---------+----------+

    Example: Agar CPU Page 1, Offset 300 ka address generate kare, aur Page 1 ka Frame 9 ho, to:

    Physical Address=(9×Frame Size)+300


    🔹 Implementation of Page Table

    Page Table ko implement karne ke liye multiple techniques use hoti hain:

    1️⃣ Single-Level Page Table

    ✅ Simple & Direct Mapping

    • Har process ke liye ek single page table hota hai jo logical pages ko physical frames se map karta hai.

    • Disadvantage: Agar process bada ho, to bohot saari page table entries create hoti hain, jo extra memory consume karti hai.

    👉 Diagram:

    +----------+-----------+
    | Page No. | Frame No. |
    +----------+-----------+
    | 0        | 5         |
    | 1        | 9         |
    | 2        | 3         |
    +----------+-----------+
     

    2️⃣ Multi-Level Page Table

    ✅ Page Table ko multiple levels me todna

    • Badi page table ko chhoti page tables me divide karna.

    • Translation me thoda time lagta hai, lekin memory utilization improve hoti hai.

    👉 Diagram:

    Page Directory → Points to Multiple Page Tables → Points to Frames


    3️⃣ Inverted Page Table

    ✅ Memory-efficient technique

    • Instead of storing mapping for every page, yeh frames ke basis pe mapping store karta hai.

    • Disadvantage: Page lookup time zyada hota hai kyunki har frame ke liye search karna padta hai.

    👉 Diagram:

    +-----------+------------+
    | Frame No. | Process ID |
    +-----------+------------+
    | 5         | P1, Page 0 |
    | 9         | P2, Page 3 |
    | 3         | P1, Page 2 |
    +-----------+------------+
     

    🔹 Comparison of Page Table Techniques

    TechniqueAdvantageDisadvantage
    Single-Level Page TableSimple ImplementationHigh Memory Usage
    Multi-Level Page TableSaves MemoryMore Lookup Time
    Inverted Page TableEfficient for Large MemorySlow Page Searching

    🔹 Conclusion

    ✔ Page Table ek important data structure hai jo logical address ko physical address me translate karta hai.
    ✔ Different implementations available hain jaise Single-Level, Multi-Level, aur Inverted Page Table.
    ✔ Efficient memory management ke liye Page Tables me TLB (Translation Lookaside Buffer) ka bhi use hota hai.

    Scroll to Top