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
Inter Process Communication (IPC) in Operating System
Inter Process Communication (IPC) Kya Hai?
Operating System me Inter Process Communication (IPC) ek aise mechanism ko refer karta hai jo alag-alag processes ko ek dusre se baat karne aur data share karne ka moka deta hai. Kyunki har process independent hoti hai aur apni alag memory space rakhti hai, IPC ek tarika hai jisse ye processes ek dusre se communicate kar sakein.
Example Scenario:
Maan lo tum Google Docs use kar rahe ho:
Ek process keyboard input handle kar rahi hai.
Dusri process real-time document saving ka kaam kar rahi hai.
Dono ko data exchange karna hoga taaki sab kuch smoothly chale.
IPC Kyon Zaroori Hai?
Process Synchronization: Ensure karta hai ki multiple processes coordinated tareeke se kaam karein.
Data Sharing: Ek process doosri process ke saath data easily share kar sake.
Resource Management: Agar ek se zyada processes ek hi resource use kar rahi hain to conflict avoid karne me madad karta hai.
Modularity: Software ka design modular aur efficient banata hai.
Types of IPC Mechanisms
IPC message-based ya shared memory-based ho sakta hai.
1. Message Passing
Processes OS kernel ke through ek dusre ko messages bhejti hain.
Thoda slow hota hai, par safe hota hai.
Distributed systems me zyada use hota hai.
Example: Chat applications jisme alag devices ek dusre ko messages bhejti hain.
2. Shared Memory
Multiple processes ek common memory segment share karti hain.
Faster hota hai but synchronization chahiye taaki koi conflict na ho.
Example: Google Chrome ke multiple tabs shared memory ka use karte hain.
IPC Methods in Detail
1. Pipes
Unidirectional communication ka use hota hai (data ek hi direction me flow karta hai).
Mostly parent-child processes ke beech use hota hai.
Example: Linux shell command
ls | grep "txt"
pipes ka use karti hai taakils
ka outputgrep
ko mile.
Diagram:
Process A (Writes) ──> Pipe ───> Process B (Reads)
2. Named Pipes (FIFO)
Normal pipes ki tarah hi hota hai, but iska ek naam hota hai.
Unrelated processes bhi communicate kar sakti hain.
Example:
Linux me named pipe (FIFO file) ka use karke:
mkfifo mypipe
Process1 > echo "Hello" > mypipe
Process2 > cat < mypipe
3. Message Queues
Ek queue-like structure hota hai jisme OS temporarily messages store karta hai.
Asynchronous communication ke liye use hota hai.
Diagram:
Process A ───> Message Queue ───> Process B
Example:
Ek ATM System me alag-alag processes:
Cash withdrawal request handle karti hai.
Balance update karti hai.
Transaction logging karti hai.
Ye sab processes message queues ka use karke communicate karti hain.
4. Shared Memory
Processes ek common memory segment share karti hain taaki fast communication ho sake.
Synchronization techniques (like semaphores) ki zaroorat hoti hai taaki data corrupt na ho.
Fastest IPC method hai.
Diagram:
Process A ───> [ Shared Memory Segment ] <─── Process B
Example:
Ek video streaming application me:
Ek process network se frames fetch karti hai.
Dusri process frames decode aur display karti hai.
Dono shared memory ka use karke fast data exchange karti hain.
5. Sockets
Network ke upar processes ko communicate karne ke liye use hota hai.
Local (same system) aur remote (different systems) dono ke liye kaam karta hai.
Client-server applications me zyada use hota hai.
Diagram:
Client Process ───> [ Network Socket ] ───> Server Process
Example:
Web Browsers aur Web Servers internet ke upar communicate karne ke liye sockets ka use karte hain.
Comparison of IPC Methods
IPC Method | Speed | Complexity | Best Use Case |
---|---|---|---|
Pipes | Medium | Simple | Parent-child process communication |
Named Pipes | Medium | Medium | Unrelated process communication |
Message Queues | Slow | Medium | Asynchronous communication |
Shared Memory | Fast | Complex | High-speed data exchange |
Sockets | Slow | Complex | Network-based communication |
Synchronization in IPC
Agar multiple processes ek saath shared resources use kar rahi hain, to synchronization zaroori hoti hai taaki conflicts na ho.
Synchronization Techniques:
-> Semaphores – Ek tarika hai jisse processes ek dusre ko wait karwa sakti hain.
-> Mutex (Mutual Exclusion Object) – Ensure karta hai ki ek samay me sirf ek process shared data ko access kare.
-> Monitors – High-level synchronization method hai jo multiple threads ke access ko control karta hai.
Conclusion
IPC processes ke beech communication ke liye bahut zaroori hota hai.
Alag-alag IPC mechanisms use hote hain based on requirement.
Synchronization zaroori hai jab processes shared memory ka use karti hain.