Distributed Systems CS

Slides:



Advertisements
Similar presentations
Message Passing Vs Distributed Objects
Advertisements

1 Communication in Distributed Systems REKs adaptation of Tanenbaums Distributed Systems Chapter 2.
Remote Procedure Call (RPC)
Remote Procedure Call Design issues Implementation RPC programming
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Tam Vu Remote Procedure Call CISC 879 – Spring 03 Tam Vu March 06, 03.
Remote Procedure CallCS-4513, D-Term Remote Procedure Call CS-4513 Distributed Computing Systems (Slides include materials from Operating System.
CS-3013 & CS-502, Summer 2006 Network Input & Output1 CS-3013 & CS-502, Summer 2006.
Distributed Systems CS Communication in Distributed Systems Lecture 5, Sep 09, 2013 Mohammad Hammoud.
Process-to-Process Delivery:
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Communication Tran, Van Hoai Department of Systems & Networking Faculty of Computer Science & Engineering HCMC University of Technology.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
TCP : Transmission Control Protocol Computer Network System Sirak Kaewjamnong.
Politecnico di Milano © 2001 William Fornaciari Operating Systems R P C Remote Procedure Call Lecturer: William Fornaciari Politecnico di Milano
3.1 Silberschatz, Galvin and Gagne ©2009Operating System Concepts with Java – 8 th Edition Chapter 3: Processes.
 Remote Procedure Call (RPC) is a high-level model for client-sever communication.  It provides the programmers with a familiar mechanism for building.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved RPC Tanenbaum.
CSE 451: Operating Systems Winter 2015 Module 22 Remote Procedure Call (RPC) Mark Zbikowski Allen Center 476 © 2013 Gribble, Lazowska,
Chapter 5: Distributed objects and remote invocation Introduction Remote procedure call Events and notifications.
 Communication Distributed Systems IT332. Outline  Fundamentals  Layered network communication protocols  Types of communication  Remote Procedure.
Remote Procedure Call RPC
McGraw-Hill Chapter 23 Process-to-Process Delivery: UDP, TCP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Computer Science Lecture 4, page 1 CS677: Distributed OS Last Class: RPCs RPCs make distributed computations look like local computations Issues: –Parameter.
Distributed Computing & Embedded Systems Chapter 4: Remote Method Invocation Dr. Umair Ali Khan.
Object Interaction: RMI and RPC 1. Overview 2 Distributed applications programming - distributed objects model - RMI, invocation semantics - RPC Products.
The Transport Layer Implementation Services Functions Protocols
Last Class: Introduction
Client-Server Communication
Lecture (2).
03 – Remote invoaction Request-reply RPC RMI Coulouris 5
Distributed Systems CS
Prof. Leonardo Mostarda University of Camerino
Distributed Systems CS
Congestion Control, Internet transport protocols: udp
Programming Models for Distributed Application
Transport Layer Our goals:
Distributed Systems CS
CMSC621: Advanced Operating Systems Advanced Operating Systems
Communication Chapter 2.
CSE 451: Operating Systems Winter 2006 Module 20 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Lecture 4: RPC Remote Procedure Call Coulouris et al: Chapter 5
Sarah Diesburg Operating Systems COP 4610
Process-to-Process Delivery:
CSE 451: Operating Systems Autumn 2003 Lecture 16 RPC
CSE 451: Operating Systems Winter 2007 Module 20 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Distributed Systems CS
Lecture 4: RPC Remote Procedure Call CDK: Chapter 5
Advanced Computer Networks
CPEG514 Advanced Computer Networkst
Remote Procedure Call (RPC) RPC – RMI - Web Services.
CSE 451: Operating Systems Winter 2004 Module 19 Remote Procedure Call (RPC) Ed Lazowska Allen Center
CSE 451: Operating Systems Spring 2012 Module 22 Remote Procedure Call (RPC) Ed Lazowska Allen Center
CSE 451: Operating Systems Autumn 2009 Module 21 Remote Procedure Call (RPC) Ed Lazowska Allen Center
EECE.4810/EECE.5730 Operating Systems
Distribution Infrastructures
Distributed Systems CS
Lecture 6: RPC (exercises/questions)
CSE 451: Operating Systems Autumn 2010 Module 21 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Lecture 6: RPC (exercises/questions)
Lecture 7: RPC (exercises/questions)
CSE 451: Operating Systems Winter 2003 Lecture 16 RPC
Process-to-Process Delivery: UDP, TCP
Distributed Systems CS
Last Class: Communication in Distributed Systems
CSE 451: Operating Systems Messaging and Remote Procedure Call (RPC)
Communication.
Transport Layer 9/22/2019.
Distributed Systems CS
Distributed Systems CS
Presentation transcript:

Distributed Systems CS 15-440 Remote Procedure Calls- Part I Lecture 4, September 12, 2018 Mohammad Hammoud

Today… Last Session: Today’s Session: Announcements: Networking- Part II Networking Principles: Encapsulation, Routing, and Congestion Control Today’s Session: Remote Procedure Calls- Part I Sockets Remote Invocations Announcements: Project I will be out tomorrow; it is due on October 11 PS1 is due on September 17

Communicating Entities in Distributed Systems Communicating entities in distributed systems can be classified into two types: System-oriented entities Processes Threads Nodes Problem-oriented entities Objects (in object-oriented programming based approaches) How can entities in distributed systems communicate?

Communication Paradigms Communication paradigms describe and classify a set of methods by which entities can interact and exchange data

Classification of Communication Paradigms Communication paradigms can be categorized into three types based on where the entities reside. If entities are running on: 1. Same Address-Space Global variables, Procedure calls, … Today, we will study how entities that reside on networked computers communicate in distributed systems using socket communication and remote invocation 2. Same Computer but Different Address-Spaces Files, Signals, Shared Memory… 3. Networked Computers Socket Communication Remote Invocation

IPC Primitives (e.g., Sockets) Middleware Layers Applications, Services Remote Invocation Middleware Layers IPC Primitives (e.g., Sockets) Transport Layer (TCP/UDP) Network Layer (IP) - In practice, the focus is on masking crash and omission failures Add a slide prior to this slide with an animated example to make your point clear. Data-Link Layer Physical Layer

No ACK will be sent by the receiver UDP Sockets UDP provides connectionless communication, with no acknowledgements or message retransmissions Communication mechanism: Server opens a UDP socket SS at a known port sp, Socket SS waits to receive a request Client opens a UDP socket CS at a random port cx Client socket CS sends a message to ServerIP and port sp Server socket SS may send back data to CS SS.receive(recvPacket) Server Client No ACK will be sent by the receiver CS cx CS.Send(msg, ServerIP, sp) SS sp SS.Send(msg, recvPacket.IP, recvPacket.port) n = Socket S = Port n S H = Host computer H

UDP– Design Considerations Sender must explicitly fragment a long message into smaller chunks before transmission A maximum size of 548 bytes is suggested for transmission Messages may be delivered out-of-order If necessary, programmer must re-order packets Communication is not reliable Messages might be dropped due to check-sum errors or buffer overflows at routers Receiver should allocate a buffer that is big enough to fit the sender’s message Otherwise the message will be truncated

TCP Sockets TCP provides in-order delivery, reliability, and congestion control Communication mechanism: Server opens a TCP server socket SS at a known port sp Server waits to receive a request (using accept call) Client opens a TCP socket CS at a random port cx CS initiates a connection initiation message to ServerIP and port sp Server socket SS allocates a new socket NSS on random port nsp for the client CS can send data to NSS Client nSS = SS.accept() Server Shall I send? SS sp CS cx OK. Set your transmission port to nsp CS.Send(msg) nSS nsp TCP fragments the message & transmits data; receiver ACKs receptions

Main Advantages of TCP TCP ensures in-order delivery of messages Applications can send messages of any size TCP ensures reliable communication via using acknowledgements and retransmissions Congestion control of TCP regulates sender rate, and thus prevents network overload

IPC Primitives (e.g., Sockets) Middleware Layers Applications, Services Remote Invocation Middleware Layers IPC Primitives (e.g., Sockets) Transport Layer (TCP/UDP) Network Layer (IP) - In practice, the focus is on masking crash and omission failures Add a slide prior to this slide with an animated example to make your point clear. Data-Link Layer Physical Layer

Remote Invocation Remote invocation enables an entity to call a procedure that typically executes on an another computer without the programmer explicitly coding the details of communication The underlying middleware will take care of raw-communication Programmer can transparently communicate with remote entity We will study two types of remote invocations: Remote Procedure Calls (RPC) Remote Method Invocation (RMI)

Remote Procedure Calls (RPC) RPC enables a sender to communicate with a receiver using a simple procedure call No communication or message-passing is visible to the programmer Basic RPC Approach: Machine A – Client Machine B – Server Client Program Communication Module Communication Module Server Procedure Basic RPC Set-up The actual implementation of the procedure is in the server’s address space A server starts a skeleton process that waits for client requests for the procedure call A client stub, which has the same signature of the server procedure, is inserted into the client’s address space During the remote procedure call: A callee program calls the client stub The client stub communicates over the network to the server skeleton The server skeleton calls the procedure The client stub returns back to the callee Request int add(int x, int y) { return x+y; } … add(a,b); Response Client process Server process Client Stub Server Stub (Skeleton)

Client Stub The client stub: Gets invoked by user code as a local procedure Packs (or serializes or marshals) parameters into a request packet (say, request-pkt) Invokes a client side transport routine (e.g., makerpc(request-pkt, &reply-pkt)) Unpacks (or de-serializes or unmarshals) reply-pkt into output parameters Returns to user code

Server Stub The server stub: Gets invoked after a server side transport routine (e.g., getrequest()) is returned Unmarshals arguments, de-multiplexes opcode, and invokes local server code Marshals arguments, invokes a server-side transport routine (e.g., sendresponse()), and returns to server loop E.g., Typical server main loop: while (1) { get-request (&p); /* blocking call */ execute-request (p); /* demux based on opcode */ }

Challenges in RPC Parameter passing via marshaling Data representation Procedure parameters and results have to be transferred over the network as bits Data representation Data representation has to be uniform Architecture of the sender and receiver machines may differ Failure Independence Client and server might fail independently

Challenges in RPC Parameter passing via marshaling Data representation Procedure parameters and results have to be transferred over the network as bits Data representation Data representation has to be uniform Architecture of the sender and receiver machines may differ Failure Independence Client and server might fail independently

Parameter Passing via Marshaling Packing parameters into a message that will be transmitted over the network is called parameter marshalling The parameters to the procedure and the result have to be marshaled before transmitting them over the network Two types of parameters can be passed: Value parameters Reference parameters

1. Passing Value Parameters Value parameters have complete information about the variable, and can be directly encoded into the message E.g., integer, float, character Values are passed through call-by-value The changes made by the callee procedure are not reflected in the caller procedure

2. Passing Reference Parameters Passing reference parameters like value parameters in RPC leads to incorrect results due to two reasons: Invalidity of reference parameters at the server Reference parameters are valid only within client’s address space Solution: Pass the reference parameter by copying the data that is referenced Changes to reference parameters are not reflected back at the client Solution: “Copy/Restore” the data Copy the data that is referenced by the parameter Copy-back the value at server to the client

Challenges in RPC Parameter passing via marshaling Data representation Procedure parameters and results have to be transferred over the network as bits Data representation Data representation has to be uniform Architecture of the sender and receiver machines may differ Failure Independence Client and server might fail independently

Data Representation Computers in DSs often have different architectures and operating systems The size of the data-type differ E.g., A long data-type is 4-bytes in 32-bit Unix, while it is 8-bytes in 64-bit Unix systems The format in which the data is stored differ E.g., Intel stores data in little-endian format, while SPARC stores in big-endian format The client and server have to agree on how simple data is represented in the message E.g., Format and size of data-types such as integer, char and float

Challenges in RPC Parameter passing via marshaling Data representation Procedure parameters and results have to be transferred over the network as bits Data representation Data representation has to be uniform Architecture of the sender and receiver machines may differ Failure Independence Client and server might fail independently

Failure Independence In the local case, the client and server live or die together In the remote case, the client sees new failure types (more on this next lecture) Network failure Server machine crash Server process crash Thus, failure handling code has to be more thorough (and essentially more complex)

Remote Procedure Call Types Remote procedure calls can be: Synchronous Asynchronous (or Deferred Synchronous)

Synchronous vs. Asynchronous RPCs An RPC with strict request-reply blocks the client until the server returns Blocking wastes resources at the client Asynchronous RPCs are used if the client does not need the result from server The server immediately sends an ACK back to the client The client continues the execution after an ACK from the server Client Server call remote procedure return from call wait for result call local procedure and return results request reply time client server call remote procedure return from call wait for acceptance call local procedure request accept request time Asynchronous RPCs are useful in scenarios where the server execution is immaterial to the client when the procedure returns no result Synchronous RPCs Asynchronous RPCs

Deferred Synchronous RPCs Asynchronous RPC is also useful when a client wants the results, but does not want to be blocked until the call finishes Client uses deferred synchronous RPCs Single request-response RPC is split into two RPCs First, client triggers an asynchronous RPC on server Second, on completion, server calls-back client to deliver the results client server call remote procedure return from call wait for acceptance call local procedure request accept request time interrupt client return results acknowledge call client with asynchronous RPC

Remote Method Invocation (RMI) RMI is similar to RPC, but in a world of distributed objects The programmer can use the full expressive power of object-oriented programming RMI not only allows to pass value parameters, but also pass object references In RMI, a calling object can invoke a method on a potentially remote object

Remote Objects and Supporting Modules In RMI, objects whose methods can be invoked remotely are known as “remote objects” Remote objects implement remote interfaces During any method call, the system has to resolve whether the method is being called on a local or a remote object Local calls should be called on a local object Remote calls should be called via remote method invocation Remote Reference Module is responsible for translating between local and remote object references

RMI Control Flow Machine A – Client Machine B – Server Request Communication Module Communication Module Skeleton and Dispatcher for B’s class Proxy for B Request Obj A Remote Obj B Response Remote Reference Module Remote Reference Module

Next class Remote Procedure Calls- Part II