Rss Feed
INTERPROCESS COMMUNICATION
- - -is a set of techniques for the exchange of data among multiple threads in one or more processes. Processes may be running on one or more computers connected by a network. IPC techniques are divided into methods for message passing, synchronization, shared memory, and remote procedure calls (RPC). The method of IPC used may vary based on the bandwidth and latency of communication between the threads, and the type of data being communicated. - - -
DIRECT COMMUNICATION
[ ] Sender/receiver refer to each other, as seen before
[ ] Properties of communication link
Link is established automatically between communicating processes
Link is associated with exactly two processes
Exactly one link for every pair of processes
[ ] Communication is symmetric (above) or asymmetric
send(P,m) // send a message to P
receive(&id, m) // receive from any process, set id to sender
INDIRECT COMMUNICATION


[ ] Communication via mailboxes (or ports)

[ ] Processes communicate by putting and taking messages in/from mailboxes

send(A, m) and receive(A,m)

[ ] Properties of communication link

A link is established between two processes, if they share a mailbox
Link maybe associated with more than two processes
A number of different links may exist between any pair of processes; each one a separate mailbox


SYNCHRONIZATION

- - - is timekeeping which requires the coordination of events to operate a system in unison. The familiar conductor of an orchestra serves to keep the orchestra in time. Systems operating with all their parts in synchrony are said to be synchronous or in sync. Some systems may be only approximately synchronized, or plesiochronous. For some applications relative offsets between events need to be determined, for others only the order of the event is important. - - -


[ ] BLOCKING SEND – sender blocked until message is received by receiver (or by mailbox)

[ ] NON - BLOCKING SEND – sending process resumes operation right after sending

[ ] BLOCKING RECEIVE – receiver blocks until message is available

[ ] NON - BLOCKING RECEIVE – receiver retrieves a valid message or returns an error code


BUFFERING

[ ] Zero capacity – queue has length 0, no messages can be outstanding on link, sender blocks for
message exchange

[ ] Bounded capacity – queue has length N, N messages can be in queue at any point in time, sender blocks if queue is full, otherwise it may continue to execute

[ ] Unbounded capacity – queue has infinite length, sender never blocks


PRODUCER COUNTER 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: