CSS434 Conveyed Items and Remote Summon Course book Ch5

2097 days ago, 736 views
PowerPoint PPT Presentation
CSS434 RMI. 2. Plot. RPC/RMI ModelImplementation IssuesParameter-passing semanticsInvocation semanticsStateless/stateful serverServer creation semanticsSunRPCJava RMI. CSS434 RMI. 3. Why RPC/RMI. Propelled type of communicationSockets and MPI: information transferRPC/RMI: control transferTransparency in capacity callsNo recognize neighborhood and remote calls (in theoretical)Also connected to IPC on t

Presentation Transcript

Slide 1

CSS434 Distributed Objects and Remote Invocation Textbook Ch5 Professor: Munehiro Fukuda CSS434 RMI

Slide 2

Outline RPC/RMI Model Implementation Issues Parameter-passing semantics Invocation semantics Stateless/stateful Server creation semantics SunRPC Java RMI CSS434 RMI

Slide 3

Why RPC/RMI Calling a capacity/strategy at a remote server: Advanced type of correspondence Sockets and MPI: information exchange RPC/RMI: control move Transparency in capacity calls No recognize nearby and remote calls (in hypothetical) Also connected to IPC on a similar machine Ease of utilization Compiled-time contention sort checking Automatic stub era CSS434 RMI

Slide 4

neighborhood C remote E neighborhood conjuring summon remote summon F B neighborhood A conjuring D Remote and Local Method/Function Invocation CSS434 RMI

Slide 5

