3b-Interprocess Communication
3b-Interprocess Communication
Chapter 3
Interprocess Communication
Processes within a system may be independent or cooperating
An independent process cannot affect or be affected by execution of
another process
A cooperating process can affect or be affected by the execution of
another process
The communication is under the control of the users processes not the OS.
Mostly used in distributed systems, for small amount of data transfer (fixed
or variable length messages) as it is time consuming
Message Format
Consists of header and body of the
message
In UNIX: no ID, only message type
Control Information
What to do if run out of buffer space
Sequence numbers
Priority
When done a process can detach the shared memory from its address space
shmdt(shared_memory);
Sockets (Internet)
Pipes
Some Issues:
Is communication unidirectional or bidirectional?
In the case of two-way communication, is it half or full-duplex?
Must there exist a relationship (i.e. parent-child) between the
communicating processes?
Can the pipes be used over a network?
Ordinary pipes – cannot be accessed from outside the process that created it.
Typically, a parent process creates a pipe and uses it to communicate with a
child process that it created.
Named pipes – can be accessed without a parent-child relationship.
Ordinary Pipes
Ordinary Pipes allow communication in standard producer-consumer
style
Consumer reads from the other end (the read-end of the pipe)
Communication is bidirectional