COMMUNICATION PROTOCOLS: REMOTE PROCEDURE CALL (RPC)

Similar documents
Lecture 5: Object Interaction: RMI and RPC

Lecture 06: Distributed Object

Distributed Objects and Remote Invocation. Programming Models for Distributed Applications

Remote Invocation. Today. Next time. l Overlay networks and P2P. l Request-reply, RPC, RMI

RMI: Design & Implementation

Communication in Distributed Systems: Sockets Programming. Operating Systems

CHAPTER - 4 REMOTE COMMUNICATION

Communication. Overview

Outline. EEC-681/781 Distributed Computing Systems. The OSI Network Architecture. Inter-Process Communications (IPC) Lecture 4

Introduction and Overview Socket Programming Higher-level interfaces Final thoughts. Network Programming. Samuli Sorvakko/Nixu Oy

CSci Introduction to Distributed Systems. Communication: RPC

Distributed Systems. The main method of distributed object communication is with remote method invocation

Last Class: RPCs. Today:

Middleware. Adapted from Alonso, Casati, Kuno, Machiraju Web Services Springer 2004

Introduction and Overview Socket Programming Higher-level interfaces Final thoughts. Network Programming. Samuli Sorvakko/Nixu Oy

Introduction and Overview Socket Programming Lower-level stuff Higher-level interfaces Security. Network Programming. Samuli Sorvakko/Nixu Oy

Chapter 4 Communication

Message Passing vs. Distributed Objects. 5/15/2009 Distributed Computing, M. L. Liu 1

Communication. Communication. Distributed Systems. Networks and protocols Sockets Remote Invocation Messages Streams. Fall /10/2001 DoCS

Communication. Outline

