Lecture 4: RPC Remote Procedure Call CDK: Chapter 5

Slides:



Advertisements
Similar presentations
1 Communication in Distributed Systems REKs adaptation of Tanenbaums Distributed Systems Chapter 2.
Advertisements

Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Remote Procedure CallCS-4513, D-Term Remote Procedure Call CS-4513 Distributed Computing Systems (Slides include materials from Operating System.
Distributed Systems Lecture #3: Remote Communication.
Copyright © George Coulouris, Jean Dollimore, Tim Kindberg This material is made available for private study and for direct.
Tutorials 2 A programmer can use two approaches when designing a distributed application. Describe what are they? Communication-Oriented Design Begin with.
CORBA Case Study By Jeffrey Oliver March March 17, 2003CORBA Case Study by J. T. Oliver2 History The CORBA (Common Object Request Broker Architecture)
CS490T Advanced Tablet Platform Applications Network Programming Evolution.
OCT 1 Master of Information System Management Organizational Communications and Distributed Object Technologies Lecture 5: Distributed Objects.
Outcomes What is RPC? The difference between conventional procedure call and RPC? Understand the function of client and server stubs How many steps could.
Communication in Distributed Systems –Part 2
.NET Mobile Application Development Remote Procedure Call.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Introduction to Distributed Systems Slides for CSCI 3171 Lectures E. W
Communication Tran, Van Hoai Department of Systems & Networking Faculty of Computer Science & Engineering HCMC University of Technology.
11 September 2008CIS 340 # 1 Topics To examine the variety of approaches to handle the middle- interaction (continued) 1.RPC-based systems 2.TP monitors.
Introduction to Distributed Systems Slides for CSCI 3171 Lectures E. W. Grundke.
1 Lecture 5 (part2) : “Interprocess communication” n reasons for process cooperation n types of message passing n direct and indirect message passing n.
Distributed Objects and Middleware. Sockets and Ports Source: G. Coulouris et al., Distributed Systems: Concepts and Design.
Chapter 5: Distributed objects and remote invocation Introduction Remote procedure call Events and notifications.
Distributed Objects & Remote Invocation
1 Conventional Procedure Call read(fd,buf,nbytes) a)Parameter passing in a local procedure call: the stack before the call to read b)The stack while the.
Remote Procedure Call RPC
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
COMP 655: Distributed/Operating Systems Summer 2011 Dr. Chunbo Chu Week 2, 3: Communication 1/30/20161Distributed Systems - COMP 655.
DISTRIBUTED OBJECTS AND REMOTE INVOCATION 1. 2 Topics  Middleware  Remote Method Invocation  Remote Procedure Call.
Slides for Chapter 5: Distributed objects and remote invocation From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition.
Distributed objects and remote invocation Pages
Distributed Systems Lecture 8 RPC and marshalling 1.
Distributed Computing & Embedded Systems Chapter 4: Remote Method Invocation Dr. Umair Ali Khan.
Lecture 5: RPC (exercises/questions). 26-Jun-16COMP28112 Lecture 52 First Six Steps of RPC TvS: Figure 4-7.
Topic 4: Distributed Objects Dr. Ayman Srour Faculty of Applied Engineering and Urban Planning University of Palestine.
Distributed Web Systems Distributed Objects and Remote Method Invocation Lecturer Department University.
Object Interaction: RMI and RPC 1. Overview 2 Distributed applications programming - distributed objects model - RMI, invocation semantics - RPC Products.
Object Interaction: RMI and RPC 1. Overview 2 Distributed applications programming - distributed objects model - RMI, invocation semantics - RPC Products.
Introduction to Distributed Systems Slides for CSCI 3171 Lectures E. W. Grundke.
Java Distributed Computing
Communication between distributed objects Remote procedure call
Prof. Leonardo Mostarda University of Camerino
CSE 486/586 Distributed Systems Remote Procedure Call
Remote Method Invocation
Edition 5, © Addison-Wesley 2012
Distributed Systems Course Topics in distributed objects
Programming Models for Distributed Application
Remote Procedure Call present by :Enas Alkhoshi
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
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
Slides for Chapter 5: Distributed objects and remote invocation
Remote Procedure Call (RPC) RPC – RMI - Web Services.
CSE 451: Operating Systems Winter 2004 Module 19 Remote Procedure Call (RPC) Ed Lazowska Allen Center
Remote method invocation (RMI)
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
Distribution Infrastructures
Remote Procedure Call Hank Levy 1.
CS-502, Operating Systems Fall 2009 (EMC)
Lecture 6: RPC (exercises/questions)
Remote invocation (call)
Remote Procedure Call Hank Levy 1.
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
Remote Procedure Call Hank Levy 1.
Last Class: Communication in Distributed Systems
CSE 451: Operating Systems Messaging and Remote Procedure Call (RPC)
Presentation transcript:

Lecture 4: RPC Remote Procedure Call CDK: Chapter 5 (but see Chapter 4 for “marshalling”) TVS: Section 4.2 (see 10.3.4 for RMI)

Basics Distributed systems can be built using messages with send and receive But these are rather low-level constructs Remote Procedure Call (1984 – Birrell & Nelson) provides a higher-level alternative It provides access transparency, i.e. the use of a local service (e.g. provided by the OS) has the same form as use of a non-local one. 1-Jan-19 COMP28112 Lecture 4

