Stub (distributed computing)
   HOME

TheInfoList



OR:

{{unreferenced, date=June 2008 A stub in
distributed computing A distributed system is a system whose components are located on different networked computers, which communicate and coordinate their actions by passing messages to one another from any system. Distributed computing is a field of computer sci ...
is a piece of code that converts parameters passed between client and server during a
remote procedure call In distributed computing, a remote procedure call (RPC) is when a computer program causes a procedure ( subroutine) to execute in a different address space (commonly on another computer on a shared network), which is coded as if it were a normal ...
( RPC). The main idea of an RPC is to allow a local computer (
client Client(s) or The Client may refer to: * Client (business) * Client (computing), hardware or software that accesses a remote service on another computer * Customer or client, a recipient of goods or services in return for monetary or other valuabl ...
) to remotely call procedures on a different computer (
server Server may refer to: Computing *Server (computing), a computer program or a device that provides functionality for other programs or devices, called clients Role * Waiting staff, those who work at a restaurant or a bar attending customers and su ...
). The client and server use different
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. For software programs to save and retrieve s ...
s, so parameters used in a function (procedure) call have to be converted, otherwise the values of those parameters could not be used, because pointers to parameters in one computer's memory would point to different data on the other computer. The client and server may also use different data representations, even for simple parameters (e.g.,
big-endian In computing, endianness, also known as byte sex, is the order or sequence of bytes of a word of digital data in computer memory. Endianness is primarily expressed as big-endian (BE) or little-endian (LE). A big-endian system stores the most si ...
versus
little-endian In computing, endianness, also known as byte sex, is the order or sequence of bytes of a word of digital data in computer memory. Endianness is primarily expressed as big-endian (BE) or little-endian (LE). A big-endian system stores the most si ...
for integers). Stubs perform the conversion of the parameters, so a remote procedure call looks like a local function call for the remote computer. Stub libraries must be installed on both the client and server side. A client stub (sometimes called proxy) is responsible for conversion (marshalling) of parameters used in a function call and deconversion of results passed from the server after execution of the function. A server
skeleton A skeleton is the structural frame that supports the body of an animal. There are several types of skeletons, including the exoskeleton, which is the stable outer shell of an organism, the endoskeleton, which forms the support structure inside ...
, the stub on the server side, is responsible for deconversion of parameters passed by the client and conversion of the results after the execution of the function. Stubs can be generated in one of 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 the more commonly used method for stub generation. It uses an
interface description language interface description language or interface definition language (IDL), is a generic term for a language that lets a program or object written in one language communicate with another program written in an unknown language. IDLs describe an inter ...
(IDL) to define 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. A server program that implements a procedure in an interface is said to ''export'' the interface and a client program that calls procedures from an interface is said to ''import'' the interface. When writing a distributed application, a programmer first writes an interface definition using the IDL, then programmers can write the client program that imports the interface and the server program that exports the interface. The interface definition is processed using an IDL compiler to generate components that can be combined with client and server programs, without making any changes to the existing compilers. In particular, from an interface for each procedure in the interface, the compiler generates the appropriate marshalling and unmarshalling operations in each stub procedure and a header file that supports the data types in the interface definition. The header file is included in the source files of both the client and server programs, the client stub procedures are compiled and linked with the client program, and the server stub procedures are compiled and linked with the server program. An IDL compiler can be designed to process interface definitions for use with different languages, enabling clients and servers written in different languages to communicate using remote procedure calls. To achieve the goal of semantics transparency, designers have made RPC look like LPC using the concept of stubs that hide the actual RPC implementation from the programs the interface to the underlying RPC system. Distributed computing architecture