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
Segmentation in Operating System
Introduction to Segmentation
Segmentation ek memory management technique hai jo user ke program ko multiple logical segments me todh deti hai.
Har segment ka apna alag address space hota hai, jo same type ke data ko store karta hai.
Why Segmentation?
-
Paging fixed-size blocks (pages) ka use karta hai, jabki Segmentation logical division provide karta hai.
-
Programs alag-alag functional segments me divide kiye ja sakte hain, jaise code, stack, heap, data, etc.
-
Logical structure ke according memory allocate hoti hai, isse memory efficiently use hoti hai.
How Segmentation Works?
Segmentation me process ka logical address space multiple variable-size segments me divide hota hai.
Har segment ka apna ek segment number aur size hota hai, jo Segment Table me store hota hai.
Diagram (Segmentation Process)
Logical Address Space (Segments) Physical Memory
+----------+----------+-------+ +-----------+-------+----------+
| Segment 1| Segment 2| Stack | | Segment 2 | Stack | Segment 1|
+----------+----------+-------+ +-----------+-------+----------+
Segments ka size fixed nahi hota, balki program ke logic ke basis pe define hota hai.
Steps in Segmentation:
Process ke Logical Address Space ko multiple Segments me divide kiya jata hai.
Segment Table mapping maintain karti hai, jo batati hai ki kaunsa Segment kaunsa Physical Address use kar raha hai.
Jab CPU kisi address ko access karta hai, toh Segment Table ke through Physical Address fetch kiya jata hai.
Address Translation in Segmentation
Segmentation me Logical Address ko Physical Address me convert karna hota hai, jo Segment Table ke through hota hai.
Address Calculation Formula:
Physical Address=Base Address of Segment+Offset
Example:
Agar Segment 2 ka Base Address = 5000 ho aur CPU Logical Address = (Segment Number = 2, Offset = 1200 bytes) ho, toh:
Physical Address=5000+1200=6200
Final Physical Address = 6200 bytes.
Advantages of Segmentation
Logical Organization: Programs different logical units me divide ho sakte hain (Code, Data, Stack, Heap).
Efficient Memory Allocation: Process ka jitna required memory space hota hai, utna hi allocate hota hai.
Better User View: Segmentation user ke program ke logical structure ko follow karti hai, isliye performance aur understanding better hoti hai.
Disadvantages of Segmentation
External Fragmentation: Kyunki segments variable-size ke hote hain, toh unused memory spaces bach sakti hain.
Complex Address Translation: CPU ko Segment Table ko access karna padta hai, jo paging ke comparison me thoda slow hota hai.
Comparison: Paging vs. Segmentation
Feature | Paging | Segmentation |
---|---|---|
Division Type | Fixed-size blocks (Pages) | Logical units (Segments) |
Fragmentation | No external, but internal fragmentation | External fragmentation possible |
Memory Utilization | Efficient, but fixed-size allocation | More flexible, but fragmentation risk |
Mapping | Page Table | Segment Table |
Conclusion
Segmentation ek logical memory management technique hai, jo user programs ko meaningful logical segments me todhti hai.
Segment Table address translation me use hoti hai, jisme Base Address aur Offset ka calculation hota hai.
Segmentation external fragmentation se suffer karti hai, but logical program structure ko support karti hai.