Inter Process Communication

Cards (21)

  • Inter-process Communication (IPC)

    Processes executing concurrently in the operating system may be either independent processes or cooperating processes
  • Independent process
    Does not share data with any other processes executing in the system
  • Cooperating process
    Can affect or be affected by the other processes executing in the system
  • Reasons for Process Cooperation
    • Information sharing
    • Computation speedup
    • Modularity
    • Convenience
  • Shared memory
    A region of memory that is shared by the cooperating processes
  • Message passing
    Provides a mechanism to allow processes to communicate and to synchronize their actions without sharing the same address space
  • Producer-Consumer Problem

    1. Producer process produces information that is consumed by a consumer process
    2. Shared memory is one solution to the producer-consumer problem
  • Issues with Producer-Consumer Model
  • Message Passing
    Provides at least two operations: send(message) and receive(message)
  • Methods for implementing communication link in message passing
    • Direct communication
    • Indirect communication
  • Direct communication
    Each process that wants to communicate must explicitly name the recipient or sender of the communication
  • Indirect communication
    Messages are sent to and received from mailboxes, or ports
  • If processes P1, P2, and P3 all share mailbox A, and P1 sends a message to A while both P2 and P3 execute a receive() from A, the system may define an algorithm for selecting which process will receive the message
  • Blocking send
    The sending process is blocked until the message is received by the receiving process or by the mailbox
  • Nonblocking send
    The sending process sends the message and resumes operation
  • Blocking receive
    The receiver blocks until a message is available
  • Nonblocking receive

    The receiver retrieves either a valid message or a null
  • Ways to implement message queues
    • Zero capacity
    • Bounded capacity
    • Unbounded capacity
  • Message Passing in Windows OS
    Windows provides support for multiple operating environments, or subsystems, and application programs communicate with these subsystems via a message-passing mechanism
  • Advanced local procedure calls (ALPC) in Windows
    Used for communication between two processes on the same machine, similar to remote procedure call (RPC) but optimized for Windows
  • When an ALPC channel is created, one of three message-passing techniques is chosen: 1) For small messages, the port's message queue is used, 2) Larger messages must be passed through a section object, 3) For very large data, an API is available to allow server processes to read and write directly into the address space of a client