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
Contiguous and Non-Contiguous Memory Allocation in Operating System
Memory allocation ek important concept hai Operating System ka, jo decide karta hai ki processes ko RAM me kaise store kiya jaye. Do major types hote hain:
-
1. Contiguous Memory Allocation
-
2. Non-Contiguous Memory Allocation
Contiguous Memory Allocation
Is allocation method me, poori memory ek continuous block me allocate hoti hai. Matlab process ke sabhi instructions aur data ek single continuous block me store hote hain.
Kaise Kaam Karta Hai?
-
Ek process ke liye ek continuous block of memory allocate kiya jata hai.
-
Process execution ke dauraan, wo memory block kisi aur process ko assign nahi kiya jata.
Diagram (Contiguous Allocation)
+----+----+----+------+----+------+------+
| OS | P1 | P2 | Free | P3 | Free | Free |
+----+----+----+------+----+------+------+
Example:
Agar ek process 200 KB ka hai, toh uske liye continuous 200 KB ka block allocate kiya jayega.
Advantages:
Fast Access: Kyunki memory continuously allocated hoti hai, isliye access speed fast hoti hai.
Less Overhead: OS ko memory mapping aur fragmentation ka dhyan kam rakhna padta hai.
Disadvantages:
External Fragmentation: Chhoti-chhoti free memory gaps banti hain, jo naye processes ke kaam nahi aati.
Fixed Size Allocation: Agar process chhoti hai, tab bhi poora allocated space use nahi hota (internal fragmentation).
Non-Contiguous Memory Allocation
Is allocation method me, process ka pura data ek single block me nahi hota, balki different memory blocks me store hota hai.
Kaise Kaam Karta Hai?
-
Process ka data alag-alag blocks me store hota hai, jo alag-alag locations par hote hain.
-
Paging aur Segmentation is technique ka implementation karte hain.
Diagram (Non-Contiguous Allocation – Paging Example)
+----+-------+-------+------+-------+-------+-------+
| OS | P1-Pg1| P3-Pg1| Free | P1-Pg2| P2-Pg1| P3-Pg2|
+----+-------+-------+------+-------+-------+-------+
Pg = Page (Process’s divided memory block)
Example:
Agar ek process 200 KB ka hai, aur RAM me 50 KB, 70 KB aur 80 KB ke free blocks available hain, toh process in blocks me todh kar store hoga.
Advantages:
No External Fragmentation: Memory efficiently use hoti hai.
Better Memory Utilization: Chhoti-chhoti memory blocks bhi use ho sakti hain.
Flexible Allocation: Badi processes split hoke multiple locations pe store ho sakti hain.
Disadvantages:
More Overhead: Process execution ke liye memory mapping aur address translation zaroori hoti hai.
Slower Access: Kyunki data different memory locations pe hota hai, access speed kam ho sakti hai.
Contiguous vs Non-Contiguous Memory Allocation
Feature | Contiguous Allocation | Non-Contiguous Allocation |
---|---|---|
Memory Allocation | Single continuous block | Multiple scattered blocks |
Fragmentation | External & Internal | Only internal fragmentation |
Speed | Fast | Slow (extra mapping required) |
Flexibility | Low | High (supports large processes) |
Conclusion
Contiguous allocation simple aur fast hoti hai, lekin fragmentation ka issue hota hai.
Non-contiguous allocation flexible hoti hai, jo memory utilization better karti hai, lekin slow ho sakti hai.
Modern OS mostly non-contiguous memory allocation (Paging & Segmentation) prefer karte hain.