Direct Communication - each process that wants to communicate must explicitly name the recipient or sender of the communication.
Indirect Communication - the messages are sent to and received from mailboxes, or ports.
Synchronization
- Blocking send - has the sender block until the message is received
- Nonblocking send - has the sender send the message and continue
- Blocking receive - has the receiver receive a valid message or null
- Nonblocking receive - has the receiver block until a message is available
Queue of messages attached to the link; implemented in one of three ways.
1. Zero capacity – 0 messages
Sender must wait for receiver (rendezvous).
2. Bounded capacity – finite length of n messages
Sender must wait if link full.
3. Unbounded capacity – infinite length
Sender never waits.
Producer- consumer example
Producer - generates an integer between 0 and 9 (inclusive), then stores it in a CubbyHole object. To make the synchronization problem more interesting, the Producer sleeps for a random amount of time between 0 and 100 milliseconds before repeating the number-generating cycle.Consumer - consumes all integers from the CubbyHole (the exact same object into which the Producer put the integers in the first place) as quickly as they become available.

0 comments:
Post a Comment