Inter-Process Communication (IPC) enables processes to communicate and share data through mechanisms like Shared Memory and Message Passing. Shared Memory allows fast data exchange by sharing a memory segment, while Message Passing involves sending messages via a message queue, which is safer but slower. Each method has a defined process for creating, using, and removing the communication channels.
Download as PPTX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
22 views
How IPC Works
Inter-Process Communication (IPC) enables processes to communicate and share data through mechanisms like Shared Memory and Message Passing. Shared Memory allows fast data exchange by sharing a memory segment, while Message Passing involves sending messages via a message queue, which is safer but slower. Each method has a defined process for creating, using, and removing the communication channels.
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10
How IPC Works
• Inter-Process Communication (IPC) allows processes to communicate
and share data. Two popular IPC mechanisms are: • Shared Memory – Fast communication by sharing a memory segment. • Message Passing – Communication via message queues or mailboxes. Shared Memory • In shared memory, two or more processes share a common memory segment. They read/write data to this memory instead of sending messages. Step-by-Step Working of Shared Memory: 1. Create a shared memory segment. 2.Attach the shared memory to process address space. 3.Write data into shared memory (by sender process). 4.Read data from shared memory (by receiver process). 5.Detach and remove shared memory when done. #program1(writer process)-shared memory #program2(Reader process)-shared memory Message Passing • In message passing, processes communicate by sending messages to an intermediate entity (message queue). It is safer but slower than shared memory. Step-by-Step Working of Message Passing 1.Create a message queue. 2.Sender process sends a message. 3.Receiver process retrieves the message. 4.Message queue is removed when no longer needed. #program1(sender process)-use message queue #program2(receiver process)-use message queue