Click here to load reader

Chapter 4.1 Interprocess Communication And Coordination By Shruti Poundarik

Embed Size (px)

Citation preview

  • Slide 1
  • Chapter 4.1 Interprocess Communication And Coordination By Shruti Poundarik
  • Slide 2
  • Outline Interprocess Communication Message Passing Communication Basic Communication Primitives Synchronization
  • Slide 3
  • Interprocess Communication Interprocess communication is a set of techniques used to exchange data among two or more thread processes. IPC can be viewed at different levels of abstraction. Table outlines 5 levels of communication. Interprocess CommunicationTransaction Request/Reply(RPC) Message Passing Network Operating SystemTransport Connection Communication NetworkPacket Switching
  • Slide 4
  • Message Passing is the lowest level of communication between communicating processes. Request/Reply communication is based on client/server concept. Transactions are sequence of request/ reply communication. They form basic unit of communication for high level applications such as database systems.
  • Slide 5
  • Message Passing Communication Messages are collections of data objects. Messages have a header containing system-dependent control information Message body which is fixed or variable size. Basic Communication Primitives:- Two generic message passing primitives are used:- 1. Send(destination,message) 2. Receive(source,message) Messages can be anything that is comprehensible data, remote procedure calls, executable code etc. Source and destination maybe process name, link or mailbox.
  • Slide 6
  • Main Question is how are the source & destination entities are addressed. addressing can be Direct /Indirect 1)Direct Communication: Entities can be addressed by using process names (Global process identifiers). GPIs are made unique by concatenating Host Network Address+ local Generated Process Id This implies one logical communication path exists between sender and receiver.
  • Slide 7
  • Symmetric Addressing:- Direct communication path exists between sending and receiving processes. Since sender and receiver explicitly name each other in communication primitive. Asymmetric Addressing:- Only the sender needs to indicate the recipient Disadvantages of Direct Communication:- limited modularity - changing the name of a process means changing every sender and receiver process to match need to know process names
  • Slide 8
  • 2) Indirect Communication Primitives:- Sometimes the sending processes are not concerned with the identity of the receiving process as long as message is received. Receiver is not interested in the Id of the sending process as long as the message is received. Such scenarios are implemented by Mailboxes. Multiple clients might request services from one of multiple servers. We use Mailboxes.
  • Slide 9
  • process mailbox ownership : only the process may receive messages from the mailbox other processes may send to the mailbox mailbox can be created with the process and destroyed when the process dies system mailbox ownership : mailboxes have their own independent existence, not attached to any process dynamic connection to a mailbox by processes for send and/or receive
  • Slide 10
  • Message Synchronization And Buffering Message passing and synchronization depends on Synchronization. Messages are passed to senders system Kernel, which transmits to the communication network. Message then reaches remote system Kernel which delivers to destination process.
  • Slide 11
  • Synchronization and Buffering There are 2 typical combinations:- 1) Blocking Send, Blocking Receive Both receiver and sender are blocked until the message is delivered. (provides tight synchronization between processes) 2) Non Blocking Send, Blocking Receive Sender can continue the execution after sending a message, the receiver is blocked until message arrives. (most useful combination) 3) Non Blocking Send, Non Blocking Receive Neither party waits.
  • Slide 12
  • Message Synchronization Stages Sender source kernel network destination kernel receiver message 3 4 request 2 ack 1 7 6 5 reply 8 Message passing depends on Synchronization at several points. When sending a message to remote destination, the message is passed to sender system kernel which transmits it to communication network. Non blocking Send 1+8 Sender process is released after message has been composed and copied into senders kernel. Blocking Send 1+2+7+8 Sender process is released after message has been transmitted to Network. Reliable Blocking Send 1+2+3+6+7+8 Released after message has been received by kernel. Explicit Blocking Send 1+2+3+4+5+6+7+8 Sender process is released after Message has been received by receiver process. Request & Reply 1-4 service 5-8 Released after message has been processed by the receiver and response returned to the sender.
  • Slide 13
  • Pipe Pipes are implemented with finite size, FIFO byte stream buffer maintained by the kernel. Used by 2 communicating processes, a pipe serves as unidirectional communication link so that one process can write data into tail end of pipe while another process may read from head end of the pipe. Pipe is created by a system call which returns 2 file descriptors, (reading /writing) They are shared by two communicating processes,therefore pipes are used for related processes. For unrelated processes, there is need to uniquely identify a pipe since pipe descriptors cannot be shared. So concept of Named pipes. With a unique path name, named pipes can be shared among disjoint processes across different machines with a common file system.
  • Slide 14
  • Use of Named pipes is limited to single domain within a common file system. To achieve interdomain process communication neither data structures nor files can be shared or named we need an API running on top of transport layer. Two commonly APIs are Berkeley socket and System V Transport Layer Interface.
  • Slide 15
  • Socket A Socket is a communication end point of a communication link managed by the transport services. It is not feasible to name a communication channel across different domains. A Communication channel can be visualized as a pair of 2 communication endpoints. Sockets have become most popular message passing API. Most recent version of the Windows Socket which is developed by WinSock Standard Group which has 32 companies (including Microsoft) also includes a SSL (Secure Socket Layer) in the specification. The goal of SSL is to provide: Privacy in socket communication by using symmetric cryptographic data encryption. Integrity in socket data by using message integrity check. Authenticity of servers and clients by using asymmetric public key cryptography
  • Slide 16
  • References Operating System Concepts, Silberschatz, Galvin and Gange 2002 Sameer Ajmani ``Automatic Software Upgrades for Distributed Systems'' Ph.D. dissertation, MIT, Sep. 2004 Sameer Ajmani MIT An analysis of message passing systems for distributed memory computers Clematis, A.; Tavani, O.; Parallel and Distributed Processing, 1993. Proceedings. Euromicro Workshop on 27-29 Jan. 1993 Page(s):299 - 306 Parallel and Distributed Processing, 1993. Proceedings. Euromicro Workshop on