Lecture 3 Page 1 CS 239, Spring 2001 Interprocess Communications in Distributed Operating Systems CS 239 Distributed Operating Systems April 9, 2001.

Slides:



Advertisements
Similar presentations
DISTRIBUTED COMPUTING PARADIGMS
Advertisements

1 Process groups and message ordering If processes belong to groups, certain algorithms can be used that depend on group properties membership create (
Processes Management.
IPC (Interprocess Communication)
Interprocess Communication CH4. HW: Reading messages: User Agent (the user’s mail reading program) is either a client of the local file server or a client.
Remote Procedure Call (RPC)
©2009 Operačné systémy Procesy. 3.2 ©2009 Operačné systémy Process in Memory.
BZUPAGES.COM 1 User Datagram Protocol - UDP RFC 768, Protocol 17 Provides unreliable, connectionless on top of IP Minimal overhead, high performance –No.
Transport Layer – TCP (Part1) Dr. Sanjay P. Ahuja, Ph.D. Fidelity National Financial Distinguished Professor of CIS School of Computing, UNF.
Tam Vu Remote Procedure Call CISC 879 – Spring 03 Tam Vu March 06, 03.
Socket Programming.
Group Communications Group communication: one source process sending a message to a group of processes: Destination is a group rather than a single process.
CS 582 / CMPE 481 Distributed Systems Communications (cont.)
Inter Process Communication:  It is an essential aspect of process management. By allowing processes to communicate with each other: 1.We can synchronize.
Computer Science Lecture 2, page 1 CS677: Distributed OS Last Class: Introduction Distributed Systems – A collection of independent computers that appears.
02/02/2004CSCI 315 Operating Systems Design1 Interprocesses Communication Notice: The slides for this lecture have been largely based on those accompanying.
02/01/2010CSCI 315 Operating Systems Design1 Interprocess Communication Notice: The slides for this lecture have been largely based on those accompanying.
16: Distributed Systems1 DISTRIBUTED SYSTEM STRUCTURES NETWORK OPERATING SYSTEMS The users are aware of the physical structure of the network. Each site.
WXES2106 Network Technology Semester /2005 Chapter 8 Intermediate TCP CCNA2: Module 10.
Chapter 4.1 Interprocess Communication And Coordination By Shruti Poundarik.
Gursharan Singh Tatla Transport Layer 16-May
Chapter 17 Networking Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William Stallings.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Chapter 9 Message Passing Copyright © Operating Systems, by Dhananjay Dhamdhere Copyright © Operating Systems, by Dhananjay Dhamdhere2 Introduction.
Lecture 2 TCP/IP Protocol Suite Reference: TCP/IP Protocol Suite, 4 th Edition (chapter 2) 1.
1 Chapter Client-Server Interaction. 2 Functionality  Transport layer and layers below  Basic communication  Reliability  Application layer.
Inter-Process Communication Mechanisms CSE331 Operating Systems Design.
6.1. Transport Control Protocol (TCP) It is the most widely used transport protocol in the world. Provides reliable end to end connection between two hosts.
Jozef Goetz, Application Layer PART VI Jozef Goetz, Position of application layer The application layer enables the user, whether human.
SMUCSE 4344 transport layer. SMUCSE 4344 transport layer end-to-end protocols –transport code runs only on endpoint hosts encapsulates network communications.
ICOM 6115©Manuel Rodriguez-Martinez ICOM 6115 – Computer Networks and the WWW Manuel Rodriguez-Martinez, Ph.D. Lecture 26.
Switching breaks up large collision domains into smaller ones Collision domain is a network segment with two or more devices sharing the same Introduction.
User Datagram Protocol (UDP) Chapter 11. Know TCP/IP transfers datagrams around Forwarded based on destination’s IP address Forwarded based on destination’s.
CS1Q Computer Systems Lecture 17 Simon Gay. Lecture 17CS1Q Computer Systems - Simon Gay2 The Layered Model of Networks It is useful to think of networks.
Chapter 4: Interprocess Communication‏ Pages
1. I NTRODUCTION TO N ETWORKS Network programming is surprisingly easy in Java ◦ Most of the classes relevant to network programming are in the java.net.
Chapter 2 Applications and Layered Architectures Sockets.
The Socket Interface Chapter 22. Introduction This chapter reviews one example of an Application Program Interface (API) which is the interface between.
Chapter 4.1 Message Passing Communication Prepared by: Karthik V Puttaparthi
Interprocess Communications Andy Wang COP 5611 Advanced Operating Systems.
3.1 Silberschatz, Galvin and Gagne ©2009Operating System Concepts with Java – 8 th Edition Chapter 3: Processes.
Types of Service. Types of service (1) A network architecture may have multiple protocols at the same layer in order to provide different types of service.
Transport Layer COM211 Communications and Networks CDA College Theodoros Christophides
CE Operating Systems Lecture 13 Linux/Unix interprocess communication.
Processes CSCI 4534 Chapter 4. Introduction Early computer systems allowed one program to be executed at a time –The program had complete control of the.
EEC 688/788 Secure and Dependable Computing Lecture 10 Wenbing Zhao Department of Electrical and Computer Engineering Cleveland State University
The Client-Server Model And the Socket API. Client-Server (1) The datagram service does not require cooperation between the peer applications but such.
Distributed systems (NET 422) Prepared by Dr. Naglaa Fathi Soliman Princess Nora Bint Abdulrahman University College of computer.
Building Dependable Distributed Systems, Copyright Wenbing Zhao
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
Computer Science Lecture 3, page 1 CS677: Distributed OS Last Class: Communication in Distributed Systems Structured or unstructured? Addressing? Blocking/non-blocking?
Lecture 7 Page 1 CS 111 Online Process Communications and Concurrency CS 111 On-Line MS Program Operating Systems Peter Reiher.
 Process Concept  Process Scheduling  Operations on Processes  Cooperating Processes  Interprocess Communication  Communication in Client-Server.
4343 X2 – The Transport Layer Tanenbaum Ch.6.
1 Kyung Hee University Chapter 11 User Datagram Protocol.
UDP: User Datagram Protocol Chapter 12. Introduction Multiple application programs can execute simultaneously on a given computer and can send and receive.
Gokul Kishan CS8 1 Inter-Process Communication (IPC)
1 Network Communications A Brief Introduction. 2 Network Communications.
1 K. Salah Application Layer Module K. Salah Network layer duties.
Process-to-Process Delivery:
3. END-TO-END PROTOCOLS (PART 1) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic University 22 March
Communication in Distributed Systems. . The single most important difference between a distributed system and a uniprocessor system is the interprocess.
Last Class: Introduction
COMPUTER NETWORKS CS610 Lecture-21 Hammad Khalid Khan.
“Inter Process Communication and Coordination”
5. End-to-end protocols (part 1)
Chapter 3 Internet Applications and Network Programming
Last Class: RPCs and RMI
Interprocess Communications
Inter Process Communication (IPC)
Presentation transcript:

Lecture 3 Page 1 CS 239, Spring 2001 Interprocess Communications in Distributed Operating Systems CS 239 Distributed Operating Systems April 9, 2001

Lecture 3 Page 2 CS 239, Spring 2001 Introduction Message passing communications –Message passing paradigms –Pipes and sockets –Multicast and broadcast Request/reply communications –RPC –Secure RPC

Lecture 3 Page 3 CS 239, Spring 2001 Message Passing Communications By definition, distributed systems require IPC Most distributed systems connected only by network So most communications must be by message –Other IPC abstractions built on messages

Lecture 3 Page 4 CS 239, Spring 2001 Levels of Abstraction of Communication Interprocess Communication Network OS Communications Network Transactions Request/Reply (RPC) Message Passing Transport Connection Packet Switching

Lecture 3 Page 5 CS 239, Spring 2001 Basics of Messages Messages are collections of data objects –Header –Payload At message level, sender and receiver regarded as peers –Neither is in complete control

Lecture 3 Page 6 CS 239, Spring 2001 Steps in Sending a Message Sending process formats message Invokes local OS to send it Local OS (usually) copies it into kernel space Local OS transfers message to local network interface Network interface passes message to network hardware

Lecture 3 Page 7 CS 239, Spring 2001 Steps in Receiving a Message Message delivered from network to receiver’s network interface Interface generates interrupt for OS OS copies message to buffer OS either interrupts receiver or waits for receive system call Message (usually) copied from OS buffer to receiver process

Lecture 3 Page 8 CS 239, Spring 2001 Moving the Message OS Sender Receiver 2. Copy message into OS buffer 3. Put the message in the network interface 1. Create the message at the sender send() 5. Transfer message to network interface 6. Transfer to OS buffer receive() 7. Transfer the message to receiver process 4. Transfer message over network

Lecture 3 Page 9 CS 239, Spring 2001 Basic Message Primitives send(destination, message) –Transfer contents of message to location specified by destination receive(source,message) –Accept a message from source and put it in location specified by message

Lecture 3 Page 10 CS 239, Spring 2001 What is a Source/Destination? Complete specification of identity of a remote process Typically, a process name –Often including a machine name Often with some specification of an internal address within the process

Lecture 3 Page 11 CS 239, Spring 2001 Common Source/Destination Naming Options Process name Link Mailbox Port

Lecture 3 Page 12 CS 239, Spring 2001 Process Name Varies depending on system specifics Possible to have global, transparent process namespace More commonly, specify hosting node Is this a good idea if processes move? If only component of name, all messages to a process share one queue

Lecture 3 Page 13 CS 239, Spring 2001 Symmetric Process Naming A B send(B,message1) receive(A,&message) send(A,message) receive(B,&message)

Lecture 3 Page 14 CS 239, Spring 2001 Assymmetry in Naming Sender assumed to know receiver’s address Sometimes, receivers don’t know sender’s address ahead of time –E.g., server handling multiple clients Sometimes receive() fills source into variable, rather than specifying value

Lecture 3 Page 15 CS 239, Spring 2001 Asymmetric Process Naming A B C send(C,message) receive(&sender,&message) send(C,message) receive(&sender,&message)

Lecture 3 Page 16 CS 239, Spring 2001 Source/Destination Naming by Links Sometimes we want multiple communications paths between pairs of processes –Connections We can name these connections as sources and destinations –Links

Lecture 3 Page 17 CS 239, Spring 2001 Characteristics of Links Unidirectional Multiple links allowed between two processes Each link independently nameable Similar to multiple process entry points Dynamically created and destroyed Direct communications between peers

Lecture 3 Page 18 CS 239, Spring 2001 Links AB link1 link2 link3 send(link1,message) create_link(B) create_link(A) send(link2,message)send(link3,message)

Lecture 3 Page 19 CS 239, Spring 2001 Source/Destination Naming by Mailboxes Links aren’t appropriate for all cases Sometimes sender doesn’t care about identity of receiver –E.g., obtaining service from one of pool of servers Or receiver doesn’t care about identity of sender Mailboxes don’t require matching one sender to one receiver

Lecture 3 Page 20 CS 239, Spring 2001 Mailbox Characteristics Multiple senders can put messages into the same mailbox Multiple receivers can retrieve messages from the same mailbox Varying semantics about how each of these works

Lecture 3 Page 21 CS 239, Spring 2001 Mailboxes Mailbox send(mailbox,message) receive(mailbox,&message) send(mailbox,message) receive(mailbox,&message)

Lecture 3 Page 22 CS 239, Spring 2001 Message Synchronization and Buffering Sending and receiving a message requires some synchronization –When is it OK to send? –When is it OK to receive? –When is the process complete? –When can the system free various buffers?

Lecture 3 Page 23 CS 239, Spring 2001 Blocking and Non-blocking Send and Receiver Blocking send blocks the sender Blocking receive blocks the receiver For how long? –Some options here Non-blocking versions allow send and receive to go ahead immediately

Lecture 3 Page 24 CS 239, Spring 2001 Blocking at the Receiver In most systems, receiver blocks Must wait for message to arrive before proceeding Sometimes, only blocks from moment of message arrival until message is in receiver buffer Sometimes from point when receiver needs message

Lecture 3 Page 25 CS 239, Spring 2001 Blocking on Arrival A B Interrupt! Block!

Lecture 3 Page 26 CS 239, Spring 2001 Blocking on Demand A B receive(A,&message) Block!

Lecture 3 Page 27 CS 239, Spring 2001 Common Options for Send Blocking Non-blocking send Blocking send Reliable blocking send Explicit blocking send Request and reply

Lecture 3 Page 28 CS 239, Spring 2001 Non-Blocking Send A B Block!

Lecture 3 Page 29 CS 239, Spring 2001 Blocking Send A B Block!

Lecture 3 Page 30 CS 239, Spring 2001 Reliable Blocking Send A B Block! ACK

Lecture 3 Page 31 CS 239, Spring 2001 Explicit Blocking Send A B Block! ACK

Lecture 3 Page 32 CS 239, Spring 2001 Request and Reply A B Block!

Lecture 3 Page 33 CS 239, Spring 2001 Buffering Any delay in duration of blocking implies a buffering capability –In the sending kernel –In the network –In the receiving kernel Buffering allows multiple simultaneous sends –Also provides reliability

Lecture 3 Page 34 CS 239, Spring 2001 Pipes and Sockets A common OS features providing message communications The interface between applications and the network Hides many details of the network

Lecture 3 Page 35 CS 239, Spring 2001 Pipes Originally built as IPC for single processor system Basically a FIFO byte stream buffer Bytes fed in one end Bytes read out the other end In the same order

Lecture 3 Page 36 CS 239, Spring 2001 Pipe Details Once set up, treated like a file Typically, one process writes, another reads –Usually parent and child processes Send is non-blocking –Assuming local buffer space available Receive is blocking –Receiver explicitly asks to receive bytes –And waits for them to arrive

Lecture 3 Page 37 CS 239, Spring 2001 Pipes, Buffering, and Blocking Pipes are implemented in the kernel by setting up a buffer –Of fixed size When writer fills the buffer, further writes block When reader asks for bytes from empty buffer, reads block

Lecture 3 Page 38 CS 239, Spring 2001 Named Pipes Normal pipes only usable by processes that share file descriptors –Usually parents and children Pipes can have names attached –In file system namespace Allows any process to name either end of pipe Implemented with kernel buffers or file system

Lecture 3 Page 39 CS 239, Spring 2001 Pipes and Distributed Processing Pipe implementations assume a shared buffer space Named pipes assume a shared namespace –And shared FS or buffer space Generally, distributed systems might not have these Can we provide a similar mechanism for that environment?

Lecture 3 Page 40 CS 239, Spring 2001 Sockets A general mechanism for distributed systems IPC Subsumes pipes Sets up communication channel named by two unique endpoints

Lecture 3 Page 41 CS 239, Spring 2001 Creating Sockets Both communicating processes must issue socket() calls Creating a logical communications endpoint (LCE) –Local to creating process Must bind LCE to a physical communications endpoint (PCE)

Lecture 3 Page 42 CS 239, Spring 2001 Example of Creating Sockets A B sA = socket(domain, type, protocol) domain describes protocol family to use type describes high-level characteristics of communications protocol specifies which protocol in the family to use sB = socket(domain, type, protocol)

Lecture 3 Page 43 CS 239, Spring 2001 Binding Sockets A PCE is a network host address plus a transport port pair –Network host address space is global –Transport port pair numbers generated locally The bind() system call performs the bindings

Lecture 3 Page 44 CS 239, Spring 2001 Example of Binding Sockets A B bind(sA,name,namelen) bind(sB,name,namelen) Now A can send a message to B using the socket

Lecture 3 Page 45 CS 239, Spring 2001 Connected Sockets Bound sockets can be used for connectionless message sending Sending process must know remote PCE, though Connecting sockets allows send calls without specifying remote PCE Typically, for servers with well-known ports

Lecture 3 Page 46 CS 239, Spring 2001 Broadcast and Multicast Methods for sending the same message to more than one destination Broadcast typically sends to everyone on the network Multicast typically sends to chosen set of recipients

Lecture 3 Page 47 CS 239, Spring 2001 Best Efforts Multicast Guarantees delivery to at least one member of the group Useful when trying to obtain service from set of interchangeable servers

Lecture 3 Page 48 CS 239, Spring 2001 Reliable Multicast Guarantees delivery to all servers –Or none of them Useful for distributing shared information to cooperating processes If several reliable multicasts going on simultaneously, participants may see messages in different orders

Lecture 3 Page 49 CS 239, Spring 2001 Handling Failures in Multicast Sender expects some feedback from each recipient –Perhaps explicit acknowledgement If not all received, re-multicast –Or send to just those who didn’t acknowledge Failure of sender harder to deal with

Lecture 3 Page 50 CS 239, Spring 2001 Multicast Message Ordering FIFO: Messages from single source delivered in same order as sent Causal order: Causally related messages from different sources delivered in causal order Total order: All messages from all sources delivered in single order

Lecture 3 Page 51 CS 239, Spring 2001 Achieving FIFO Ordering Sender keeps local sequence counter Each multicast stamped with incremented counter Each receiver keeps counter for each sender Only deliver messages with expected timestamp –Queue or reject others

Lecture 3 Page 52 CS 239, Spring 2001 Achieving Causal Order Use what amounts to vector clocks –One element for each sender Sender increments local element of vector each time it multicasts –Attaching new vector to message Each receiver stores vector of last message it accepted

Lecture 3 Page 53 CS 239, Spring 2001 Receiving Causally Ordered Messages Properly Compare incoming message’s vector to stored vector If one element of incoming vector is 1 greater than stored vector, accept it Delay it if more than one element greater, or any element greater by more than 1 Reject if vector is less than stored one

Lecture 3 Page 54 CS 239, Spring 2001 Example of Receiving Causally Ordered Messages A B C Should C accept this message? Yes! 1 = 0+1, 0 = 0, and 0 = 0 But B’s message is lost Should B accept this message? No! 1 = 0+1, 0 = 0, and 1 = 0+1 B has missed a causal message

Lecture 3 Page 55 CS 239, Spring 2001 Totally Ordering Multicasts Even harder than causal order Essentially, requires a commitment protocol –Everyone agrees they’ve received the message –The sender knows everyone’s agreed –Then the message is delivered Related to 2-phase commit