RPC is a call to a procedure/function located on another machine

Size: px
Start display at page:

Download "RPC is a call to a procedure/function located on another machine"

Transcription

1 Middleware Technologies (RPC/RMI) By CHITRAKANT BANCHHOR IT, SCOE, Pune

2 Outline Remote Procedure Call ( Sun RPC) Theoretical Introductions Practical programming using Sun RPC Remote Method Invocation ( Java RMI) RMI Introduction Programming using Java RMI Required practical RPC programs ( CLP II )

3 References W. Richard Stevens, UNIX Network Programming, Vol 2, PHI Douglas E. Comer, Internetworking With TCP/IP, Vol 3, PHI Andrew S. Tanenbaum Tanenbaum,, Distributed Systems, 2nd Edition, PHI

4 Remote Procedure Call

5 Remote Procedure Call RPC is a call to a procedure/function located on another machine

6 Machine A Machine B Client_proc int client_proc (int num1, int num2 ) { Server_proc as a Daemon int server_proc() { result = add ( num1, num2 ); result==add add (( num1, num1, num2 result num2); ); return } int add (int a, int b) { c = a + b; } return ( c ) }

7 RPC programming: First step awareness about technology

8 RPC implementations 1. Sun RPC (ONC RPC) 2. DCE RPC 3. ISO RPC

9 Sun RPC rpcgen : rpcgen is a compiler. Remote Program Interface definition rpcgen Various program files ( written in C )

10 Client Application P_clnt.c Client Interface C Compiler Client C Compiler Server P.h P.x rpcgen P_xdr.c P_svc.c Remote Procedure User applications Server Interface

11 RPC language Provides function and data declaration facilities. File.x Interface Definition Program Written in RPC language rpcgen

12 The RPC Language Data types

13 typedefs typedefs have the same syntax as C typedefs typedefs:: "typedef" declaration

14 Constants "const" const-ident "=" integer const PI = 3.14; Converted into C language as #define PI 3.14

15 Fixed array in RPC typedef int a[10]; program IARRAY_PROGRAM { version IARRAY_VERSION { int IARRAYADD(a)=1; }=1; }= ;

16 Variable--Length Array Declarations Variable type-ident variable-ident "<" value "> type-ident variable-ident "<" ">" 1. int array1<12>; /* at most 12 items */ 2. int array2<>; /* any number of items */

17 Strings strings are declared using the string keyword and compiled into char *s in the output header file. string name< >; Converted into : char* name;

18 voids The variable is not named as void. void declarations can only occur in following places: 1. union definitions 2. program definitions as the argument 3. Return type of the result of a remote procedure. program DUMMY_PROGRAM { void PROCEDURE_ADD( void ); };

19 Structures struct Point { int x; int y; };

20 Enumerations same syntax as C enumerations enum colortype { RED = 0, GREEN = 1, BLUE = 2 };

21 Booleans ( bool_t ) The boolean type called bool_t is either TRUE or FALSE. Things declared as type bool are compiled into bool_t in the output header file. bool AreYouMarried; becomes bool_t AreYouMarried AreYouMarried;;

22 Example IDL file P.x program MYFIRSTRPCPROGRAM { version MYFIRSTPROGRAMVERSION { void procedure(void)=1; }=1; }= 32 bit hex number ;

23 Client Application P_clnt.c Client Interface C Compiler Client C Compiler Server P.h P.x rpcgen P_xdr.c P_svc.c Remote Procedure Server Interface

24 test program Specification file : test.x Client program : test_client.c Server program : test_server.c

25 Note: test_client.c A client template for an interface. Contains: Declaration of function parameters. Return values for each of the functions.

26 The template code written by rpcgen rpcgen.. test_client.c Return value of a Function Function parameter

27

28 test_server.c:: test_server.c The server function: in test_server.c file It does nothing. It contains only comments:

29 test_server.c

30 Start server program

31 Step - I

32 Remote Procedure Call: Second step Theoretical Background

33 CHITRAKANT BANCHHOR RPC: Introduction

34 What Is RPC? RPC is a technique for constructing distributed, clientclient-server based applications. RPC Technology Distributed Client/Server applications Extending LPC: the calling procedure and called procedure need not exist in the same address space.

35 RPC on a single host Client and server processes are in separate address spaces. Machine A client process Procedure Call server process return A process call a procedure in another process on the same host.

36 RPC between hosts RPC in general allows a client on one host to call a server procedure on another host. Machine B Machine A client process server process Procedure Call return interconnected network

37 How RPC works? An RPC is analogous to a function call. 1 Remote Procedure Process Calling (arguments ) RPC Call 2 Waiting Response 3 When an RPC is made, the calling arguments are passed to the remote procedure and the caller waits for a response to be returned from the remote procedure.

38 Machine A Machine B Client_proc int client_proc (int num1, int num2 ) { Server_proc as a Daemon int server_proc() { result = add ( num1, num2 ); result==add add (( num1, num1, num2 result num2); ); return } int add (int a, int b) { c = a + b; } return ( c ) }

39 The RPC Model Similar to that of the local model, which works as follows: Caller process 1. sends a call message to the server process and blocks for a reply message. 2. When the caller receives the reply message, it gets the results of the procedure. 3. The caller process then continues executing. Server process 1. a process is dormant -- awaiting the arrival of a call message. 2. The server process computes a reply against call from the client. 3. Sends reply back to the requesting client. 4. After this, the server process becomes dormant again.

40 Machine A Client_proc Machine B Server_proc as a Daemon RPC Call Invoke service Call Service service executes Return answer Request completed Program continue Return Reply

41 RPC Architecture

42 The client application calls a local stub procedure instead of the actual code implementing the procedure. Client Server Application Application Client Stub Server Stub Client Run Time Library Server Run Time Library Stubs are compiled and linked with the client application

43 Stub procedures Proc_A caller procedure Call add(num1, Num2) Call add(num1, Num2) called procedure int add( int x, int y) { return result; }

44 Proc_A Call add(num1, Num2) Call add(num1, Num2) int add( int x, int y) { return result; } Computer 1 Computer 2 PROC-A Server Stub Client Stub Replaces the called procedure PROC-A Replaces the caller procedure

45 Client Stub The client stub code contains (instead of actual procedure code) Client_Proc val = add(x,y) 1 Retrieves required parameters from the client address space. Client Stub 3 2 Translate the parameters in XDR format Calls function in runtime to send request and parameters to server Client Run Time Library

46 Server Stub Server stub performs Server_Proc 2. Converts parameters from the XDR format to server s format Server stub 1. Network Buffer The server stub retrieves parameters from the network buffer.

47 RPC calling sequence Client Application Server Application Calls actual procedure Calls Client Stub Server Stub Calls functions in the run time library Client run time Server run time accept the request and call the server stub procedure

48 RPC return sequence Client Application Server Application Remote procedure returns data calling procedure continues Client Stub Server Stub client stub converts the data to local format Client run time receives the remote procedure return values Converts results into XDR format and hands over to run time library Server run time Transmits data on the network for client computer

49 Step - II

50 Remote Procedure Call: Third step Sun RPC

51 Sun RPC (ONC RPC)

52 Distributed Program Design Communication Oriented Design RPC

53 Distributed Program Design Communication Oriented Design RPC Typical socket approach: Design protocol first. Build programs based upon the protocol.

54 Distributed Program Design Communication Oriented Design RPC RPC Build application ( write stand alone application) Divide programs up and add communication protocols.

55 RPC issues RPC server can have many procedures Proc_1 Proc_2 Proc_3 Proc_4 Identify and access the remote procedure Basic issues Parameters required to call a procedure Return value from the procedure

