You are on page 1of 26

Arba Minch University Institute of Technology

Faculty of Computing and Software Engineering

Assignment Of Introduction to Distributed System


Course Code: SENG3112G3SE B
Title: REMOTE PROCEDURE CALL IN DISTRIBUTED SYSTEM
Name :Jemal Mohammed
Id : 1710/10
Section : B
Submission : 19/6/2013
Submitted To Mr. Eyasu T
Set by jemal Mmd 1
CALLS
IN DISTRIBUTED SYSTEM

Objectives Of the Lecture

Set by jemal Mmd 2


After completing this Lecture, the Learner will be
able to know
History of Remote Procedure Calls
Define Remote Procedure Calls
Model of Remote Procedure Calls
The Implementing of Remote Procedure Calls
Step Of Remote Procedure Calls
Advantage Of RPC
Disadvantage of RPC
Goal of RPC
Set by jemal Mmd 3
History of Remoted Procedure Call

In 1984, Birrell and Nelson devised a mechanism to allow programs to


call procedures on other machines.
A process on machine A can call a procedure on machine B. When it
does so, the process on A is suspended and execution continues on B.
When B returns, the return value is passed to A and A continues
execution. This mechanism is called the Remote Procedure Call (RPC). To
the programmer, it appears as if a normal procedure call is taking place.
Obviously, a remote procedure call is different from a local one in the
underlying implementation Set by jemal Mmd 4
Definition Of Remote Procedure Calls

 Remote Procedure Calls is protocol that one program can use to


request service from program
 Located on another computer in a network without having to
understand the network detail.
 Procedure is also called function call or subroutine call.
 It can be said as the special case of message passing model.
 It is become widely accepted because of the following feature.

Set by jemal Mmd 5


Count…….
 It also occurs between the different processes in the some
machine.
 It has simple call syntax and similarity to the local procedure call.
 It is Ease to use
 Efficiency and generality
Distributed systems usually use remote procedure call (RPC) as a
fundamental building block for implementing remote operations.
Because we are dealing with an environment in the processes
are executed separate system we must use message based
communication scheme to provide
Remote service.
Set by jemal Mmd 6
Model of Remote Procedure Calls
There are several RPC models and distributed computing
 implementations.
A popular model and implementation are :
 The Open Software Foundation's (OSF).
 Distributed Computing Environment (DCE).
The Institute of Electrical and Electronics Engineers (IEEE) defines RPC in
its ISO Remote Procedure Call Specification.
 RPC spans the transport layer and the application layer in the Open
Systems Interconnection (OSI) model of network communication.
RPC makes it easier to develop an application that includes multiple
programs distributed in a networkSet by jemal Mmd 7
Count……
Alternative methods for client-server communication include message queueing and
IBM's Advanced Program-to-Program Communication (APPC).
figure 1.1 Client- server Model

Set by jemal Mmd 8


The Implementing of Remote Procedure Calls
Implementing of Remote procedure involves five elements of program.
1. Client
2. Client stub
3. Remote procedure calls Runtime
4. Server stub
5. Server
The client, client stub and one instance of remote procedure calls
runtime execute on client machine.
The server, server stub and one instance of remote procedure calls
runtime execute on server machine.
As far as the client is concerned remote services are accessed by user.
Set by jemal Mmd 9
stub
Stubs creation Stubs creation The programmer specifies a set of
procedures that will be remote by giving the interface details(i.e.,
number and type of arguments).
To do so, the programmer uses the tool’s IDL (Interface Definition
Languages).
A IDL compiler is used to generate the client and server stubs in a high
level language. (for example, C language)
The programmer then compiles and links two separate programs.
The server stubs are combined with the remote procedures to form the
server program.
The client stubs are combined with the main program and local
Set by jemal Mmd 10
1.Client
The server When we start the server, the server stub runs and
puts the process in the background (don’t forget to run ps to
find it and kill it when you no longer need it) .
It creates a socket and binds any local port to the socket.
It then calls a function in the RPC library, svc_register, to
register the program number and version.
This contacts the port mapper.
The port mapper is a separate process that is usually started at
system boot time.
It keeps track of the port number, version number, and
program number.
Set by jemal Mmd 11
count..
 Client is user processes which initiate a remote procedure calls.
 The client makes a perfectly normal call that invoke corresponding
procedure in client stub.
2.Client stub
client stub is on receipt of call a request from the client.
it pack a specification of the target procedure and argument in to
message and ask the local remote procedure calls runtime to send
it to be server stub.
On the receipt of result of the procedure execution, it unpacks the result
and pass it to the client. Set by jemal Mmd 12
3.Remote procedure calls Runtime

Remote procedure calls Runtime is handle transmission of message


between client and server
It is responsible for:
 retransmission
 Acknowledgment
 Routing and
 Encryption

4.Server stub
Server stub is responsible for the following two task:
On the receipt of call request message from the local remote procedure calls runtime, it unpacks it and make
perfectly normal call to invoke the appropriate procedure in the server.

Set by jemal Mmd 13


.
5.Server

