How does it work?

Here we describe the components involved in a remote call, and introduce some conventional terms. From the point of view of a remote call, the calling program is known as the client, and the subroutine it calls is known as the server. When the client calls the server, the RPC system must take care of: (picture ommitted: In this example, a FORTRAN program on a minicomputer calls a subroutine (written in C) on a microprocessor to set the state of a valve.)

The most common method of doing this is by the use of stub modules. The client program is linked to a client stub module. This is a subroutine which looks (from the outside) in every respect like the remote subroutine. On the inside, it is almost empty: all it does is take the values of the parameters which are passed to it, and put them in a message. This is known as marshalling.

The client stub then uses a routine in the RPC Run-Time System (RTS) to send the message off and wait for a reply message. When the reply arrives, the stub unmarshals the parameters that were returned in the reply message, putting their values into the variables of the calling program. The client stub then returns to the calling program just like a normal subroutine.

The server stub is located on the remote machine. It is called by the RPC run-time system when the message arrives from the client. The server stub performs the operations complementary to those of the the client stub: unmarshalling the parameters passed to the subroutine, calling the subroutine, and marshalling the return parameters.

(picture ommitted) The software components of a remote call.

All the communication details are handled by the RPC run-time system, so the stubs contain only the code which is specific to the application involved. Each stub handles a specific set of procedures known as a package.

In order to produce stub modules, one needs to know

This information is normally declared in modern programming languages such as Ada. It is simple to write, even if the rest of the code is written in FORTRAN. Given such a definition of a package, it is a mechanical task to write the stub modules, and so this is done by a program called an RPCJcompiler. (picture ommitted): The RPC compiler takes the package definition as input, and produces both stub modules.

(Back) (To Summary) (More >> )