remote question Data remote interface m4 { m1 usage m5 m2 m6 of strategies m3 Service Interface and Remote Interface RPC: an administration interface characterized with a XDR record struct duplicates { twofold a; twofold b; }; program EXAMPLE_PROG { form EXAMPLE_VERS { int FACT( int ) = 1;/* technique number = 1 */twofold POWER( pairs ) = 2;/* system number = 2 */} = 1;/* rendition number = 1 */} = 0x31234567;/* program number = 0x31234567 */RMI: a remote interface characterized by amplifying the " Remote " Interface MyRmoteInterface amplifies Remote { ReturnClass1 m1( ArgClass1 arg ) tosses RemoteException; ReturnClass2 m2( ArgClass2 arg ) tosses RemoteException; ReturnClass3 m3( ArgClass3 arg ) tosses RemoteException; } CSS434 RMI

Slide 6

RPC/RMI Model Caller (Client) Callee (Server) Request message including contentions RPC and hold up Request message acknowledged Execution environment made Execution of capacity body Send answer and sit tight for the following solicitation Suspended Reply message Including an arrival esteem Resume execution CSS434 RMI

Slide 7

Implementation Issues Transparency property Syntactic straightforwardness Semantic straightforwardness Analogy in semantics b/w nearby and remote methodology calls Caller able to do passing contentions (Automatic marshaling) Caller suspended till an arrival from a capacity Callee equipped for giving back an esteem to guest Difference in semantics b/w nearby and remote system calls No call by reference and no pointer-included contentions Error taking care of required for correspondence (Ex. RemoteException in Java) Performance much slower than neighborhood calls. CSS434 RMI

Slide 8

class objA { objB b; objC c; } class objB { } class objC { } Parameter-Passing Semantics Call by Value Most PRCs take this semantics. Voluminous information brings about duplicating overhead. Call by Reference Passing pointers and references are trivial. At that point, what about question based frameworks? The estimation of a variable is a reference to a protest Call by question reference Additional remote protest summons Call by visit: every single related question moved to a server each RPC. Call by move: every single related protest moved and left to a server upon the primary RPC. Server Client CSS434 RMI

Slide 9

Invocation Fault resistance measures semantics Retransmit ask for Duplicate Re-execute system message sifting or retransmit answer No Not relevant Not pertinent Maybe Yes No Re-execute technique At-slightest once Yes Retransmit answer At-most-once Invocation Semantics CSS434 RMI

Slide 10

Stateful/Stateless Servers Stateful servers: Servers monitor customer data. RPC/RMI answer relies on upon that customer data. Stars: Simplify customer outline Cons: A server crash loses customer data. A customer crash leaves old customer data at server. At-most-once conjuring semantics (Java RMI takes this outline.) Stateless servers: Clients must keep up Inter-call data. RPC/RMI answer is dependably the same. At any rate once summon semantics (Some RPC executions take this outline.) CSS434 RMI

Slide 11

Server Creation Semantics Instance-per-Call Servers another server procedure propelled each call Statelss servers just OS asset allotment/de-portion included each call Instance-per-Session Servers A server procedure kept up for the whole session with a customer Stateful servers: between call state kept up for a solitary customer OS asset assignment/de-distribution included each session Persistent Servers A server procedure stays in presence inconclusively. Stateful and shared servers: simultaneousness control required OS asset assignment/de-allotment included just once. SunRPC/Java RMI accept occurrence per-call servers, while a string yet not a procedure is made per a call. (The server procedure must stay dynamic to acknowledge another call and hence can even now be stateful.) CSS434 RMI

Slide 12

PRC id sort (call) args msg id customer id msg id answer status sort (answer) fesults failur RPC Mechanism Interface Definition Language File Client Program Server Program Define contentions Register remote capacities Return Call Return Call IDL Compiler Server Stub Client Stub (5) Exception? Message Decoding Encoding Message Decoding Encoding (4) Invalid contentions? marshaling (3) Invalid method? Retransmission affirmations Routing encryption RPC Runtime (Dispatcher) RPC Runtime (2) Unauthorized customer? Get Send Receive Send (1) Intelligible messages? CSS434 RMI

Slide 13

Client-Server Binding (SunRPC) Server Machine Client Machine (1) pmap_set(prognum, versnum, convention, port) (2) and (3) pmap_getport(addr, prognum, versnum, convention) To check the status of portmap, rpcinfo (2) Locating server Portmap Daemon port: 111 Client (3) Server port (xxx) port: xxx (1) enroll (4) RPC with port xxx Server compose(), read(), Sendto(), recvfrom() compose(), read(), Sendto(), recvfrom() Transport level or underneath TCP or UDP TCP or UDP Network (LAN/WAN) CSS434 RMI

Slide 14

SunRPC Modify without anyone else example_client example_client.o example_client.c Client program rpcgen – an example.x Your customer example_clnt.o example_clnt.c Client stub gcc – c - o example_h.c example.x Header ld - o Interface depictions example_xdr.c example_xdr.o Marshaling example_svc.o example_svc.c Server program Server stub example_server example_server.o example_server.c Modify independent from anyone else Your server CSS434 RMI

Slide 15

Sun RPC (Interface definition)/* example.x - Speicification of some number-crunching/string administration. * Define 2 strategies: * reality( int n ) returns n!. * control( twofold x, twofold y ) returns x^^y. * strconc( struct strings ) connects src to dest. */const BUFFER_SIZE = 1024; struct duplicates { double a; double b; }; struct strings { char src[BUFFER_SIZE]; char dst[BUFFER_SIZE]; }; program EXAMPLE_PROG { rendition EXAMPLE_VERS { int FACT( int ) = 1;/* methodology number = 1 */twofold POWER( copies ) = 2;/* technique number = 2 */ string STRCONC( strings ) = 3;/* system number = 3 */} = 1;/* adaptation number = 1 */} = 0x31234567;/* program number = 0x31234567 */CSS434 RMI

Slide 16

Sun RPC (Client) #include "example.h" void example_prog_1(char *host) { CLIENT *clnt; int *result_1; int fact_1_arg; double *result_2; doubles power_1_arg; char * *result_3; strings strconc_1_arg; clnt = clnt_create (have, EXAMPLE_PROG, EXAMPLE_VERS, "udp"); if (clnt == NULL) { clnt_pcreateerror (have); exit (1); } fact_1_arg = 10; result_1 = fact_1(&fact_1_arg, clnt); if (result_1 == (int *) NULL) { clnt_perror (clnt, "call failed"); } printf( "fact( 10 ) = %d\n", *result_1 ); power_1_arg.a = 2.0; power_1_arg.b = 6.0; result_2 = power_1(&power_1_arg, clnt); if (result_2 == (twofold *) NULL) { clnt_perror (clnt, "call failed"); } printf( "power( 2.0, 6.0 ) = %f\n", *result_2 ); strncpy( strconc_1_arg.dst, "xyz\0", BUFFER_SIZE ); strncpy( strconc_1_arg.src, "abc\0", BUFFER_SIZE ); result_3 = strconc_1(&strconc_1_arg, clnt); if (result_3 == (burn **) NULL) { clnt_perror (clnt, "call failed"); } printf( "strconc( \"xyz\", \"abc\" ) = %s\n", *result_3 ); clnt_destroy (clnt); } int principle (int argc, singe *argv[]) { char *host; if (argc < 2) { leave (1); host = argv[1]; example_prog_1 (have); leave (0); } CSS434 RMI

Slide 17

Sun RPC (Server) #include "example.h" #include <math.h> #include <string.h> int * fact_1_svc(int *argp, struct svc_req *rqstp) { static int result; int i; result = 1; for ( i = *argp; i > 0; i- - ) result *= i; return &result; } twofold * power_1_svc(doubles *argp, struct svc_req *rqstp) { static twofold result; result = pow( argp->a, argp->b ); return &result; } roast ** strconc_1_svc(strings *argp, struct svc_req *rqstp) { static scorch * result; result = strcat( argp->dst, argp->src ); return &result; } CSS434 RMI

Slide 18

SunRPC v.s. Java RMI CSS434 RMI

Slide 19

server customer remote skeleton question An intermediary for B protest B & dispatcher Request for B's class Reply Remote reference Communication Remote module reference module RMI Mechanism Find the relating remote question, unmarshal contentions, and conjure the question. Change over protest/strategy/contentions in a TCP message. Trade a demand and a replay in TCP. Keep up a table of nearby protests and their remote question references (i.e., question intermediaries). CSS434 RMI

Slide 20

Java RMIregistry void rebind (String name, Remote obj) This technique is utilized by a server to enlist the identifier of a remote question by name, as appeared in Figure 15.13, line 3. void tie (String name, Remote obj) This strategy can then again be utilized by a server to enlist a remote protest by name, yet in the event that the name is as of now boun