Remote Procedure Call (RPC)
Itis aprotocol that one program can use to request a service from a program located in
another computer in a network without having to understandnetwork details.
RPC uses the client/server model.
The requesting program is a client and the serviceproviding program is the server. Like a
regular or local procedure call, an RPC is asynchronous([e'skrns] adj 异步的)operation requiring the requesting program to be suspended until the results of the remote
procedure are returned. However, the use of lightweight(['latwet] 轻量级的)processor therads that share the same address space allows multiple RPCs to be
performed concurrently([kn'krnt]同时地)
The Fingure
Figure shows the flow of activity that takes place during an RPC call between two networked systems. The client makes a procedure call that sends a request to the server and waits. The thread is blocked from processing until either a reply is received, or it times out. When the request arrives, the server calls a dispatch routine that performs the requested service, and sends the reply to the client. After the RPC call is completed, the client program continues. RPC specifically supports network applications.
A remote procedure is uniquely identified by the triple:
(program number, version number, procedure number) The program number identifies a
group of related remote procedures, each of which has a unique procedure number.
A program may consist of one or more versions. Each version consists of a collection of
procedures which are available to be called remotely.Version numbers enable multiple
versions of an RPC protocol to be available simultaneously. Each version contains a num
-ber of procedures that can be called remotely. Each procedure has a procedure number.
(?)When program statements that use RPC are compiled into an executable program, a
stub is included in the compiled code that acts as the representative of the remote
procedure code. When the program is run and the procedure call is issued, the stub
receives the request and forwards it to a client runtime program in the local computer.
The client runtime program has the knowledge of how to address the remote
computer and server application and sends the message across the network that requests
the remote procedure. Similarly, the server includes a runtime program and
stub that interface with the remote procedure itself. Results are returned the same way.