Remote procedure calls in computer programming.ppt

samuelmuigai9 7 views 21 slides Sep 11, 2024
Slide 1
Slide 1 of 21
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21

About This Presentation

A Remote Procedure Call (RPC) is a software communication protocol that one program uses to request a service from another program located on a different computer and network, without having to understand the network's details.


Slide Content

Sep 11, 2024 S M Kamundi 1
CommunicationCommunication
Remote Procedure Remote Procedure
CallsCalls

Sep 11, 2024S M Kamundi 2
Introduction
Independently developed IPC protocol is tailored
specifically to one application and does not
provide a foundation on which to build a variety
of distributed applications
RPC emerged out of the need for general IPC
protocol that can be used for designing several
distributed applications.
RPC is not universal but it provides a
communication machine that is suitable for
building fairly large number of distributed
applications

Sep 11, 2024S M Kamundi 3
Introduction
Reasons for RPC popularity:

Simple call syntax

Familiar semantics

Its specification of a well-defined interface - supports
compile time type checking among others.

Ease of use

Generality

Efficiency due to rapid communication

Can be used as an IPC mechanism for both across
machines and within a give machine

Sep 11, 2024S M Kamundi 4
The RPC Model
 Similar to ordinary procedure call model in
the following ways:
a.Caller places arguments to the procedure
b.Control transferred to sequence of instructions
c.Procedure executed in a new execution
environment
d.Control returns to the caller.
In RPC however, the procedure may be local
or remote
RPC uses message passing scheme for
information exchange

Sep 11, 2024S M Kamundi 5
The RPC Model


Caller
(Client Process)
Call procedure and
wait for reply
Resume Execution
Calleee
(Server Process)
Receive request and start
procedure execution
Procedure executes
Send reply and wait
for next request
Reply message
(contains result of
procedure execution
Request message
(contains remote
procedure’s parameters

Sep 11, 2024S M Kamundi 6
Transparency of RPC
Both local and remote procedure calls should be (effectively)
indistinguishable to programmers
This requires:

Semantic transparency

Syntactic transparency
What differentiates remote from local PC?

Procedure executed in a different environment

More prone to failures

Consumes more time
These makes semantic transparency more difficult to
implement

Sep 11, 2024S M Kamundi 7
Implementing RPC Mechanisms
Based on stubs concepts that provides a normal
procedure call abstraction by concealing from the
programs interface underlying RPC system.
Has 5 elements
The client

The client stub

The RPC Runtime – communication package

The server stub

The server

Sep 11, 2024S M Kamundi 8
Implementing RPC Mechanisms

Return Call
Client
Unpack Pack
Client Stub
Receive Send
RPCRuntime
Call Return
Server
Unpack Pack
Server Stub
Receive Send
Client Machine
Server Machine
Execute
Wait
Call Packet
Result Packet
RPCRuntime

Sep 11, 2024S M Kamundi 9
Marshalling Arguments and
Results
Marshalling – encoding and decoding into/from
stream form
Must reflect the structures of all types of program
objects used in the concerned language
Are of two types:
Those provided by RPC software – supports pre-
defined data types
User-defined –for supporting user-defined data
types

Sep 11, 2024S M Kamundi 10
Server Management
Server implementation

Stateful servers – stores clients information from one
RPC to the next

Stateless servers- does not maintain any client state
information
Server Creation

Instance-per-call server – call duration

Instance-per-session servers
Persistent servers

Sep 11, 2024S M Kamundi 11
Server Management - Examples
Steteful Servers

Read(fid, n, buffer) – get n bytes of data from file whose Id is fid
into the buffer named buffer.

Write(fid, n buffer) - the server takes n bytes of data from the
specified buffer, writes into fid at the byte position currently
addressed by read-write pointer.
Stateless Servers

Read(filename, ,position,n, buffer) – get n bytes of data from file
whose Id is filename into the buffer named buffer.

Write(filename,position, n buffer) - the server takes n bytes of data
from the specified buffer, writes into fid at the byte position position.

Sep 11, 2024S M Kamundi 12
Parameter-Passing-Semantics
Call-by-value – parameters copied onto a
message
Call-by-reference – passing pointers is
meaningless because of the differences in
address spaces. Only possible incase of
shared memory.

Implies that you cannot be able to easily to call
by reference remotely.

Sep 11, 2024S M Kamundi 13
Call Semantics
Failures during message passing may affect
the RPC, hence the need for call semantics:

Possibly Or May-Be Call Semantics – caller
continues after a time-out

At-Least-Once Call Semantics

Exactly-Once Call Semantics

Sep 11, 2024S M Kamundi 14
Communication Protocols for
RPCs
The Request Protocol – (the R Protocol)

Nothing to return

Acknowledgement not required

Caller continues with execution after the call

Provides May-Be-Call Semantics

This RPC is asynchronous

E.g. A time server node in a DS may send
synchronization messages every T seconds so losing a
message or two is acceptable

Sep 11, 2024S M Kamundi 15
Communication Protocols for
RPCs
The Request/Reply Protocol – (the RR Protocol)

Suitable for simple RPCs – all arguments/results fit in a
single packet buffer and has less transmission time

Based on implicit acknowledgement

Has no failure-handling capabilities

Uses timeouts-retries technique to handle failures, hence
provides at-least-once call semantics

Can support exactly-once semantics if the server keeps
records of replies.

Sep 11, 2024S M Kamundi 16
Communication Protocols for
RPCs
The Request/Reply/Acknowledgement-Reply
Protocol – (the RRA Protocol)

Client acknowledge the receipt of reply messages and the
server uses this to delete reply information from its cache

Since acknowledgement messages may get lost, each
both messages (the reply and the acknowledgement)
have identifiers for matching purposes

Exercise:
Is there RARA Protocol?

Sep 11, 2024S M Kamundi 17
Complicated RPCs
Involving long duration

Periodic probing of the server by the client

Periodic generation of acknowledgement by the server
Involving arguments/results that are too large

Use several physical RPCs to handle one large logical
RPC

Use multidatagram messages

Sep 11, 2024S M Kamundi 18
Server Binding

Client stab needs to know the location of the
server through binding

Servers ‘export’ their operations and clients
‘import’ via the RPCRuntime.

Interface names (type and instance) are used for
servers

Servers can be located by use of ‘broadcasting’
or ‘Binding Agent’.

Sep 11, 2024S M Kamundi 19
RPC in Heterogeneous
Environments

Three types of heterogeneity to be addressed:
Data representation – how the particular machine
represents data. E.g. 1’s or 2’s compliments
Transport protocol – making the RPC system
independent of the protocol

Control protocol – must be independent of the control
information in each transport packet

Delay decisions until bind time

Sep 11, 2024S M Kamundi 20
Light Weight RPC

Recall the differences between Monolithic-kernel
operating systems and microkernel operating
systems. The two types of communication traffic
(cross-domain and cross-machine)

The LRPC is a communication facility designed
and optimized for cross-domain communications

Uses simple control/data transfer and simple
stubs.

Designed for concurrency

Sep 11, 2024S M Kamundi 21
Optimizations for Better
Performance

Concurrent access to multiple servers – using
threads, early reply approach or call buffering
approach

Serving multiple request simultaneously

Reducing per call workload of servers
Reply caching of Idempotent remote procedures

Proper selection of timeout values

Proper design of RPC protocol specification
Tags