? ??????????????Take My Breath Away? ????? ?? ???Rating: 4.4 (13 Ratings)??71 Grabs Today. 12572 Total Gra
bs. ??????Preview?? | ??Get the Code?? ?? ?????Our Hearts on Thin Ice? ????? ?? ???Rating: 5.0 (1 Rating)??52 Grabs Today. 4978 Total Grabs. ??????Preview?? | ??Get the Code?? ?? ??? BLOGGER TEMPLATES AND TWITTER BACKGROUNDS ?

Thursday, July 30, 2009

INTERPROCESS COMMUNICATION

INTERPROCESS COMMUNICATION-Interprocess communication (IPC) is a set of programming interfaces that allow a programmer to coordinate activities among different program processes that can run concurrently in an operating system. This allows a program to handle many user requests at the same time. Since even a single user request may result in multiple processes running in the operating system on the user's behalf, the processes need to communicate with each other. The IPC interfaces make this possible. Each IPC method has its own advantages and limitations so it is not unusual for a single program to use all of the IPC methods.

>••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
Message passing maybe blocking or non-blocking(synchronous or asynchronous)

>>••BLOCKING SEND
sender blocked until message is received by receiver (or by mailbox)
>>••NONBLOCKING SEND
sending process resumes operation right after sending
>>••BLOCKING RECEIVE
receiver blocks until message is available
>>••NONBLOCKING RECEIVE
receiver retrieves a valid message or returns an error code
>••BUFFERING
• The mechanism that buffers messages (a.k.a. queue) may have the following properties
– 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

>>••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-CONSUMER EXAMPLE

>>••PRODUCER-
Producer picks up an empty message/slotand send back an item produced
>>••CONSUMER-
Consumer sends N empty messages (i.e., slots)
Consumer receives an item and sends back an emptymessage (i.e., a slot)
Messages sent, but not received are buffered by OS.

0 comments: