A RPC works on the simple mechanism of calling a local procedure & then extend this mechanism by transferring the control and data over communication network. A RPC can be viewed as an interaction between client and server where a client in need of a service will invoke a procedure on the server.

Basic RPC Operation

If a calling process on a client machine invokes a remote procedure call with some parameters then these parameters are sent to the remote procedure by that time client gets blocked. After the execution of the remote procedure, the result is sent back to the client which its execution as it has been executed a local procedure. RPC is implemented with the help of stub procedure. Whenever a user process on a client machine, invokes a RPC then it is mapped on a local dummy procedure or client stub procedure.

Client stub procedure will pack the parameters and information regarding the remote procedure in a message and then transmit this message to the remote machine (server). On server side, there is a server stub procedure which unpacks this information & calls the required procedure. After execution of remote procedure, the result is given back to server stub procedure which packs this information and send it to client machine. On client machine, the client stub procedure unpacks the result & then transfer both the control & result to the process which has invoked RPC.

Binding

Binding is a process of determining whether the invoked call is a local procedure call or a RPC & in case of RPC, it also determines the address of remote machine with the help of binding server. All servers register their services to the binding server so binding server contains a database having a list of all available services and address of machines on which these services are available. In response of the query received from client stub procedure of a client machine, the binding server returns the address of corresponding server machine.

Issues in Parameter or Result Passing

Before sending parameters or results, sender must convert it into the data representation understood by the receiver machine. If this conversion is to be made at every call then it will be expansive however this problem can be solved in two ways:

Approach1:

The sender sends the parameter & results along with a code to the receiver. This code specify the data format of receiver machine. Each machine of the system must have the knowledge regarding conversion of all possible formats. The limitation of this approach is that the introduction of new machine & new languages may result in new data formats whose information may not be available to all machines.

Approach 2:

Any data item in the message must be in the standard format. The sender before sending the data , will convert it into the standard format. On the other hand, the receiver will convert this information from the standard format into its local representation. This scheme is wasteful if both sender & receiver are using same data formats as it will result in unnecessary conversion.

Error Handling in RPC

A RPC can fail due to:

Computer Failure: Suppose ignite has invoked a RPC & by the time server has executed it, the client gets crashed. This RPC execution is of no use, since the process which requires the result is no longer present.

Communication Failure: Consider a system in which messages are generally lost. Suppose a client has invoked RPC on a server which is slow in execution. It is possible that by that time server has executed remote procedure, the client might have issued another RPC assuming the fact that the previous message is lost. Such unwanted RPCs are called Orphans.

Semantics of RPC

Semantics of RPC plays an important role in the development of programs for distributed computations.

At Least one semantic

If a RPC is successful then it means that it has been executed at least once& if it fails then it might have been executed 0,1 or more than one time.

Exactly on semantic

If a RPC is successful then it means that it has been executed only once & if it fails then it might have been executed 0, partial or 1 time.

Atmost one semantic

If a RPC is successful then it means that it has been executed once& if it fails then it will not have been executed, example: ATM.


Like it on Facebook, Tweet it or share this article on other bookmarking websites.

No comments