Stub (distributed computing)
Encyclopedia
A stub in distributed computing
is a piece of code used for converting parameters passed during a Remote Procedure Call
(RPC
).
The main idea of an RPC
is to allow a local computer (client
) to remotely call procedures on a remote computer (server
). The client and server use different address space
s, so conversion of parameters used in a function call have to be performed, otherwise the values of those parameters could not be used, because of pointers to the computer's memory pointing to different data on each machine. The client and server may also use different data representations even for simple parameters (e.g., big-endian versus little-endian for integers.) Stubs are used to perform the conversion of the parameters, so a Remote Function Call looks like a local function call for the remote computer.
Stub libraries must be installed on client and server side.
A client stub is responsible for conversion of parameters used in a function call and deconversion of results passed from the server after execution of the function.
A server skeleton
, the stub on server side, is responsible for deconversion of parameters passed by the client and conversion of the results after the execution of the function.
Stub can be generated in one of the two ways:
function.
Distributed computing
Distributed computing is a field of computer science that studies distributed systems. A distributed system consists of multiple autonomous computers that communicate through a computer network. The computers interact with each other in order to achieve a common goal...
is a piece of code used for converting parameters passed during a Remote Procedure Call
Remote procedure call
In computer science, a remote procedure call is an inter-process communication that allows a computer program to cause a subroutine or procedure to execute in another address space without the programmer explicitly coding the details for this remote interaction...
(RPC
Remote procedure call
In computer science, a remote procedure call is an inter-process communication that allows a computer program to cause a subroutine or procedure to execute in another address space without the programmer explicitly coding the details for this remote interaction...
).
The main idea of an RPC
Remote procedure call
In computer science, a remote procedure call is an inter-process communication that allows a computer program to cause a subroutine or procedure to execute in another address space without the programmer explicitly coding the details for this remote interaction...
is to allow a local computer (client
Client (computing)
A client is an application or system that accesses a service made available by a server. The server is often on another computer system, in which case the client accesses the service by way of a network....
) to remotely call procedures on a remote computer (server
Server (computing)
In the context of client-server architecture, a server is a computer program running to serve the requests of other programs, the "clients". Thus, the "server" performs some computational task on behalf of "clients"...
). The client and server use different address space
Address space
In computing, an address space defines a range of discrete addresses, each of which may correspond to a network host, peripheral device, disk sector, a memory cell or other logical or physical entity.- Overview :...
s, so conversion of parameters used in a function call have to be performed, otherwise the values of those parameters could not be used, because of pointers to the computer's memory pointing to different data on each machine. The client and server may also use different data representations even for simple parameters (e.g., big-endian versus little-endian for integers.) Stubs are used to perform the conversion of the parameters, so a Remote Function Call looks like a local function call for the remote computer.
Stub libraries must be installed on client and server side.
A client stub is responsible for conversion of parameters used in a function call and deconversion of results passed from the server after execution of the function.
A server skeleton
Class skeleton
-As pattern:A class skeleton is an outline of a class that is used in software engineering. It contains a description of the class's roles, and describes the purposes of the variables and methods, but does not implement them...
, the stub on server side, is responsible for deconversion of parameters passed by the client and conversion of the results after the execution of the function.
Stub can be generated in one of the two ways:
- Manually: In this method, the RPC implementer provides a set of translation functions from which a user can construct his or her own stubs. This method is simple to implement and can handle very complex parameter types.
- Automatically: This is more commonly used method for stub generation. It uses an interface description languageInterface description languageAn interface description language , or IDL for short, is a specification language used to describe a software component's interface...
(IDL), that is used for defining the interface between Client and Server. For example, an interface definition has information to indicate whether, each argument is input, output or both — only input arguments need to be copied from client to server and only output elements need to be copied from server to client.
function.