The server When we start the server, the server stub runs and puts the
process in the background (don’t forget to run PS to find it and kill it
when you no longer need it) . It creates a socket and binds any local port
to the socket. It then calls a function in the RPC library, svc_register, to
register the program number and version. This contacts the port
mapper. The port mapper is a separate process that is usually started at
system boot time. It keeps track of the port number, version number,
and program number. On UNIX System V release , this process is rpcbind.
On earlier systems, it was known as Portman. The server then waits for a
client request (i.e., it does a listen).
Set by jemal Mmd 14
Step Of Remote Procedure Calls
Clearly, there is no architectural support for making remote procedure
calls.
A local procedure call generally involves placing the calling parameters
on the stack and executing some form of a call instruction to the address
of the procedure.
The procedure can read the parameters from the stack, do its work,
place the return value in a register and then return to the address on top
of the stack.
None of this exists for calling remote procedures.
We’ll have to simulate it all with the tools that we do have, namely local
Set by jemal Mmd 15
Count..

This simulation makes remote procedure calls a language level construct


as opposed to sockets, which are an operating system level construct.
This means that our compiler will have to know that remote procedure
call invocations need the presence of special code.
The entire trick in making remote procedure calls work is in the creation
of stub functions that make it appear to the user that the call is really
local.
A stub function looks like the function that the user intends to call but
really contains code for sending and receiving messages over a network.
The following sequence of operations takes place
Set by jemal Mmd 16
Figure 1.2 Functional steps in a remote procedure call

Set by jemal Mmd 17


The sequence of operations, depicted in Figure 1.2, is:
1. Network messages are sent by the client stub to the remote system
(via a system call to the local kernel).
2. The client calls a local procedure, called the client stub. To the client
process, it appears that this is the actual procedure. The client stub
packages the arguments to the remote procedure (this may involve
converting them to a standard format) and builds one or more
network messages. The packaging of arguments into a network
message is called marshaling.
3. Network messages are transferred by the kernel to the remote
system via some protocol (either connectionless or connection-
oriented). Set by jemal Mmd 18
4. A server stub procedure on the server receives the messages. It
unmarshals the arguments from the messages and possibly converts
them from a standard form into a machine-specific form.
5. The server stub executes a local procedure call to the actual server
function, passing it the arguments that it received from the client.
6. When the server is finished, it returns to the server stub with its
return values.
7. The server stub converts the return values (if necessary) and marshals
them into one or more network messages to send to the client stub.
8. Messages get sent back across the network to the client stub.

Set by jemal Mmd 19


9. The client stub reads the messages from the local kernel.
10. It then returns the results to the client function (possibly converting
them first).
The client code then continues its execution…
The major benefits of RPC are twofold: the programmer can now use
procedure call semantics and writing distributed applications is
simplified because RPC hides all of the network code into stub functions.
Application programs don’t have to worry about details (such as sockets,
port numbers, byte ordering). Using the OSI reference model, RPC is a
presentation layer service. Several issues arise when we think about
implementing such a facility:

Set by jemal Mmd 20


Advantages of RPC

- Server independent.
- Process-oriented and thread oriented models supported by RPC.
- The development of distributed systems is simple because it uses
straightforward semantics and easier.
- Like the common communications between the portions of an application, the
development of the procedures for the remote calls is quite general.
- The procedure calls preserves the business logics which is apt for the
application.
- Enables the usage of the applications used in the distributed environment, no
only in the local environment.
RPC provides interoperability between CORBA ORB implementations.
- A lightweight RPC protocol permits efficient implementations
Set by jemal Mmd 21
Count…
Remote procedure calls support process oriented and thread oriented
models.
The internal message passing mechanism of RPC is hidden from the
user.
The effort to re-write and re-develop the code is minimum in remote
procedure calls.
Remote procedure calls can be used in distributed environment as well
as the local environment.
Many of the protocol layers are omitted by RPC to improve performance

Set by jemal Mmd 22


Disadvantage of RPC
- Context switching increases scheduling costs
- RPC is not a standard – it is an idea that can be implemented in many
ways
- RPC does not solve the most of the distribution creation problems
- RPC is only interaction based. This does not offer any flexibility in
terms of hardware architecture.
RPC implementations are not yet mature.
- It requires the TCP/IP protocol. Other transport protocols are not
supported yet.
- Not yet proven over wide-area networks.
Set by jemal Mmd 23
Count…
The remote procedure call is a concept that can be implemented in
different ways.

It is not a standard.
There is no flexibility in RPC for hardware architecture.
It is only interaction based.
There is an increase in costs because of remote procedure call

Set by jemal Mmd 24


Goal of Remote procedure calls
 The main goal of RPC is to hide the existence of the network from a
program.
 The message-passing nature of network communication is hidden
from the user.
 The user doesn't first open a connection, read and write data, and
then close the connection. Indeed, a client often does'n not even
know they are using the network!

Set by jemal Mmd 25


26
! !!
U !
YO
NK
H A
md

T
al M
Je m
by
Set

You might also like