INTERPROCESS COMMUNICATION


INTER PROCESS 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.
PURPOSE FOR IPC:
  • DATA TRANSFER
  • SHARING DATA
  • EVENT NOTIFICATION
  • RESOURCE SHARING AND SYNCHRONIZATION
  • PROCESS CONTROL
IPC MACHANISMS:
  • MESSAGE PASSING:
  • SHARED MEMORY
MESSAGE PASSING:
  1. In massage passing there are no shared variables.
  2. IPC provides two operations for fixed and variable sized message:
  • send(message)
  • receive(message)
3.If process P and Q wish to communicate ,they need to establish
  • a communication link
  • exchange message via send and receive
4.Implementation of physical link
  • physical(e,g shared memory,hardware bus)
  • logical(e.g syntax and semantics,abstractions)
5. Methods for communication link:
  • Direct or Indirect(Naming)
  • Symmetric or Asymmetric communications
  • Automatic or Explicit buffering
  • send-by-copy or send-by-reference
  • fixed or variable sized messages
6.Direct communication:
  1. Process must name each other explicitly
-symmetric addressing
  • send(P,message)-sends message to process P
  • receive(q,message)-receive from Q
-Asymmetric Addressing
  • Send(A,message)-sends message to mail box A
  • receive(A,message)-receive message from mail box A
2.Properties of communication link:
  • Links established automatically between pairs
  • process must know each others ID
  • Exactly one link per pair of communicating processes
3.Disadvantage:
A process must know the name or ID of process(es) it wish to communicate with
7.Indirect communication:
  • Messages are sent or received from mailboxes
-Each mail box has unique ID
-Process can communicate only if they share a mail box
  • properties of communication link
  1. links established only if they share common mail box
  2. a link may be associated with more than two processes
  3. Each pair of processes may share several communication link
  • ownership:
-process owns:only owner may receive messages through this mailbox. other processes may only send. When process terminates any “owned” mailboxes are destroyed.
-System owns: mechanisms provided to create, delete, send and receive through mailboxes. Process that creates mailbox owns it but may transfer ownership to another process
8.SYNCHRINIZING MESSAGE FLOW:
Message passing may be either blocking or non-blocking
blocking send -sender blocked until message received by mailbox or process

non-blocking send -sender resumes operation immediately after sending

blocking receive- receiver blocks until a message is available

non-blocking receive-receiver returns immediately with either a valid or null message.


No comments:

Post a Comment