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 Segmentation in Operating System
🔹 Introduction
Demand Segmentation ek memory management technique hai jo Segmentation aur Demand Paging ka combination hai.
Traditional Segmentation me pura segment memory me load hota hai.
Demand Segmentation me sirf required segment ko memory me load kiya jata hai, baaki secondary storage (disk) me rehta hai.
✅ Benefit: Memory wastage kam hoti hai aur system ki efficiency improve hoti hai.
🔹 Working of Demand Segmentation
🔹 Jab program execute hota hai, tab uske sabhi segments ko RAM me load karna zaroori nahi hota.
🔹 Only active segments ko RAM me load kiya jata hai, baaki disk par rehte hain.
🔹 Jab bhi ek segment ki zaroorat hoti hai jo memory me available nahi hota, tab “segment fault” hota hai.
🔹 OS us segment ko disk se memory me load karta hai aur execution continue hoti hai.
💡 Example:
Maan lo ek program ke 3 segments hain:
1️⃣ Code Segment (CS)
2️⃣ Data Segment (DS)
3️⃣ Stack Segment (SS)
Agar process sirf Code Segment ko use kar raha hai, to sirf wahi RAM me load hoga.
Jab Data Segment ki zaroorat hogi, tab OS usko disk se RAM me load karega.
🔹 Components of Demand Segmentation
1️⃣ Segment Table
Har process ka ek Segment Table hota hai jo segments ki location aur status store karta hai.
Segment Table ka format:
Segment Number | Base Address | Limit | Presence Bit |
---|---|---|---|
0 (Code) | 5000 | 400 | 1 (Present) |
1 (Data) | 9000 | 800 | 0 (Not Present) |
2 (Stack) | 12000 | 600 | 1 (Present) |
Presence Bit:
✅ 1 → Segment RAM me hai
❌ 0 → Segment disk me hai
2️⃣ Segment Fault
Jab processor ek segment ko access karta hai jo RAM me nahi hai, to segment fault hota hai.
OS us segment ko disk se memory me load karta hai.
3️⃣ Segment Swapping
Agar memory full ho, to kisi unused segment ko disk me swap karke naye segment ke liye jagah banayi jati hai.
LRU (Least Recently Used) algorithm ka use karke least used segment ko swap kiya jata hai.
🔹 Advantages of Demand Segmentation
✅ Memory Wastage Kam Hoti Hai:
Sirf required segments ko RAM me load kiya jata hai, jo memory efficient hota hai.
✅ Large Programs ko Run Karna Possible Hota Hai:
Agar RAM kam hai, tab bhi large programs execute ho sakte hain kyunki poora program ek saath load nahi hota.
✅ Less Page Faults as Compared to Paging:
Demand paging me page faults zyada hote hain, lekin demand segmentation me comparatively kam hote hain.
✅ Better Performance:
Segment fault hone par sirf ek segment ko load kiya jata hai, jo paging se better performance deta hai.
🔹 Disadvantages of Demand Segmentation
❌ Segment Table Overhead:
Har process ke liye Segment Table maintain karna padta hai, jo extra memory consume karta hai.
❌ Complex Implementation:
Paging ke comparison me segmentation implementation thoda complex hota hai.
❌ Swapping Overhead:
Agar segment fault zyada hote hain, to swapping overhead badh sakta hai.
🔹 Demand Segmentation vs Demand Paging
Feature | Demand Segmentation | Demand Paging |
---|---|---|
Unit of Allocation | Segment | Page |
Size | Variable | Fixed |
Fragmentation | External Fragmentation | Internal Fragmentation |
Table Used | Segment Table | Page Table |
Overhead | High | Medium |
Usage | Compiler, OS Modules | Virtual Memory |
🔹 Conclusion
✔ Demand Segmentation ek powerful technique hai jo segmentation aur demand paging ka combination use karti hai.
✔ Sirf required segments ko RAM me load karne se memory efficiently use hoti hai.
✔ Segment faults hone par OS segment ko disk se RAM me load karta hai.
✔ Demand Segmentation ka use compiler, operating system modules, aur large applications me hota hai.