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
Swapping in Operating System
Swapping ek memory management technique hai jisme processes ko temporarily RAM se disk par move kiya jata hai aur wapas RAM me laya jata hai jab execution ki zarurat hoti hai.
Purpose:
Jab RAM me jagah kam ho aur naye processes ko load karna ho, tab swapping ka use kiya jata hai.
Ye multiprogramming aur multitasking ko efficiently implement karne me madad karta hai.
What is Swapping?
Swapping ek aisa process hai jisme ek running process ko temporarily secondary storage (Hard Disk) par move kiya jata hai aur jab zarurat ho to usse wapas RAM me laaya jata hai.
Ye technique OS ko multiple processes handle karne me help karti hai, bina system crash kiya.
CPU idle time ko minimize karne aur efficient resource utilization ke liye swapping useful hoti hai.
Example:
Agar RAM full hai aur ek naya process execute karna hai, toh:
-
OS ek existing process ko RAM se Hard Disk pe swap out kar dega.
-
Naya process RAM me load hoga aur execute karega.
-
Jab pehle wale process ki zarurat padegi, toh wapas RAM me load kiya jayega (Swap In).
Diagram (Swapping Process)
+-----------+ +-----------+
| Process A | | Process B | <-- Swapped Out to Disk
+-----------+ +-----------+
RAM is Full
↓ Swapping Occurs
+-----------+ +-----------+
| Process C | | Process D | <-- New Process in RAM
+-----------+ +-----------+
Steps in Swapping
1. Swap Out
Jab RAM full hoti hai aur naye process ki zarurat hoti hai, tab OS ek existing process ko disk pe move karta hai.
2. Swap In
Jab swap out kiya gaya process wapas execute hona chahiye, tab OS usse disk se RAM me load karta hai.
Advantages of Swapping
More Processes in Memory: Swapping se multiple processes execute ho sakte hain bina RAM me overload kiye.
CPU Utilization Increases: Jab ek process I/O operations me busy hota hai, toh CPU dusre process ko execute kar sakta hai.
Multitasking Support: OS efficiently multiple processes manage kar sakta hai.
Disadvantages of Swapping
Disk I/O Overhead: Frequent swapping se disk access slow ho sakta hai.
High Context Switching Time: Process ko swap in/swap out karne me extra time lagta hai.
Thrashing Issue: Agar bahut zyada swapping hoti hai, toh CPU sirf swapping me busy ho sakta hai aur process execution slow ho jata hai.
Real-Life Example of Swapping
Imagine karein ek small table jisme sirf 2 books rakh sakte hain, lekin aapke paas 4 books hain.
Jab aapko teesri book ki zarurat hoti hai, toh ek book hata kar doosri book le aate hain.
Ye hi swapping ka concept hai!
Conclusion
Swapping ek technique hai jo processes ko RAM aur Disk ke beech move karke memory efficiently manage karti hai.
CPU utilization badhane aur multitasking improve karne ke liye swapping useful hoti hai.
Lekin excessive swapping system performance slow kar sakti hai (Thrashing Issue).