DOC PREVIEW
Chico CSCI 372 - Remote Procedure Calls

This preview shows page 1-2-3-23-24-25-26-47-48-49 out of 49 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 49 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Remote Procedure CallsStandardOrdinary Function CallSlide 4System CallSlide 6System Call/Function Call DifferencesSystem Call with JacketSlide 9System Call vs RPCRemote Procedure CallProtocol for RPCSlide 13Client StubMarshalingExternal Data Representation (XDR)Server StubRPC MechanismLocal Call to RPCHigh-Level RPC Generationrpcgendrand48Using drand48drand48 ExampleLocal Service DesignCalling Programrand.hUNIX Random-Number GeneratorsRPC Specificationrand.x Specification Fileproto.xrpcgen Filesrpcgen Files (Cont)Slide 34rpcgen Steps with rand.xUnmodified rand_client.c (Top)Unmodified rand_client.c (Middle)Unmodified rand_client.c (Bottom)Unmodified rand_client.c AnalysisModified rand_client.c (Top)Modified rand_client.c (Middle)Modified rand.client.c (Bottom)Modified rand_client.c AnalysisUnmodified rand_server.c (Top)Unmodified rand_server_c (Bottom)Modified rand.server.cOther DetailsSummarySummary (Cont)Remote Procedure Calls•Are RPCs the best or worst development to hit distributed computing•User interface for RPC is an emerging standard, but it is not as simple as it should be•Converts local function call to remote service•There are critical issues such as server state idempotent calls, and semantics under failures•It is natural to generalize function calls into a distributed setting to allow calls outside local address space – allows programmer to divert calls from overworked hosts, and take advantage of services not available locallyStandardThe Sun Open Network Computing (ONC) Transport Independent Remote Procedure Call (TI-RCP) is an RPC standardOrdinary Function Calluser space calling program called function thread of executionord_funct();ord_funct(void); {}Ordinary Function Call•When a program calls a function, the return address and other state information (activation record) are pushed on a run-time stack and control is transferred to the starting address of the function•The AR contains locations for parameters and automatic variables declared within the function•An ordinary function call is single threaded•The function call causes a change in execution address representing the thread of executionSystem Call user space kernel space calling program called function thread of execution trap -- return blocked threadsys_funct();sys_funct(void); {}System Call•Program requests system service by executing a system call•Works like ordinary function call except that the call refers to code in the OS rather than in the program•Differences between ordinary function call and system callSystem Call/Function Call Differences•System call is a trap to an entry point in the kernel which causes the thread of execution for the calling program to block•A separate thread of execution with a stack in the kernel executes the system call•When the trap returns, the original thread of execution unblocks•A program may invoke a system call directly or through C library functions•Library functions form jackets for the underlying services – a jacket could massage the parameters and perform other bookkeeping prior to making the system callSystem Call with Jacketuser space ordinary call ordinary return trap return from trapkernel spaceuser programC library function or jacketsystem callSystem Call with Jacket•Kernel trap handler gains control, examines request, executes the requested service and returns the result•System call prevents user from directly accessing code in the kernel to prevent damage•System call should look as much like function call as possible•System call is executing with a distinct thread and with a different stackSystem Call vs RPC•What if a program calls a function in the address space of another user instead of in the kernel?•This is an RPCRemote Procedure Callrem_funct();rem_funct(void); {}local hostuser spaceclient programremote hostuser spaceserver program thread of execution RPC call -- return blocked threadProtocol for RPCClient Process rpc rpc call returnmarshaled marshaled request return client kernellogicalcalllogicalreturnnetworkServer Process ordinary ordinary call returnmarshaled marshalled request returnserver kernelclient programclient Stub server stubserver functionsnetwork servicesnetwork servicesProtocol for RPC•Client makes a “logical call” and waits for a “logical return”•Client is compiled with additional code called client stub to form a single processClient Stub•Client is compiled with additional code called client stub to form a single process•Client stub is analogous to system call jacket•Responsible for converting arguments and assembling them into a message for network transmission•Client stub is a jacket to package up arguments for underlying requestMarshaling•Conversion to a network message is called marshaling the arguments•Converts to machine independent format so machines with different architectures can participate•Then the client stub makes a system call to the kernel of the OS (possibly using sockets) to send the message over the network and the client stub waits for a replyExternal Data Representation (XDR)Standard format for machine independent representation of dataServer Stub•The remote host compiles the remote function code with additional code called the server stub•The server stub acts as a jacket for server functions•When a client request arrives, the server kernel passes it to the waiting server stub•The server stub unmarshals the arguments and calls the requested service as a local function call•When the function call returns, the server stub marshals the return values into an appropriate network message and performs a system call (possibly with sockets) to transmit the message to the client•The kernel passes the message to the client as an ordinary return valueRPC Mechanism•Transparent to the caller•Client program only sees an ordinary function call to the client stub•Server functions are ordinary functions•The underlying mechanism for transporting requests and returning them is called the transport protocol•RPC is designed to be independent of the transport protocolLocal Call to RPC•Most natural approach for developing RPC is create local functions first and then see how remote execution changes them•Two main issues


View Full Document

Chico CSCI 372 - Remote Procedure Calls

Download Remote Procedure Calls
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Remote Procedure Calls and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Remote Procedure Calls 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?