Basics (continued) So a process on the client “calls” a process on the server to execute the code of the procedure (providing some service) Arguments are sent in the message to the server The result is sent in the reply from the server to the client 1-Jan-19 COMP28112 Lecture 4

RPC between Client and Server (synchronous) TVS Fig 4-6 (and 4-10a) 1-Jan-19 COMP28112 Lecture 4

RPC between Client and Server (asynchronous) TVS Fig 4-11 1-Jan-19 COMP28112 Lecture 4

CDK Figure 5.1 Middleware layers Applications Middleware layers Request reply protocol External data representation Operating System RMI, RPC and events 1-Jan-19 COMP28112 Lecture 4

Details: arguments Client and server in different computers => cannot use addresses! Value parameters are OK Caller and callee need to agree on the format of messages! 1-Jan-19 COMP28112 Lecture 4

Stubs Instead of the code to provide the service, the client machine has a stub procedure. That: puts the arguments in a message sends that message to the server waits for the reply message unpacks the result returns to the application call 1-Jan-19 COMP28112 Lecture 4

Server stub (or skeleton) Transparency works both ways! Code in the server to provide the service should also be “normal” – so it can be used by other code on the server to provide the same service locally …. So the RPC message goes to a server stub – code on the server 1-Jan-19 COMP28112 Lecture 4

First Six Steps of RPC TVS: Figure 4-7 1-Jan-19 COMP28112 Lecture 4

Remaining Steps 7: add executes and returns answer to server stub 8: server stub composes reply message containing this answer 9: message is sent across the network 10: client OS passes reply to client stub 11: client stub unpacks and returns result 1-Jan-19 COMP28112 Lecture 4

Parameter Marshalling Packing parameters into a message is known as parameter marshalling The inverse operation is unmarshalling These operations need to take into account problems associated with having different machines and different languages in use in the network 1-Jan-19 COMP28112 Lecture 4

Representational issues Client and server can use different ways to represent values: Floating point formats Big-endian (Western style) vs little-endian (e.g., Intel) Character sets Size issues (e.g. 64 bit ints or 32 bit ints) 1-Jan-19 COMP28112 Lecture 4

Passing Value Parameters TVS Figure 4-8 Original message on the Pentium ([12]=1+2x256) The message after receipt on the SPARC ([12] = 1x256+2) The message after being inverted. The little numbers in boxes indicate the address of each byte 1-Jan-19 COMP28112 Lecture 4

Generating Stubs The code for the stubs can be generated once the specification of the procedure is known. This should ideally be done in a language independent way – so that the remote service is available to many languages Interface Definition Language (IDL) 1-Jan-19 COMP28112 Lecture 4

Producing a Client and a Server TVS Figure 4-12 1-Jan-19 COMP28112 Lecture 4

Uuidgen? The purpose of this is to generate a unique identifier which is Put in the header file Can be used to check that the client and server stubs are compatible, i.e. to protect against errors caused by updating one and not the other 1-Jan-19 COMP28112 Lecture 4

Features of an IDL There are a number of IDLs CORBA (Common Object Request Broker Architecture) Sun (noted for NFS) DCE (Distributed Computing Environment) Syntax of interface – but commonly with extra information (e.g. in, out, inout) about reference parameters // Example – CORBA IDL // In file Person.idl struct Person { string name; string place; long year; } ; interface PersonList { readonly attribute string listname; void addPerson(in Person p) ; void getPerson(in string name, out Person p); long number(); }; 1-Jan-19 COMP28112 Lecture 4

Remote Method Invocation (RMI) Java includes RMI in its API Marshalling is simpler: Java <=> Java It requires that objects sent as arguments or results be serializable, i.e. there is a standard external form for them. This allows arbitrarily complex structures (not possible with copy/restore parameters) 1-Jan-19 COMP28112 Lecture 4

Remote Object References A major difference between RMI and RPC is that there are, in RMI, references to remote objects! In the lab, RemoteServer is an interface used to declare stub which is such a thing The interface lists the methods which can be invoked on it What are Remote Object References? (CDK 4.3.4) They must be system-wide not reused for other objects 1-Jan-19 COMP28112 Lecture 4

RMI implementation As with RPC, the client has a stub (called here a proxy) for each remote class instance – to marshal arguments to, and unmarshal results from, method calls This communicates with the dispatcher for the class, which forwards to the skeleton which implements unmarshalling etc. 1-Jan-19 COMP28112 Lecture 4

Dispatcher / Skeleton Server has a dispatcher & a skeleton for each class of remote object The dispatcher receives the incoming message, and uses its method info to pass it to the right method in the skeleton. (Dispatcher and proxy both work from the remote interface to get same method info!) Skeleton implements methods of the remote interface to unmarshall arguments and invoke the corresponding method in the servant. It then marshalls the result (or any exceptions thrown) into a reply message to the proxy. 1-Jan-19 COMP28112 Lecture 4

rmiregistry This is how a server makes a remote object available to clients A string is bound to the remote object, and the clients interrogate the registry using the string The client must know the server machine name and the port the registry is on (there is a default) 1-Jan-19 COMP28112 Lecture 4

Conclusion When processes on different computers communicate: need to agree on the format of messages need to take into account differences of machines Client and Server stubs are implemented Interfaces can be specified by means of an IDL Reading: Coulouris: Chapter 5 (but see Chapter 4 for “marshalling”); Tanenbaum: Section 4.2 (see 10.3.4 for RMI) 1-Jan-19 COMP28112 Lecture 4