Operating System
OS Part-1
OS Part-2
- File Concepts and Access methods
- Free Space Management and Allocation methods
- Directory Systems and Protection
- File Organization, Sharing and Implementation issues
- Disk and Drum Scheduling
- I/O Devices Organisation & I/O Buffering
- I/O Hardware, Kernel I/O subsystem and Transforming I/O Requests to Hardware Operations
- Device Drivers and Path Management
- Device Driver Sub Modules and Procedure
- Device Scheduler and Handler
- Interrupt Service Routine (ISR)
- File System in Linux and Windows
OS Part-3
- Process and Process Control Block(PCB)
- Process Scheduling( Preemptive and Non Preemptive)
- Scheduling Algorithms
- Algorithm Evaluation
- Multiple Processor Scheduling
- Real Time Scheduling
- Operations on Processes
- Threads
- Inter-Process Communication
- Precedence Graphs
- Critical Section Problem
- Semaphores
- Classical Problems of Synchronization
- DeadLock
- Deadlock Prevention and Avoidance
- Deadlock Detection and Recovery
- Process Management in Linux
OS Part-4
- Memory Hierarchy in OS
- Concepts of Memory Management
- MFT and MVT
- Logical and Physical Address Space
- Swapping
- Contiguous and Non Contiguous Memory Allocation
- Paging
- Segmentation
- Paging Combined with Segmentation
- Structure and Implementation of Page Table
- Virtual Memory in OS
- Cache Memory Organization
- Demand Paging
- Page Replacement Algorithms
- Allocation of Frames and Thrashing
- Demand Segmentation
OS Part-5
- Distributed Operating System: Introduction and Types
- Distributed OS: Design Issues
- Distributed OS: File System
- Distributed OS: Remote File Access
- Remote Procedure Call(RPC)
- Remote Method Invocation(RMI)
- Distributed Shared Memory
- Parallel Processing and Concurrent Programming
- Security and Threats Protection in Distributed OS
- Security Design Principles and Authentication in Distributed OS
- Sensor Network and Parallel OS
Demand Paging in Operating System
Introduction
Demand Paging ek memory management technique hai jo virtual memory ke saath use hoti hai. Isme only required pages ko RAM me load kiya jata hai, jisse memory utilization aur performance improve hoti hai.
Why Demand Paging?
-
Traditional Paging me saare pages pehle se RAM me load hote hain, jo unnecessary memory consumption karta hai.
-
Demand Paging sirf jab page required ho tabhi usko RAM me load karta hai, jisse memory wastage nahi hoti.
Example:
Agar ek program 10MB ka hai, lekin uska sirf 4MB ka code execute ho raha hai, to demand paging sirf 4MB ko RAM me load karega, baaki pages ko tabhi load karega jab zaroorat padegi.
Working of Demand Paging
Steps in Demand Paging
Process start hota hai, lekin saare pages RAM me load nahi hote.
Agar CPU kisi page ko access karta hai aur wo RAM me nahi hai, to “Page Fault” hota hai.
OS missing page ko secondary storage (HDD/SSD) se fetch karta hai aur RAM me load karta hai.
CPU execution continue karta hai.
Diagram: Demand Paging Working
CPU Request → Check in RAM
→ If Page Found → Continue Execution
→ If Page Not Found (Page Fault) → Load from HDD → Store in RAM → Resume Execution
Page Fault Handling in Demand Paging
Page Fault tab hota hai jab CPU kisi aise page ko access karne ki koshish karta hai jo RAM me available nahi hai.
OS Page Fault ko handle karne ke liye ye steps follow karta hai:
CPU Page Table check karta hai, agar page RAM me nahi hai to Page Fault occur hota hai.
OS page ko HDD/SSD se retrieve karta hai aur RAM me load karta hai.
Page Table ko update kiya jata hai taaki naye page ka address store ho sake.
Process execution resume hoti hai.
Diagram: Page Fault Handling
CPU → Check in Page Table
→ If Page in RAM → Execute
→ If Page Not in RAM → Page Fault
→ Fetch from HDD → Store in RAM → Update Page Table → Resume Execution
Performance of Demand Paging
Demand Paging ki performance mainly Page Fault Frequency par depend karti hai. Agar zyada Page Faults hote hain, to system slow ho jata hai.
Effective Access Time (EAT) Calculation:
EAT = (1 - p) * Memory Access Time + p * (Page Fault Service Time)
yahan,
-
p
= Page Fault rate (0 to 1) -
Agar
p
zyada hoga to system slow ho jayega. -
Agar
p
kam hoga to performance improve hogi.
Advantages of Demand Paging
Memory wastage kam hoti hai, kyunki sirf required pages load hote hain.
Large programs ko execute karna possible hota hai, bina RAM ke size ke restriction ke.
CPU utilization aur system performance improve hoti hai.
Disadvantages of Demand Paging
Page Faults agar zyada hon to performance degrade ho sakti hai.
HDD access slow hota hai, jo system ko temporarily slow kar sakta hai.
Thrashing issue ho sakti hai, jisme CPU zyada time Page Faults handle karne me laga deta hai instead of execution.
Conclusion
Demand Paging ek efficient memory management technique hai jo RAM ka efficient use karti hai.
Sirf required pages ko RAM me load karke memory utilization optimize hoti hai.
Page Faults minimize karne ke liye efficient page replacement algorithms ka use kiya jata hai.