Distributed Systems Lecture 2 1. External Data Representation and Marshalling (Sec. 4.3) Request reply protocol (failure modes) (Sec. 4.

Overview. Communication types and role of Middleware Remote Procedure Call (RPC) Message Oriented Communication Multicasting 2/36

Communication. Distributed Systems Santa Clara University 2016

IPC. Communication. Layered Protocols. Layered Protocols (1) Data Link Layer. Layered Protocols (2)

Computer Communication Networks Socket Programming

We will cover in this order: 2.1, 2.7, 2.5, 2.4, 2.2

Application Programming Interfaces

Last Class: RPCs. Today:

Systems software design NETWORK COMMUNICATIONS & RPC SYSTEMS

Object-Oriented Distributed Technology

A Report on RMI and RPC Submitted by Sudharshan Reddy B

Agenda. Before we start: Assignment #1. Routing in a wide area network. Protocols more concepts. Internetworking. Congestion control

Remote Procedure Calls

Communication. Layered Protocols. Topics to be covered. Layered Protocols. Introduction

Chapter 5: Distributed objects and remote invocation

Distributed Systems. 5. Remote Method Invocation

Chapter 4 Communication

Distributed Systems Principles and Paradigms. Distributed Object-Based Systems. Remote distributed objects. Remote distributed objects

RPC. Remote Procedure Calls. Robert Grimm New York University

Chapter 15: Distributed Communication. Sockets Remote Procedure Calls (RPCs) Remote Method Invocation (RMI) CORBA Object Registration

03 Remote invoaction. Request-reply RPC. Coulouris 5 Birrel_Nelson_84.pdf RMI

Networks and Operating Systems Chapter 3: Remote Procedure Call (RPC)

Advanced Topics in Distributed Systems. Dr. Ayman A. Abdel-Hamid. Computer Science Department Virginia Tech

JAVA RMI. Remote Method Invocation

Interprocess Communication

DISTRIBUTED OBJECTS AND REMOTE INVOCATION

Distributed Systems Theory 4. Remote Procedure Call. October 17, 2008

DS 2009: middleware. David Evans

Contents. Java RMI. Java RMI. Java RMI system elements. Example application processes/machines Client machine Process/Application A

5 Distributed Objects: The Java Approach

Chapter 5: Remote Invocation. Copyright 2015 Prof. Amr El-Kadi

Network Programming. Introduction to Sockets. Dr. Thaier Hayajneh. Process Layer. Network Layer. Berkeley API

Socket Programming. CSIS0234A Computer and Communication Networks. Socket Programming in C

Tonight. Communication. Middleware Protocols. Remote Procedure Call (RPC) Several common communication mechanisms RPC RMI Sockets Next week: HTTP,

ECE 650 Systems Programming & Engineering. Spring 2018

Verteilte Systeme (Distributed Systems)

RPC Paradigm. Lenuta Alboaie Andrei Panu

Remote Invocation Vladimir Vlassov and Johan Montelius

SAI/ST course Distributed Systems

Distributed Objects. Object-Oriented Application Development

Distributed Information Systems

Chapter 3: Client-Server Paradigm and Middleware

Distributed Systems 8. Remote Procedure Calls

JAVA SOCKET PROGRAMMING

RPC flow. 4.3 Remote procedure calls IDL. RPC components. Procedure. Program. sum (j,k) int j,k; {return j+k;} i = sum (3,7); Local procedure call

CS555: Distributed Systems [Fall 2017] Dept. Of Computer Science, Colorado State University

Remote Invocation. Today. Next time. l Indirect communication. l Request-reply, RPC, RMI

Applications and Layered Architectures. Chapter 2 Communication Networks Leon-Garcia, Widjaja

CSE 358 Spring 2006 Selected Notes Set 8

Transport Layer (TCP/UDP)

Desarrollo de Aplicaciones en Red. El modelo de comunicación. General concepts. Models of communication. Message Passing

Elementary TCP Sockets

Chapter 5 Remote Invocation. Gandeva Bayu Satrya, ST., MT. Telematics Labz. Informatics Department Telkom

Introduction and Overview Socket Programming Lower-level stuff Higher-level interfaces Security. Network Programming. Samuli Sorvakko/Trusteq Oy

EECS 482 Introduction to Operating Systems

416 Distributed Systems. RPC Day 2 Jan 11, 2017

Presentation Services. Presentation Services: Motivation

Collaboration of Tasks

Chapter 4 Communication

CORBA (Common Object Request Broker Architecture)

DISTRIBUTED COMPUTER SYSTEMS

CS555: Distributed Systems [Fall 2017] Dept. Of Computer Science, Colorado State University

Remote Invocation. To do. Request-reply, RPC, RMI. q Today q. q Next time: Indirect communication

Slides for Chapter 5: Remote Invocation

Lecture 15: Network File Systems

Distributed Software Systems

Introduction to Socket Programming

CAS 703 Software Design

Today CSCI Communication. Communication in Distributed Systems. Communication in Distributed Systems. Remote Procedure Calls (RPC)

15-498: Distributed Systems Project #1: Design and Implementation of a RMI Facility for Java

Remote Procedure Calls (RPC)

Today CSCI Remote Method Invocation (RMI) Distributed Objects

416 Distributed Systems. RPC Day 2 Jan 12, 2018

Remote Procedure Call

Operating Systems. 18. Remote Procedure Calls. Paul Krzyzanowski. Rutgers University. Spring /20/ Paul Krzyzanowski

Distributed Information Processing

MODELS OF DISTRIBUTED SYSTEMS

Chapter 4 Interprocess Communication. Copyright 2015 Prof. Amr El-Kadi

NETWORK PROGRAMMING. Instructor: Junaid Tariq, Lecturer, Department of Computer Science

Distributed Systems. Chapter 02

Transcription:

COMMUNICATION PROTOCOLS: REMOTE PROCEDURE CALL (RPC) 1

2 CONVENTIONAL PROCEDURE CALL (a) (b) Parameter passing in a local procedure call: the stack before the call to read. The stack while the called procedure is active.

3 CLIENT AND SERVER STUBS Principle of RPC between a client and server program.

4 REMOTE PROCEDURE CALLS (1) A remote procedure call occurs in the following steps: 1. The client procedure calls the client stub in the normal way. 2. The client stub builds a message (marshalling the parameters) and calls the local operating system. 3. The client s OS sends the message across the network to the remote OS. 4. The remote OS gives the message to the server stub. 5. The server stub unpacks the parameters 6. Calls the server implementing the function. Continued

5 RPC WITH VALUE PARAMETERS The steps involved in a doing a remote computation through RPC.

6 REMOTE PROCEDURE CALLS (2) A remote procedure call occurs in the following steps (continued): 1. The server does the work and returns the result to the stub. 2. The server stub packs it in a message and calls its local OS. 3. The server s OS sends the message across the network to the client s OS. 4. The client s OS gives the message to the client stub. 5. The stub unpacks the result and returns to the client.

7 PASSING REFERENCE PARAMETERS A pointer is only meaningful in the address space of the process where it is used. One solution is to forbid pointers and reference parameters in RPC More typically, marshalling involves changing the mechanism to copy/restore Actual parameter is sent as a copy If the formal parameter is changed, the changed version is sent back to use as a replacement for the actual Optimizations include taking advantage of the direction of the changes (input only, output only) Straightforward for some parameter types (arrays for example) but not in general.

8 PARAMETER SPECIFICATION AND STUB GENERATION (a) (b) A procedure. The corresponding message. array represented as a pointer is copied in the invocation

COMMUNICATION PROTOCOLS: REMOTE METHOD INVOCATION (RMI) 9

10 RMI RMI = RPC + Object-orientation Java RMI CORBA Middleware that is language-independent Microsoft DCOM/COM+ SOAP RMI on top of HTTP

11 REMOTE AND LOCAL METHOD INVOCATIONS A remote invocation B local C invocation local E invocation local invocation D remote invocation F

12 DISTRIBUTED OBJECTS 2-16 Common organization of a remote object with client-side proxy (loaded when the client binds to a remote object).

13 DISTRIBUTED OBJECTS Remote object references An identifier that can be used throughout a distributed system to refer to a particular remote object Remote interfaces JAVA RMI: Java interface that extends Remote interface Actions: remote invocations Remote Exceptions may arise for reasons such as partial failure or message loss Distributed Garbage Collection: cooperation between local garbage collectors needed

14 RMI PROGRAMMING RMI software Generated by IDL compiler Proxy (client side) Behaves like remote object to clients (invoker) Marshals arguments, forwards message to remote object, unmarshals results, returns results to client Skeleton (server side) Server side stub; Unmarshals arguments, invokes method, marshals results and sends to sending proxy s method Dispatcher (server side) Receives the request message from communication module, passes on the message to the appropriate method in the skeleton

15 RMI PROGRAMMING Binder Client programs need a means of obtaining a remote object reference Binder is a service that maintains a mapping from textual names to remote object references Servers need to register the services they are exporting with the binder Java RMIregistry Server threads Several choices: thread per object, thread per invocation Remote method invocations must allow for concurrent execution

16 JAVA RMI Features Integrated with Java language + libraries Security, write once run anywhere, multithreaded Object orientation Can pass behavior Mobile code Not possible in CORBA, traditional RPC systems Distributed Garbage Collection Remoteness of objects intentionally not transparent

COMMUNICATION PROTOCOLS: SOCKET API 17

18 THE PROGRAMMER'S CONCEPTUAL VIEW OF A TCP/IP INTERNET Application TCP Application UDP IP

19 SOCKET PROGRAMMING Socket API introduced in BSD4.1 UNIX explicitly created, used, released by apps client/server paradigm two types of transport service via socket API: Goal: learn how to build client/server application that communicate using sockets unreliable datagram (UDP) reliable, byte stream-oriented (TCP) socket a host-local, applicationcreated/owned, OS-controlled interface (a door ) into which application process can both send and receive messages to/from another (remote or local) application process

20 SOCKETS AND PORTS socket any port agreed port socket client Internet address = 138.37.94.248 message other ports server Internet address = 138.37.88.249

21 SOCKET PROGRAMMING WITH TCP Client must contact server server process must first be running server must have created socket (door) that welcomes client s contact Client contacts server by: creating client-local TCP socket When client creates socket: client TCP establishes connection to server TCP When contacted by client, server TCP creates new socket for server process to communicate with client allows server to talk with multiple clients specifying IP address, port number of server process application viewpoint TCP provides reliable, in-order transfer of bytes ( pipe ) between client and server

22 CLIENT/SERVER SOCKET INTERACTION: TCP Server (running on hostid) sockfd = socket(af_inet, SOCK_STREAM, 0); bind(sockfd, (struct sockaddr *) &serv_addr,sizeof(serv_addr)) Client sockfd = socket(af_inet, SOCK_STREAM, 0); listen(sockfd,5); newsockfd = accept(sockfd, (struct sockaddr *) &cli_addr, &clilen); n = read(newsockfd, ); TCP Connection setup connect(sockfd,&serv_addr,sizeof(serv_addr)) n = write(sockfd,buffer,strlen(buffer)); n = write(newsockfd, ); close(newsockfd); n = read(sockfd,buffer,255); close(sockfd);

23 BERKELEY SOCKETS API (1) Socket primitives for TCP/IP. Primitive Socket Bind Listen Accept Connect Send Receive Close Meaning Create a new communication endpoint Attach a local address to a socket Announce willingness to accept connections Block caller until a connection request arrives Actively attempt to establish a connection Send some data over the connection Receive some data over the connection Release the connection

24 BERKELEY SOCKETS (2) Connection-oriented communication pattern using sockets.