Definition:
Shared memory:
- An area of memory shared among the processes that wish to communicate.
- The communication is under the control of the users processes not OSs
- Other way is have many processes accessing shared memory, Shared memory
- Main issue: Process Synchronization
Message passing
- Processes communicate with each other
- without resorting to shared variables
- using communication link
- IPC facility provides two operations:
send(P, message)
: send message to Preceive(Q, message)
: receive message from Q
- The message size is either fixed or variable
- Direct vs Indirect communication:
- Direct: peer to peer
- Indirect communication: has a MailBox for each of a group of process to subscribe to
- Synchronous vs asynchronous communication:
send(P,message) | receive(Q,message) | ||
---|---|---|---|
Synchronous (blocking) | The sender wait until the message is received then continue | The receiver wait until a message is sent | doesnt need much buffer size |
Asynchronous (non-blocking) | The senders send message and continue | The receiver checks received message, can be null or a message | buffer needs to be large enough |
- Buffering communication:
- Zero capacity – no messages are queued on a link.
- synchronous
- Bounded capacity – finite length of n messages
- Sender must wait if link full
- asynchronous
- Unbounded capacity – infinite length
- Sender never waits
- asynchronous
- Zero capacity – no messages are queued on a link.