56 Sun RPC Organization Remote Program Shared Global Data Procedure 1 Procedure 2 Procedure 3

57 Procedure Arguments Single argument: argument: Sun RPC includes support for a single argument to a remote procedure. Typically the single argument is a structure that contains a number of values. struct Num { int a, b; }; Call proc_add( struct Num); proc_add (int a, int b) { }

58 Procedure Identification Each procedure is identified by: Hostname (IP Address) Program identifier Procedure identifier Program Version identifier for testing and migration. Procedure Program Host version

59 Assigning Program Numbers Program numbers are assigned in groups of 0x according to the following chart: 0x0-0x1fffffff Defined by Sun 0x x3fffffff Defined by user 0x x5fffffff Transient 0x x7fffffff Reserved 0x x9fffffff Reserved 0xa xbfffffff Reserved 0xc xdfffffff Reserved 0xe xffffffff Reserved

60 External Data Representation (XDR) XDR is a machinemachine-independent description and encoding of data that can communicate between diverse machines Intel Machine SPARC Machine Serialization: Converting from a particular machine representation to XDR format is called serializing; the reverse process is deserializing deserializing..

61 Finding a Remote Procedure How does a client find the right server over the network? Ordinary client-server code: the user must supply a host name and a port number. RPC: the user only supplies a host name

62 Portmapper (rpcbind rpcbind)) Each system (RPC servers) runs a port mapper server. Portmapper provides a central registry for RPC services. Servers tell the port mapper what services they offer.

63 Steps in RPC Communication

64 Each server registers itself with the portmapper when it first starts. Client Server 1. Register program number, version number, procedure number Portmapper

65 portmapper holds a database of RPC services Server Client Portmapper Holds information about all RPC services on this machine

66 The client asks to the portmapper for the port of the server. Server Client Portmapper

67 Steps in RPC Communication 4. send data Client Server 1. Register details 3. Send server details, including port Portmapper (rpcbind)

68 Introduction to ONC RPC programming

69 Steps to handle Step 1. Create the IDL Step 2. Generate sample client and server code Step 3. First test of the client and server Step 4. Getting the server to do some work Step 5. Making the client functional

70 Step 1. Create the IDL (Defining the interface) 1. Declarations for constants used in the client or server. 2. Declarations of the data types used ( especially in arguments to remote procedures). 3. Declarations of remote programs, the procedures contain in each program, and the types of their parameters.

71 File with.x extension program program_name { version program_version { procedure_name_1()= procedure_number ; procedure_name_2()= procedure_number ; procedure_name_n()= procedure_number ; } = version_number ; } = 32-bits Hex number ;

72 Example: demo1.x Program DEMO_PROG { version DEMO_VERSION { type1 PROC1 PROC1(operands1) (operands1) = 1; type2 PROC2 PROC2(operands2) (operands2) = 2; } = 1; } = ; Keywords Color Code: Generated Symbolic Constants Used to generate stub and procedure names

