Lecture 06 Inter Process Communication (Updated)
Lecture 06 Inter Process Communication (Updated)
Communication
Lecture 6
1
Inter process communication
2
Why IPC
• Information Sharing
• Resource Sharing
• Computation Speedup
• Synchronization
• Modularity
• Convenience
3
IPC Mechanism
4
• Shared Memory − Communication between two or more processes is
achieved through a shared piece of memory among all processes. The
shared memory needs to be protected from each other by
synchronizing access to all the processes.
• Semaphores − Semaphores are meant for synchronizing access to
multiple processes. When one process wants to access the memory
(for reading or writing), it needs to be locked (or protected) and
released when the access is removed. This needs to be repeated by
all the processes to secure data.
• Signals − Signal is a mechanism to communication between multiple
processes by way of signaling. This means a source process will send
a signal (recognized by number) and the destination process will
handle it accordingly.
5
• File − A computer file is a block of arbitrary information, or resource
for storing information. A file is durable in the sense that it remains
available for programs to use after the current program has finished.
• Socket – Sockets provide point-to-point, two-way communication
between two processes. Sockets are very versatile and are a basic
component of IPC. A socket is an endpoint of communication to which
a name can be bound. It has a type and one or more associated
processes. Socket exist in communication domains. A socket domain
is an abstraction that provides an addressing structure and a set of
protocols. Socket connect only with sockets in the same domain.
6
Message Passing Systems
7
Synchronizing Messages
8
Buffering