73 Program Numbers Each remote program executing on a computer must be assigned a unique 32 bit integer that the caller uses to identify it. Program DEMO_PROG { version DEMO_VERSION { type1 type 1 PROC PROC1 1(operands (operands1 1) = type2 type 2 PROC PROC2 2(operands (operands2 2) = } = 1; } = ; ; 0x x3fffffff 1; 2;

74 Procedure Numbers Program DEMO_PROG { version DEMO_VERSION { type1 PROC1 PROC1(operands1) (operands1) = type2 PROC2 PROC2(operands2) (operands2) = 1; 2; } = 1; } = ; SUN RPC assigns an integer identifier to each remote procedure inside a given remote program. The procedures are numbered sequentially: 1,2,3 N.

75 Procedure Names Program DEMO_PROG { version DEMO_VERSION { type1 type 1 PROC1 PROC 1 (operands1 (operands 1) = 1; type2 type 2 PROC2 PROC 2 (operands2 (operands 2) = 2; } = 1; } = ; ;

76 Version numbers Program DEMO_PROG { version DEMO_VERSION { type1 PROC1 PROC1(operands1) (operands1) = type2 PROC2 PROC2(operands2) (operands2) = } = 1; } = ; 1; 2;

77 Example specification file : test.x program TEST_PROGRAM { version TEST_VERSION { void TEST_PROC(void)=1; }=1; } = ;

78 Step 2. Generate sample client and server code

79 $ rpcgen -a -C test.x test.x rpcgen test.h Makefile.test Header file test_client.c test_server.c client_program Server program test_clnt.c Client_stub test_svc.c Server skeleton

80 test.h program TEST_PROGRAM { version TEST_VERSION { void TEST_PROC(void)=1; }=1; } = ;

81 Step 3. First test of the client and server

82 Edit makefile Edit the makefile and find the line that defines CFLAGS: 1 CFLAGS += -g and change it to: CFLAGS += -g -DRPC_SVC_FG We will make sure that the server is compiled so that the symbol RPC_SVC_FG is defined. This will cause our server to run in the foreground.

83 2 Change RPCGENFLAGS = to RPCGENFLAGS = -C rpcgen generates code that conforms to ANSI C, add a C parameter to the rpcgen command

84 Makefile.test

85 The template code written by rpcgen rpcgen.. test_client.c Return value of a Function Function parameter

86

87 test_client.c:: test_client.c A client template for an interface created by rpcgen rpcgen.. Contains: Declaration of function parameters. Return values for each of the functions.

88 test_server.c The server function: in test_server.c file It does nothing. It contains only comments:

89 test_server.c

90 Step 4. Getting the server to do some work Replace comments with a single print statement: printf( connection checked \ n");

91 test_server.c

92 Step 5. Run programs Build using make

93

94

95 Step - III

96 Remote Procedure Call: Fourth Step Write meaningful RPC programs

97 add.c This program prints out the addition of two numbers provided by the user on the command line. $./add $ first get the stand-alone application working.

98 Data and functions in the program iinfo struct InputInfo { int num1; int num2; }; oinfo struct OutputInfo { int result; }; void displayresult(struct OutputInfo oinfo); struct OutputInfo performaddition(struct InputInfo iinfo);

99 Flow of Functions one machine, (in one program) main() iinfo (numbers numbers)) Call performaddition() oinfo (result) displayresult()

100 add.c #include<stdio.h> struct InputInfo { int num1; int num2; }; struct OutputInfo { int result; }; void displayresult(struct OutputInfo oinfo); struct OutputInfo performaddition(struct InputInfo iinfo);

101 int main(int argc, char* argv[]) { int n1, n2; struct InputInfo iinfo; struct OutputInfo oinfo; struct InputInfo { int num1; int num2; }; if(argc!= 3){ printf("usage:./add num1 num2\n"); exit(-1); } n1 = atoi(argv[1]); n2 = atoi(argv[2]); iinfo.num1 = n1; iinfo.num2 = n2; oinfo = performaddition(iinfo); displayresult(oinfo); return 0; }

102 struct OutputInfo { int result; }; struct InputInfo { int num1; int num2; }; struct OutputInfo performaddition performaddition(( struct InputInfo iinfo ) { struct OutputInfo oinfo oinfo;; int sum; sum = iinfo.num1 + iinfo.num2; oinfo.result = sum; return oinfo oinfo;; }

103 void displayresult( displayresult( struct OutputInfo oinfo ) { printf( printf ( sum of two numbers=%d\ numbers=%d\n ", oinfo.result ); }

104 Note about add.c Complex data structures: structures: standalone program to networked RPC conversion becomes easier. Coding strategy: Write the standalone application first (perform addition) addition); then convert into the network code (RPC)

105 add.c program ( rpc based) Convert standalone add.c into a network application using RPC. performaddition performaddition() () will be the remote procedure.

106 Flow of Functions Client main() iinfo (numbers numbers)) Call performaddition() Server oinfo (result) displayresult()

107 RPC Communication client Call main() displayresult() server Server Stub Return Client Stub XDR Filters XDR filters Network Interface Network Interface iinfo (numbers numbers)) performaddition() Network oinfo (result)

108 $ rpcgen -C add.x add.h header file for C datatypes involved in network commn add_xdr.c XDR filters add_clnt.c client stub add_svc.c server skeleton We do not have to look at these.c files

109 $ rpcgen -a -C add.x add.x rpcgen add.h Makefile.add Header file add_client.c add_server.c client_program Server program add_clnt.c Client_stub add_svc.c Server skeleton

110 Note These files must not already exist The programmer must provide the functionalities in terms of codes.

111 Relationships among Files client Call main() displayresult() server Server Stub Return Client Stub XDR Filters XDR filters Network Interface Network Interface iinfo (numbers numbers)) performaddition() Network oinfo (result)

112 Relationships among Files client server add_client.c add.h add_clnt.c add.h add_svc.c add_xdr.c add_xdr.c add_server.c add_xdr.c Network Interface Network Interface iinfo (numbers numbers)) Network oinfo (result)

113 add.x

114 Notes Standard RPC The remote procedure can only take one input, and return one output. Program Program,, version version,, and function names must be in uppercase uppercase..

115 add.h C datatypes Used by Generated from datatypes of.x file. add_client.c add_server.c

116 InputNumbers Output result Program number Version number

117 add_client.c Obtain a connection to the server add_client.c contain code for call to performaddition_ performaddition_1 1() contacts the server by calling clnt_create() clnt_create () server

118 clnt_create() contact the portmapper on the specified host to get the server details failure : returns NULL Success: returns a client handle

119 client handle (used in other RPC library functions) clnt = clnt_create( host, host name of ( server program, portmapper) prog, Server program version, Server program version protocol protocol ( udp / tcp ) );

120 add_client.c $./add 1 5 6

121 6 2 Provide appropriate no of arguments Assign numbers 3 Call server function 5 Call display function 4

122 add_clnt.c add_clnt.c is the client stub for network communication with the server It calls the XDR filters for argument passing It sends/receives network data to/from the server Sets a timeout for trying to contact the server all this is done by calling clnt_call clnt_call() ()

123

124 add_svc.c add_svc.c registers server s details with the portmapper

125 add_svc.c handles incoming messages Converts XDR format data to C formats calls performaddition_1_svc() this is the serverserver-side version of performaddition performaddition() () sends results back to the client converts C data to XDR data formats

126 register

127 Call performaddition_1 performaddition_1_svc()

128 add_server.c This file contains performaddition_ performaddition_1 1_svc() _svc().. The application code needs to be added.

129 stores details used for client authentication Functionalities provided by user

130 Notes result must be static so that its memory is not deleted when the function returns. result is retained so that the toptop-level server can convert it to network form

131 add_xdr.c

132 Step - IV

133 Remote Procedure Call: Fifth Step More Example Programs

134 Example 1: array in RPC

135 Variable array in RPC typedef int a<>; program IARRAY_PROGRAM { version IARRAY_VERSION { int IARRAYADD(a)= IARRAYADD(a)=1 1; }=1 }= 1; }= }= ;;

136 vadd.h

137 vadd_client.c 3 Provide appropriate number of arguments and declare variables 4

138 5 Display result./add

139 vadd_server.c

140 string_lower_upper

141 stroperations.x

142 stroperations_client.c

143

144 stroperations_server.c

145

146 arith_operations

147 arith.x

148 arith_client.c

149

150

151 arith_server.c

152

153

154

155 reverese_number

156 revnumber.x

157 revnumber_client.c

158

159 revnumber_server.c

160 Idempotent Vs NonNon-Idempotent Procedures

161 Idempotent procedure: means the procedure can be called any number of times without harm. add_1(num1, Num2) Return_time() Returns correct result whether call it once or twice This procedure may return different information each time, still OK (correct output)

162 Nonidempotent procedure example: Called only once otherwise end result will be wrong Subtract Money Account - A Account - B

163 Step - V

164 Thank You!

165 Java RMI Remote Method Invocation CHITRAKANT BANCHHOR IT, SCOE, Pune

166 References 1. Cay S. Horstmann Horstmann,, Core Java, Vol. 2: Advanced Features, 8th Edition, 2. Troy Bryan Downing, Java RMI: Remote Method Invocation, 3. Andrew S. Tanenbaum Tanenbaum,, Distributed Systems, 2nd Edition, PHI 4. Compiled from various web sites

167 Remote Method Invocation Java RMI allowed to execute remote function using the same semantics as local functions calls.

168 Example Assume code running in the local machine holds a remote reference to an object object_1 on a remote machine response = object_1.method(); object_1 Local Machine method ( ) {.. return (response); } Remote Machine

169 Java RMI: main Components 1. Remote objects These are normal Java objects Extends some RMI inbuilt class that provides support for remote invocation. 2. Remote reference These are object references Refer to remote objects, typically on a different computer 3. Remote interfaces Normal Java Interfaces that specify API of a remote interface They should extend java.rmi.remote interface The remote interface must known to local and remote code

170 Distributed Objects Simple idea objects existing on one machine (server) may be accessed from another machine through regular method call.

171 The following figure commonly referred as a distributed object. Client Machine Server Machine Object Server Client Same interface as object State Method Proxy Skeleton invokes same method at object Skeleton Interface Server OS Client OS Client invokes a method Marshalled invocation is passed across network

172 The General RMI Architecture Server Machine RMI Server 3. Call Stub Skeleton RMI Client Client Machine 4. Return Registry 2. lookup 1. bind

173 3. Serializing the parameters to skeleton Stub RMI Client 2. lookup 2. RMI Server 4. Return Skeleton 3. Call 1. bind Registry serializing the result back to the stub The client lookup the server name in the registry to establish remote references. The server must first bind its name to the registry

174 The Stub and Skeleton Return skeleton RMI Client stub Call RMI Client Stub Client s call is first forwarded to stub. The stub is responsible for sending the call over to the serverserver-side skeleton Skeleton A skeleton contains a method that receives the remote calls Unmarshals the parameters, and invokes the actual remote object implementation Returns result back to the client side stub

175 The Remote Interface java.rmi.remote Extends Remote Interface Is normal Java interface, All methods in a remote interface must be declared to throw the java.rmi.remoteexception exception.

176 import java.rmi.*; public interface SumServerIntf extends Remote { int sum(int m, int n) throws RemoteException; } Figure : Remote interface

177 java.rmi.remote java.rmi.remote marker interface It declares no methods or fields But extending it by another interface tells the RMI system to treat the interface concerned as a remote interface.

178 java.rmi.remoteexception RMI makes remote invocations look syntactically like local invocation. In practice, though, it cannot defend from problems unique to distributed computing unexpected failure of the network or remote machine.

179 Remote Objects A remote object is an instance of a class that implements a remote interface. Remote Interface Class implementing Remote Interface Instantiate Remote Object

180 This class also extends the library class java.rmi.server.unicastremoteobject UnicastRemoteObject Extends Remote Interface Class Instantiate Remote Object

181 A Remote Object Implementation Class SumServerImpl.java import java.rmi.*; import java.rmi.server.*; public class SumServerImpl extends UnicastRemoteObject implements SumServerIntf { public SumServerImpl() throws RemoteException { } public int sum(int m, int n) throws RemoteException { return m + n; } }

182 Remarks The constructor SumServerImpl SumServerImpl() () has an empty body. But recall that if there is no explicit constructor invocation in the body of a subclass constructor, it implicitly invokes super() Hence the vital constructor of UnicastRemoteObject is called.

183 Steps for Developing an RMI System 1. Define the remote interface 2. Develop the remote object by implementing the remote interface. interface. 3. Develop the client program. program. 4. Compile the Java source files. files. 5. Generate the client stubs and server skeletons. skeletons. 6. Start the RMI registry. registry. 7. Start the remote server objects. objects. 8. Run the client

184 1. Define the remote interface SumServerIntf.java import java.rmi.*; public interface SumServerIntf extends Remote { int sum(int m, int n) throws RemoteException; }

185 Step 2: Develop the remote object and its interface The server is a simple unicast remote server. Create server by extending java.rmi.server.unicastremoteobject SumServerImpl.java import java.rmi.*; import java.rmi.server.*; public class SumServerImpl extends UnicastRemoteObject implements SumServerIntf { public SumServerImpl() throws RemoteException { } public int sum(int m, int n) throws RemoteException { return m + n; } }

186 A Server Program The server must bind its name to the registry. Use java.rmi.naming class to bind the server name to registry. In this example the name call SUM SUM--SERVER SERVER.. SumServer.java import java.net.*; import java.rmi.*; public class SumServer { public static void main(string args[]) { try { SumServerImpl sumserverimpl = new SumServerImpl(); Naming.rebind( SUM-SERVER", sumserverimpl); } catch(exception e) { System.out.println("Exception: " + e); } } }

187 Step 3: Develop the client program Client first look up the name of server in the registry. Use the java.rmi.naming class to lookup the server name. The server name is specified as URL in the from: ( rmi://host:port/name ) Default RMI port is Naming.lookup( rmi://localhost: Naming.lookup ( rmi://localhost: /SUM /SUM--SERVER )

188 SumClient.java import java.rmi.*; public class SumClient { public static void main(string args[]) { try { String sumserverurl = "rmi://" + args[0] + "/SUM-SERVER"; SumServerIntf sumserverintf = (SumServerIntf)Naming.lookup(sumServerURL); System.out.println("The first number is: " + args[1]); int m = Integer.valueOf(args[1]); System.out.println("The second number is: " + args[2]); int n = Integer.valueOf(args[2]); System.out.println("The sum is: " + sumserverintf.sum(m, n)); } catch(exception e) { System.out.println("Exception: " + e); } } }

189 Step 4 : Compile the Java source files javac SumServerIntf.java javac SumServerImpl.java javac SumServer.java javac SumClient.java

190 Step 5 : Generate stub and skeleton rmic SumServerImpl

191 Step 6: Start the RMI registry RMI Registry on the Server Machine start rmiregistry

192 Start a registry a nonnon-default port number: start rmiregistry 4956 & The Naming calls become, e.g.: Naming.rebind( rmi://localhost: Naming.rebind ( rmi://localhost: /SUM /SUM--SERVER, sumserver sumserver)) ; Naming.lookup( Naming.lookup ( rmi rmi:// :// localhost:4956 localhost:4956/sum /SUM--SERVER ) ;

193 Steps 7 & 8: Start the remote server objects & Run the client Start the Server Start the Client start java SumServer java SumClient

194 assignment RMI and JDBC Example

195 SelectServerIntf.java

196 SelectServerImpl.java

197

198 SelectServer.java

199 SelectClient.java

200 Hashmap:: example for the assignment Hashmap

201 Mapping with Hashtable and HashMap You need a oneone-way mapping from one data item to another. HashMap and Hashtable provide a oneone-way mapping from one set of object references to another. They are completely general purpose.

202

203 Creating a HashMap Container

204 HahaMap Constructors HashMap () Constructs empty HashMap with a default initial capacity 11 and load factor HashMap (int initialcapacity initialcapacity)) Constructs empty HashMap with the specified initial capacity and default load factor HashMap (int initialcapacity, float loadfactor) Constructs empty HashMap with the specified initial capacity and the specified load factor. HashMap (Map t) Constructs a new HashMap with the mappings same as the passed Map.

205 HashMap Basic methods Object get (Object key) Returns the value mapped to the specified key, or null if no entry is found. Object put (Object key, Object value) Maps the specified key to the specified value in this HashMap and returns the value previously associated with the specified key, if any. Otherwise, it returns the null value. Object remove (Object key) Removes the key and its associated value from the HashMap, and returns the value previously associated with the specified key, if any. Otherwise, it returns the null value. boolean containskey(object key) Returns true if the specified key is mapped to some value in the map, otherwise false.

206 boolean containsvalue(object value) Returns true if there are one or more keys mapped to the specified value, otherwise false. int size() Returns the size of the HashMap. boolean isempty() returns true if HashMap is empty, otherwise false.

207 Java HashMap Other operations void putall(map t) Copies all mappings from the map to current HashMap and replaces existing entries, if any. Void clear() Removes all mappings from HashMap. Collection values() Returns collection of the values contained in the HashMap.

208 Set entryset() Returns a Set of entries contained in the HashMap. Set keyset() Returns a Set of keys contained in the HashMap. Object clone() Creates copy of the HashMap.

209 Java HashMap Example 1 import java.util.hashmap; public class HashMapExample{ public static void main(string[] args) { HashMap map = new HashMap(); map.put( 1, "A"); map.put( 2, "B"); map.put( 3, "C"); String one = (String) map.get( 1 ); System.out.println(one); } }

210

211

212 Thank You!

JAVA RMI. Remote Method Invocation

JAVA RMI. Remote Method Invocation 1 JAVA RMI Remote Method Invocation 2 Overview Java RMI is a mechanism that allows one to invoke a method on an object that exists in another address space. The other address space could be: On the same

More information

Lecture 12 RPC RPC RPC. Writing an RPC Program. Sun RPC RPC. February 9+11, 2005

Lecture 12 RPC RPC RPC. Writing an RPC Program. Sun RPC RPC. February 9+11, 2005 RPC Lecture 12 RPC February 9+11, 2005 Remote Procedure Call Follows application-oriented approach (emphasizes problem over communication) Design program and then divide it. RPC RPC There exists a way

More information

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

03 Remote invocation. Request-reply RPC. Coulouris 5 Birrel_Nelson_84.pdf RMI 03 Remote invocation Request-reply RPC Coulouris 5 Birrel_Nelson_84.pdf RMI 2/16 Remote Procedure Call Implementation client process Request server process client program client stub procedure Communication

More information

Remote Procedure Call

Remote Procedure Call Remote Procedure Call Outline Concept of RPC SunRPC Spring 2009 CSE30264 1 RPC Timeline Server Request Blocked Blocked Reply Computing Blocked Spring 2009 CSE30264 2 RPC There exists a way for processes

More information

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

Contents. Java RMI. Java RMI. Java RMI system elements. Example application processes/machines Client machine Process/Application A Contents Java RMI G53ACC Chris Greenhalgh Java RMI overview A Java RMI example Overview Walk-through Implementation notes Argument passing File requirements RPC issues and RMI Other problems with RMI 1

More information

The UNIVERSITY of EDINBURGH. SCHOOL of INFORMATICS. CS4/MSc. Distributed Systems. Björn Franke. Room 2414

The UNIVERSITY of EDINBURGH. SCHOOL of INFORMATICS. CS4/MSc. Distributed Systems. Björn Franke. Room 2414 The UNIVERSITY of EDINBURGH SCHOOL of INFORMATICS CS4/MSc Distributed Systems Björn Franke bfranke@inf.ed.ac.uk Room 2414 (Lecture 3: Remote Invocation and Distributed Objects, 28th September 2006) 1 Programming

More information

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

Outline. EEC-681/781 Distributed Computing Systems. The OSI Network Architecture. Inter-Process Communications (IPC) Lecture 4 EEC-681/781 Distributed Computing Systems Lecture 4 Department of Electrical and Computer Engineering Cleveland State University wenbing@ieee.org Outline Inter-process communications Computer networks

More information

Remote Procedure Calls (RPC)

Remote Procedure Calls (RPC) Distributed Computing Remote Procedure Calls (RPC) Dr. Yingwu Zhu Problems with Sockets Sockets interface is straightforward [connect] read/write [disconnect] BUT it forces read/write mechanism We usually

More information

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

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 4.3 Remote procedure calls RPC flow Client process Server process Program i = sum (3,7); Procedure sum (j,k) int j,k; {return j+k; Client stub Program Return Call Unpack Pack result para s Invisible to

More information

CSci Introduction to Distributed Systems. Communication: RPC In Practice

CSci Introduction to Distributed Systems. Communication: RPC In Practice CSci 5105 Introduction to Distributed Systems Communication: RPC In Practice Linux RPC Language-neutral RPC Can use Fortran, C, C++ IDL compiler rpgen N to generate all stubs, skeletons (server stub) Example:

More information

Verteilte Systeme (Distributed Systems)

Verteilte Systeme (Distributed Systems) Verteilte Systeme (Distributed Systems) Karl M. Göschka Karl.Goeschka@tuwien.ac.at http://www.infosys.tuwien.ac.at/teaching/courses/ VerteilteSysteme/ Lecture 3: Communication (Part 2) Remote Procedure

More information

Distributed Objects and Remote Invocation. Programming Models for Distributed Applications

Distributed Objects and Remote Invocation. Programming Models for Distributed Applications Distributed Objects and Remote Invocation Programming Models for Distributed Applications Extending Conventional Techniques The remote procedure call model is an extension of the conventional procedure

More information

Remote Method Invocation in Java

Remote Method Invocation in Java Remote Method Invocation in Java Ajay Khatri Senior Assistant Professor,Department IT Acropolis Institute of Technology & Research ajay.acropolis@gmail.com What is RMI RMI is an API that provides a mechanism

More information

RPC and RMI. 2501ICT Nathan

RPC and RMI. 2501ICT Nathan RPC and RMI 2501ICT Nathan Contents Client/Server revisited RPC Architecture XDR RMI Principles and Operation Case Studies Copyright 2002- René Hexel. 2 Client/Server Revisited Server Accepts commands

More information

Last Class: RPCs. Today:

Last Class: RPCs. Today: Last Class: RPCs RPCs make distributed computations look like local computations Issues: Parameter passing Binding Failure handling Lecture 4, page 1 Today: Case Study: Sun RPC Lightweight RPCs Remote

More information

Object Interaction. Object Interaction. Introduction. Object Interaction vs. RPCs (2)

Object Interaction. Object Interaction. Introduction. Object Interaction vs. RPCs (2) Introduction Objective To support interoperability and portability of distributed OO applications by provision of enabling technology Object interaction vs RPC Java Remote Method Invocation (RMI) RMI Registry

More information

Remote Procedure Call Implementations

Remote Procedure Call Implementations Remote Procedure Call Implementations Sun ONC(Open Network Computing) RPC. Implements at-most-once semantics by default. At-least-once (idempotent) can also be chosen as an option for some procedures.

More information

Distributed Systems. 5. Remote Method Invocation

Distributed Systems. 5. Remote Method Invocation Distributed Systems 5. Remote Method Invocation Werner Nutt 1 Remote Method Invocation 5.1 Communication between Distributed Objects 1. Communication between Distributed Objects 2. RMI 2 Middleware Middleware

More information

Distributed Systems. 02r. Java RMI Programming Tutorial. Paul Krzyzanowski TA: Long Zhao Rutgers University Fall 2017

Distributed Systems. 02r. Java RMI Programming Tutorial. Paul Krzyzanowski TA: Long Zhao Rutgers University Fall 2017 Distributed Systems 02r. Java RMI Programming Tutorial Paul Krzyzanowski TA: Long Zhao Rutgers University Fall 2017 1 Java RMI RMI = Remote Method Invocation Allows a method to be invoked that resides

More information

Remote Procedure Call

Remote Procedure Call Remote Procedure Call Suited for Client-Server structure. Combines aspects of monitors and synchronous message passing: Module (remote object) exports operations, invoked with call. call blocks (delays

More information

RMI (Remote Method Invocation) Over the year, there have been 3 different approaches to application development:

RMI (Remote Method Invocation) Over the year, there have been 3 different approaches to application development: RMI (Remote Method Invocation) History: Over the year, there have been 3 different approaches to application development: 1. the traditional approach. 2. the client / server approach and 3. the component-

More information

Remote Objects and RMI

Remote Objects and RMI Outline Remote Objects and RMI Instructor: Dr. Tongping Liu Distributed/Remote Objects Remote object reference (ROR) Remote Method Invocation (RMI) Case study and example: Java RMI Other issues for objects

More information

Grid Computing. Java Remote Method Invocation (RMI) RMI Application. Grid Computing Fall 2006 Paul A. Farrell 9/5/2006

Grid Computing. Java Remote Method Invocation (RMI) RMI Application. Grid Computing Fall 2006 Paul A. Farrell 9/5/2006 Grid Computing Paradigms for Distributed Computing 2 RMI Fall 2006 Traditional paradigms for distributed computing The Grid: Core Technologies Maozhen Li, Mark Baker John Wiley & Sons; 2005, ISBN 0-470-09417-6

More information

Communication Basics, RPC & RMI. CS403/534 Distributed Systems Erkay Savas Sabanci University

Communication Basics, RPC & RMI. CS403/534 Distributed Systems Erkay Savas Sabanci University Communication Basics, RPC & RMI CS403/534 Distributed Systems Erkay Savas Sabanci University 1 Communication Models 1. Remote Procedure Call (RPC) Client/Server application 2. Remote Method Invocation

More information

Chapter 5 Distributed Objects and Remote Invocation

Chapter 5 Distributed Objects and Remote Invocation CSD511 Distributed Systems 分散式系統 Chapter 5 Distributed Objects and Remote Invocation 吳俊興 國立高雄大學資訊工程學系 Chapter 5 Distributed Objects and Remote Invocation 5.1 Introduction 5.2 Communication between distributed

More information

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

CS555: Distributed Systems [Fall 2017] Dept. Of Computer Science, Colorado State University CS 555: DISTRIBUTED SYSTEMS [RMI] Frequently asked questions from the previous class survey Shrideep Pallickara Computer Science Colorado State University L21.1 L21.2 Topics covered in this lecture RMI

More information

CS 5523 Operating Systems: Remote Objects and RMI

CS 5523 Operating Systems: Remote Objects and RMI CS 5523 Operating Systems: Remote Objects and RMI Instructor: Dr. Tongping Liu Thank Dr. Dakai Zhu and Dr. Palden Lama for providing their slides. Outline Distributed/Remote Objects Remote object reference

More information

Remote Method Invocation

Remote Method Invocation Remote Method Invocation A true distributed computing application interface for Java, written to provide easy access to objects existing on remote virtual machines Provide access to objects existing on

More information

Remote Method Invocation

Remote Method Invocation Non-101samples available here: https://github.com/101companies/101repo/tree/master/languages/aspectj/javarmisamples Remote Method Invocation Prof. Dr. Ralf Lämmel Universität Koblenz-Landau Software Languages

More information

Distributed Systems 8. Remote Procedure Calls

Distributed Systems 8. Remote Procedure Calls Distributed Systems 8. Remote Procedure Calls Paul Krzyzanowski pxk@cs.rutgers.edu 10/1/2012 1 Problems with the sockets API The sockets interface forces a read/write mechanism Programming is often easier

More information

CSC 634: Networks Programming

CSC 634: Networks Programming CSC 634: Networks Programming Lecture 07: More Client-Server Architectures, RPC, RMI Instructor: Haidar M. Harmanani Communication Protocols Protocols are agreements/rules on communication Protocols could

More information

5.4. Events and notifications

5.4. Events and notifications 5.4. Events and notifications Distributed event-based systems extend local event model Allowing multiple objects at diff. locations to be notified of events taking place at an object Two characteristics:

More information

RMI Case Study. A Typical RMI Application

RMI Case Study. A Typical RMI Application RMI Case Study This example taken directly from the Java RMI tutorial http://java.sun.com/docs/books/tutorial/rmi/ Editorial note: Please do yourself a favor and work through the tutorial yourself If you

More information

Distributed Program Design Typical Sockets Approach. Remote Procedure Call. Remote Subroutine

Distributed Program Design Typical Sockets Approach. Remote Procedure Call. Remote Subroutine Distributed Program Design Typical Sockets Approach Communication-Oriented Design Design protocol first. Build programs that adhere to the protocol. Application-Oriented Design Build application(s). Divide

More information

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

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

More information

Last Class: Network Overview. Today: Distributed Systems

Last Class: Network Overview. Today: Distributed Systems Last Class: Network Overview =>Processes in a distributed system all communicate via a message exchange. Physical reality: packets Abstraction: messages limited size arbitrary size unordered (sometimes)

More information

Distributed Systems COMP 212. Lecture 10 Othon Michail

Distributed Systems COMP 212. Lecture 10 Othon Michail Distributed Systems COMP 212 Lecture 10 Othon Michail RMI: Remote Method Invocation Allows an object running in one Java virtual machine to invoke methods on an object running in another Java virtual machine.

More information

Distributed Objects SPL/ SPL 201 / 0 1

Distributed Objects SPL/ SPL 201 / 0 1 Distributed Objects 1 distributed objects objects which reside on different machines/ network architectures, benefits, drawbacks implementation of a remote object system 2 Why go distributed? large systems

More information

Component-Based Software Engineering

Component-Based Software Engineering Component-Based Software Engineering Remote Method Invocation Paul Krause Introduction to RMI Lecture 11 - RMI Simple Example - DivideServer Demo of this example Review a more complex example - StudentEnrollment

More information

Desarrollo de Aplicaciones en Red RMI. Introduction. Considerations. Considerations. RMI architecture

Desarrollo de Aplicaciones en Red RMI. Introduction. Considerations. Considerations. RMI architecture session Desarrollo de Aplicaciones en Red José Rafael Rojano Cáceres http://www.uv.mx/rrojano RMI Remote Method Invocation Introduction Java RMI let s work calling remote methods. Underneath it works with

More information

presentation DAD Distributed Applications Development Cristian Toma

presentation DAD Distributed Applications Development Cristian Toma Lecture 8 S4 - Core Distributed Middleware Programming in JEE presentation DAD Distributed Applications Development Cristian Toma D.I.C.E/D.E.I.C Department of Economic Informatics & Cybernetics www.dice.ase.ro

More information

Process Concept: views of a process Process Scheduling CSCI 6730/ 4730 Operating Systems

Process Concept: views of a process Process Scheduling CSCI 6730/ 4730 Operating Systems Chapter 3: Processes: Outline Process Concept: views of a process Process Scheduling CSCI 6730/ 4730 Operating Systems Operations on Processes Cooperating Processes Inter Process Communication (IPC) RPC:

More information

Remote Invocation Vladimir Vlassov and Johan Montelius

Remote Invocation Vladimir Vlassov and Johan Montelius KTH ROYAL INSTITUTE OF TECHNOLOGY Middleware Remote Invocation Vladimir Vlassov and Johan Montelius Application layer Remote invocation / indirect communication Socket layer Network layer ID2201 DISTRIBUTED

More information

Lecture VI: Distributed Objects. Remote Method Invocation

Lecture VI: Distributed Objects. Remote Method Invocation Lecture VI: Distributed Objects. Remote Method Invocation CMPT 401 Summer 2007 Dr. Alexandra Fedorova Remote Method Invocation In an object-oriented language (usually Java) A way to call a method on an

More information

Chapter 4 Remote Procedure Calls and Distributed Transactions

Chapter 4 Remote Procedure Calls and Distributed Transactions Prof. Dr.-Ing. Stefan Deßloch AG Heterogene Informationssysteme Geb. 36, Raum 329 Tel. 0631/205 3275 dessloch@informatik.uni-kl.de Chapter 4 Remote Procedure Calls and Distributed Transactions Outline

More information

Communication and Distributed Processing

Communication and Distributed Processing Prof. Dr.-Ing. Stefan Deßloch AG Heterogene Informationssysteme Geb. 36, Raum 329 Tel. 0631/205 3275 dessloch@informatik.uni-kl.de Chapter 4 Remote Procedure Calls and Distributed Transactions Outline

More information

Distributed Systems. 6. Remote Method Invocation. Werner Nutt

Distributed Systems. 6. Remote Method Invocation. Werner Nutt Distributed Systems 6. Remote Method Invocation Werner Nutt 1 Remote Method Invocation 6.1 Communication between Distributed Objects 1. Communication between Distributed Objects 2. Java RMI 3. Dynamic

More information

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

Chapter 15: Distributed Communication. Sockets Remote Procedure Calls (RPCs) Remote Method Invocation (RMI) CORBA Object Registration Chapter 15: Distributed Communication Sockets Remote Procedure Calls (RPCs) Remote Method Invocation (RMI) CORBA Object Registration Sockets Defined as an endpoint for communcation Concatenation of IP

More information

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

Operating Systems. 18. Remote Procedure Calls. Paul Krzyzanowski. Rutgers University. Spring /20/ Paul Krzyzanowski Operating Systems 18. Remote Procedure Calls Paul Krzyzanowski Rutgers University Spring 2015 4/20/2015 2014-2015 Paul Krzyzanowski 1 Remote Procedure Calls 2 Problems with the sockets API The sockets

More information

IJESRT. http: //

IJESRT. http: // IJESRT [Monika,1(4): Jun., 2012] INTERNATIONAL JOURNAL OF ENGINEERING SCIENCES & RESEARCH TECHNOLOGY Innovative Techniquee of Message Passing In Loosely Coupled System Monika Arya* Department of Computer

More information

RMI: Design & Implementation

RMI: Design & Implementation RMI: Design & Implementation Operating Systems RMI 1 Middleware layers Applications, services RMI and RPC request-reply protocol marshalling and external data representation Middleware layers UDP and TCP

More information

CHAPTER - 4 REMOTE COMMUNICATION

CHAPTER - 4 REMOTE COMMUNICATION CHAPTER - 4 REMOTE COMMUNICATION Topics Introduction to Remote Communication Remote Procedural Call Basics RPC Implementation RPC Communication Other RPC Issues Case Study: Sun RPC Remote invocation Basics

More information

IBD Intergiciels et Bases de Données

IBD Intergiciels et Bases de Données IBD Intergiciels et Bases de Données RMI-based distributed systems Fabien Gaud, Fabien.Gaud@inrialpes.fr Overview of lectures and practical work Lectures Introduction to distributed systems and middleware

More information

RMI. Remote Method Invocation. 16-Dec-16

RMI. Remote Method Invocation. 16-Dec-16 RMI Remote Method Invocation 16-Dec-16 The network is the computer Consider the following program organization: method SomeClass call AnotherClass returned object computer 1 computer 2 If the network is

More information

Distributed Information Systems

Distributed Information Systems Distributed Objects and Remote Invocation Programming Models For Distributed Applications Objectives RPC and RMI. Remote invocation semantics. Implementation of RMI. References DSCD: Chapter 5 Conventional

More information

COMP 6231: Distributed System Design

COMP 6231: Distributed System Design COMP 6231: Distributed System Design Remote Invocation and RMI Based on Chapters 5, 7 of the text book and the slides from Prof. M.L. Liu, California Polytechnic State University COMP 6231, Fall 2013 Remote

More information

Written by: Dave Matuszek

Written by: Dave Matuszek RMI Remote Method Invocation Written by: Dave Matuszek appeared originally at: http://www.cis.upenn.edu/~matuszek/cit597-2003/ 28-May-07 The network is the computer * Consider the following program organization:

More information

DISTRIBUTED OBJECTS AND REMOTE INVOCATION

DISTRIBUTED OBJECTS AND REMOTE INVOCATION DISTRIBUTED OBJECTS AND REMOTE INVOCATION Introduction This chapter is concerned with programming models for distributed applications... Familiar programming models have been extended to apply to distributed

More information

Programming with RMI Reminder

Programming with RMI Reminder Programming with RMI Reminder (Sources: Gordon S Blair, Paul Grace) Aims After completing the following you should get a reminder of: 1. the fundamental concepts of Java Remote Method Invocation; 2. the

More information

Chapter 3: Processes: Outline. Operating Systems. Remote Procedure Calls (RPC) Client-Server Remote Machine Communication Mechanisms

Chapter 3: Processes: Outline. Operating Systems. Remote Procedure Calls (RPC) Client-Server Remote Machine Communication Mechanisms Chapter 3: Processes: Outline Operating Systems RPC: Processes Process Concept: views of a process Process Scheduling Operations on Processes Cooperating Processes Inter Process Communication (IPC) Local

More information

Lecture 5: Object Interaction: RMI and RPC

Lecture 5: Object Interaction: RMI and RPC 06-06798 Distributed Systems Lecture 5: Object Interaction: RMI and RPC Distributed Systems 1 Recap Message passing: send, receive synchronous versus asynchronous No global Time types of failure socket

More information

Chapter 4: Processes. Process Concept. Process State

Chapter 4: Processes. Process Concept. Process State Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication in Client-Server Systems 4.1 Process Concept An operating

More information

Outline. Chapter 4 Remote Procedure Calls and Distributed Transactions. Remote Procedure Call. Distributed Transaction Processing.

Outline. Chapter 4 Remote Procedure Calls and Distributed Transactions. Remote Procedure Call. Distributed Transaction Processing. Prof. Dr.-Ing. Stefan Deßloch AG Heterogene Informationssysteme Geb. 36, Raum 329 Tel. 0631/205 3275 dessloch@informatik.uni-kl.de Chapter 4 Remote Procedure Calls and Distributed Transactions Outline

More information

Course Snapshot. The Next Few Classes. Parallel versus Distributed Systems. Distributed Systems. We have covered all the fundamental OS components:

Course Snapshot. The Next Few Classes. Parallel versus Distributed Systems. Distributed Systems. We have covered all the fundamental OS components: Course Snapshot The Next Few Classes We have covered all the fundamental OS components: Architecture and OS interactions Processes and threads Synchronization and deadlock Process scheduling Memory management

More information

Distributed Systems. How do regular procedure calls work in programming languages? Problems with sockets RPC. Regular procedure calls

Distributed Systems. How do regular procedure calls work in programming languages? Problems with sockets RPC. Regular procedure calls Problems with sockets Distributed Systems Sockets interface is straightforward [connect] read/write [disconnect] Remote Procedure Calls BUT it forces read/write mechanism We usually use a procedure call

More information

Remote Procedure Calls, TLI, STREAMS

Remote Procedure Calls, TLI, STREAMS Remote Procedure Calls, TLI, STREAMS 13 RPC, TLI, STREAMS Hannes Lubich, 2003 2005 Page 1 Goals of this Lecture Understand the design of remote procedure calls in general and the design and programming

More information

Applications. RMI, RPC and events. Request reply protocol External data representation. Operating System

Applications. RMI, RPC and events. Request reply protocol External data representation. Operating System Figure 5.1 Middleware layer Applications RMI, RPC and events Request reply protocol External data representation Middleware layers Operating System Instructor s Guide for Coulouris, Dollimore and Kindberg

More information

Introduction & RMI Basics. CS3524 Distributed Systems Lecture 01

Introduction & RMI Basics. CS3524 Distributed Systems Lecture 01 Introduction & RMI Basics CS3524 Distributed Systems Lecture 01 Distributed Information Systems Distributed System: A collection of autonomous computers linked by a network, with software to produce an

More information

Course Snapshot. The Next Few Classes

Course Snapshot. The Next Few Classes Course Snapshot We have covered all the fundamental OS components: Architecture and OS interactions Processes and threads Synchronization and deadlock Process scheduling Memory management File systems

More information

Distributed Programming with RMI. Overview CORBA DCOM. Prepared By: Shiba R. Tamrakar

Distributed Programming with RMI. Overview CORBA DCOM. Prepared By: Shiba R. Tamrakar Distributed Programming with RMI Overview Distributed object computing extends an object-oriented programming system by allowing objects to be distributed across a heterogeneous network, so that each of

More information

Communication and Distributed Processing

Communication and Distributed Processing Prof. Dr.-Ing. Stefan Deßloch AG Heterogene Informationssysteme Geb. 36, Raum 329 Tel. 0631/205 3275 dessloch@informatik.uni-kl.de Chapter 4 Remote Procedure Calls and Distributed Transactions Outline

More information

Distributed Software Systems

Distributed Software Systems RMI Programming Distributed Software Systems RMI Programming RMI software Generated by IDL compiler Proxy Behaves like remote object to clients (invoker) Marshals arguments, forwards message to remote

More information

Chapter 3: Client-Server Paradigm and Middleware

Chapter 3: Client-Server Paradigm and Middleware 1 Chapter 3: Client-Server Paradigm and Middleware In order to overcome the heterogeneity of hardware and software in distributed systems, we need a software layer on top of them, so that heterogeneity

More information

Modulo II Socket, RMI e Corba

Modulo II Socket, RMI e Corba Modulo II Socket, RMI e Corba Prof. Ismael H F Santos April 05 Prof. Ismael H. F. Santos - ismael@tecgraf.puc-rio.br 1 Ementa Sistemas Distribuídos Cliente-Servidor April 05 Prof. Ismael H. F. Santos -

More information

Generic architecture

Generic architecture Java-RMI Lab Outline Let first builds a simple home-made framework This is useful to understand the main issues We see later how java-rmi works and how it solves the same issues Generic architecture object

More information

RMI. (Remote Method Invocation)

RMI. (Remote Method Invocation) RMI (Remote Method Invocation) Topics What is RMI? Why RMI? Architectural components Serialization & Marshaled Objects Dynamic class loading Code movement Codebase ClassLoader delegation RMI Security Writing

More information

Communication. Distributed Systems Santa Clara University 2016

Communication. Distributed Systems Santa Clara University 2016 Communication Distributed Systems Santa Clara University 2016 Protocol Stack Each layer has its own protocol Can make changes at one layer without changing layers above or below Use well defined interfaces

More information

Questions and Answers. A. RMI allows us to invoke a method of java object that executes on another machine.

Questions and Answers. A. RMI allows us to invoke a method of java object that executes on another machine. Q.1) What is Remote method invocation (RMI)? A. RMI allows us to invoke a method of java object that executes on another machine. B. RMI allows us to invoke a method of java object that executes on another

More information

C 1. Recap: Finger Table. CSE 486/586 Distributed Systems Remote Procedure Call. Chord: Node Joins and Leaves. Recall? Socket API

C 1. Recap: Finger Table. CSE 486/586 Distributed Systems Remote Procedure Call. Chord: Node Joins and Leaves. Recall? Socket API Recap: Finger Table Finding a using fingers CSE 486/586 Distributed Systems Remote Procedure Call Steve Ko Computer Sciences and Engineering University at Buffalo N102" 86 + 2 4! N86" 20 +

More information

CSE 660 Lab 2 Khoi Pham Thanh Ho April 27 th, 2015

CSE 660 Lab 2 Khoi Pham Thanh Ho April 27 th, 2015 CSE 660 Lab 2 Khoi Pham Thanh Ho April 27 th, 2015 Comment and Evaluation: This lab focuses on two ways to call a function from Client to Server: Remote Procedure Call (RPC) is basic method in C for Server

More information

JAC444 - Lecture 11. Remote Method Invocation Segment 2 - Develop RMI Application. Jordan Anastasiade Java Programming Language Course

JAC444 - Lecture 11. Remote Method Invocation Segment 2 - Develop RMI Application. Jordan Anastasiade Java Programming Language Course JAC444 - Lecture 11 Remote Method Invocation Segment 2 - Develop RMI Application 1 Remote Method Invocation In this lesson you will be learning about: Designing RMI application Developing distributed object

More information

CC755: Distributed and Parallel Systems

CC755: Distributed and Parallel Systems CC755: Distributed and Parallel Systems Dr. Manal Helal, Spring 2016 moodle.manalhelal.com Lecture 7: Remote Method Invocation (RMI) 1 RMI Y Daniel Liang, Introduction to JAVA Programming, 9th Edition,

More information

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

Chapter 5: Remote Invocation. Copyright 2015 Prof. Amr El-Kadi Chapter 5: Remote Invocation Outline Introduction Request-Reply Protocol Remote Procedure Call Remote Method Invocation This chapter (and Chapter 6) Applications Remote invocation, indirect communication

More information

Network. Dr. Jens Bennedsen, Aarhus University, School of Engineering Aarhus, Denmark

Network. Dr. Jens Bennedsen, Aarhus University, School of Engineering Aarhus, Denmark Network Dr. Jens Bennedsen, Aarhus University, School of Engineering Aarhus, Denmark jbb@ase.au.dk Outline Socket programming If we have the time: Remote method invocation (RMI) 2 Socket Programming Sockets

More information

The basic theory of operation of RPC is pretty straightforward. But, to understand remote procedure calls, let s first make sure that we understand local procedure calls. The client (or caller) supplies

More information

Distributed Computing

Distributed Computing Distributed Computing Computing on many systems to solve one problem Why? - Combination of cheap processors often more cost-effective than one expensive fast system - Flexibility to add according to needs

More information

RMI Example RMI. CmpE 473 Internet Programming RMI

RMI Example RMI. CmpE 473 Internet Programming RMI CmpE 473 Internet Programming Pınar Yolum pinar.yolum@boun.edu.tr Department of Computer Engineering Boğaziçi University RMI Examples from Advanced Java: Internet Applications, Art Gittleman Remote Method

More information

Distributed Systems. Distributed Object Systems 2 Java RMI. Java RMI. Example. Applet continued. Applet. slides2.pdf Sep 9,

Distributed Systems. Distributed Object Systems 2 Java RMI. Java RMI. Example. Applet continued. Applet. slides2.pdf Sep 9, Distributed Object Systems 2 Java RMI Piet van Oostrum Distributed Systems What should a distributed system provide? Illusion of one system while running on multiple systems Transparancy Issues Communication,

More information

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

Desarrollo de Aplicaciones en Red. El modelo de comunicación. General concepts. Models of communication. Message Passing Desarrollo de Aplicaciones en Red El modelo de comunicación José Rafael Rojano Cáceres http://www.uv.mx/rrojano 1 2 General concepts As we saw in a Distributed System the logical and physical component

More information

Remote Method Invocation

Remote Method Invocation Remote Method Invocation RMI Dr. Syed Imtiyaz Hassan Assistant Professor, Deptt. of CSE, Jamia Hamdard (Deemed to be University), New Delhi, India. s.imtiyaz@jamiahamdard.ac.in 1 Agenda Introduction Creating

More information

Last Class: RPCs. Today:

Last Class: RPCs. Today: Last Class: RPCs RPCs make distributed computations look like local computations Issues: Parameter passing Binding Failure handling Lecture 8, page 1 Today: Lightweight RPCs Remote Method Invocation (RMI)

More information

Inter-process Communication: RPC

Inter-process Communication: RPC Inter-process Communication: RPC Dr. Yong Guan Department of Electrical and Computer Engineering & Information Assurance Center Iowa State University Outline for Today s Talk Inter-process Communication:

More information

Distributed Systems. 03. Remote Procedure Calls. Paul Krzyzanowski. Rutgers University. Fall 2017

Distributed Systems. 03. Remote Procedure Calls. Paul Krzyzanowski. Rutgers University. Fall 2017 Distributed Systems 03. Remote Procedure Calls Paul Krzyzanowski Rutgers University Fall 2017 1 Socket-based communication Socket API: all we get from the OS to access the network Socket = distinct end-to-end

More information

RPC Programming. Some knowledge of C & Unix A network with at least two connected machines.

RPC Programming. Some knowledge of C & Unix A network with at least two connected machines. RPC Programming 1.0 Prerequisites Some knowledge of C & Unix A network with at least two connected machines. 2.0 Objectives: 1. To understand the basic principles of RPC 2. To develop a program which returns

More information

6 Remote Procedure Call (RPC)

6 Remote Procedure Call (RPC) 6 Remote Procedure Call (RPC) RFC 1831 (Sun) invoke procedure on remote host in analogy to local procedure call programming interface: (local) procedure call remote procedure call active client calls server

More information

5 Distributed Objects: The Java Approach

5 Distributed Objects: The Java Approach 5 Distributed Objects: The Java Approach Main Points Why distributed objects Distributed Object design points Java RMI Dynamic Code Loading 5.1 What s an Object? An Object is an autonomous entity having

More information

CS 417 9/18/17. Paul Krzyzanowski 1. Socket-based communication. Distributed Systems 03. Remote Procedure Calls. Sample SMTP Interaction

CS 417 9/18/17. Paul Krzyzanowski 1. Socket-based communication. Distributed Systems 03. Remote Procedure Calls. Sample SMTP Interaction Socket-based communication Distributed Systems 03. Remote Procedure Calls Socket API: all we get from the to access the network Socket = distinct end-to-end communication channels Read/write model Line-oriented,

More information

UNIT 4 CORBA 4/2/2013 Middleware 59

UNIT 4 CORBA 4/2/2013 Middleware 59 UNIT 4 CORBA 4/2/2013 Middleware 59 CORBA AN OBJECT ORIENTED RPC MECHANISM HELPS TO DEVELOP DISTRIBUTED SYTEMS IN DIFF. PLATFORMS OBJECTS WRITTEN IN DIFF., LANG, CAN BE CALLED BY OBJECTS WRITTEN IN ANOTHER

More information

Chapter 4: Processes

Chapter 4: Processes Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication in Client-Server Systems 4.1 Process Concept An operating

More information

DISTRIBUTED COMPUTING

DISTRIBUTED COMPUTING DISTRIBUTED COMPUTING SYSTEMS 1 REMOTE PROCEDURE CALL RPC-REMOTE PROCEDURE CALL RMI-REMOTE METHOD INVOCATION 2 3 RPC TECHNOLOGY Remote procedure call is a technology that allows computer programs to call

More information