Remote Procedure Call Concept RPC - PowerPoint PPT Presentation

1 / 24
About This Presentation
Title:

Remote Procedure Call Concept RPC

Description:

The requesting program is a client and the service-providing program is the server. ... Each remote procedure call needs to be idem potent ... – PowerPoint PPT presentation

Number of Views:209
Avg rating:3.0/5.0
Slides: 25
Provided by: course61
Category:
Tags: rpc | call | concept | idem | procedure | remote

less

Transcript and Presenter's Notes

Title: Remote Procedure Call Concept RPC


1
Lecture 12
  • Remote Procedure Call Concept (RPC)

2
Overview
  • Introduction
  • RPC Model
  • Paradigm for Distributed Programs
  • Conventional Procedure Call Model
  • Client/Server and RPC
  • Sun Microsystems RPC Definition
  • Remote Programs and Procedures
  • Management for RPCs
  • Communication Semantics
  • RPC Mapping
  • RPC Data Marshaling
  • Summary

3
Introduction
  • Remote Procedure Call (RPC) is a protocol that
    one program can use to request a service from a
    program located in another computer.
  • RPC uses the client/server model.
  • The requesting program is a client and the
    service-providing program is the server.
  • Similar to a local procedure call, an RPC is a
    synchronous operation requiring the requesting
    program to be suspended until the results of the
    remote procedure are returned.
  • Threads or lightweight processes that share the
    same address space allow multiple RPCs to be
    performed concurrently.
  • The RPC concept simplifies the design of
    client/server software
  • Makes the programs easier to understand
  • Uses symmetric data conversion (XDR)

4
Remote Procedure Call Model
  • A conceptual framework for building distributed
    programs
  • Remote Procedure Call model or RPC model
  • Uses familiar concepts from conventional programs
    as the basis for the design of distributed
    applications

5
Distributed Programs Paradigms
  • Communication-Oriented Design
  • Begin with the communication protocol
  • Design a message format and syntax
  • Design the client/server by specifying how each
    reacts to incoming/outgoing messages
  • A communication-oriented design may lead to
    problems
  • Protocol may not provide all the needed
    functionality
  • Inexperience with protocol design could lead to
    inefficient protocols
  • Difficult to understand or modify
  • Application-Oriented Design
  • Begin with the application
  • Design a conventional application program
  • Build and test a working version as a
    conventional program
  • Divide the program into several pieces to execute
    on separate computers
  • The remote procedure call paradigm focuses on the
    application
  • Emphasizes the problem to be solved instead of
    the communication mechanism
  • Does not require major code changes when
    splitting procedures between local/remote
    machines
  • RPC separates the solution of a problem from the
    task of making the solution operate in a
    distributed environment

6
Conceptual Model for Conventional Procedure Calls
main
proc1
proc2
proc3
proc4
proc5
proc6
proc7
proc8
7
Extension of the Procedural Model
computer1
computer2
main
proc1
proc2
proc3
proc4
proc5
proc6
proc7
proc8
8
Conventional Procedure Call Execution
  • Single thread of control through all procedures
  • Execution begins in main and continues until it
    encounters a procedure call
  • Execution branches to the code in the procedure
  • Execution continues in the procedure until it
    encounters a return statement

9
Distributed Procedural Model
  • Single thread of execution executes in a
    distributed environment
  • Client/Server corresponds to a procedure call and
    return
  • Client request corresponds to a procedure call
  • Server response corresponds to the return function

Main Program machine 1 (client)
Procedure A machine 2 (server)
Procedure B machine 3 (server)
main
call remote proc A
call remote proc A
respond to caller
respond to caller
exit
10
Distributed Computation
  • Paradigm helps programmers design distributed
    programs easily
  • Distributed program invokes a procedure to access
    a remote service
  • Remote procedures are accessed the same as local
    procedures
  • Distributed are as easy to construct as
    conventional programs

11
Sun Microsystems' RPC Definition
  • Sun Microsystems developed a specific form of RPC
    (Sun RPC, Open Network Computing (ONC) RPC or
    simply RPC)
  • Received wide acceptance including NFS
  • ONC RPC defines the format of messages
  • Allows the calling program to use UDP or TCP
  • Uses XDR to represent procedure arguments as well
    as data items in an RPC message header
  • ONC RPC includes a compiler system to aid in
    building distributed applications

12
Remote Programs and Procedures
  • RPC defines a remote program as the basic unit of
    software that executes on a remote machine
  • Each remote program corresponds to a server and
    contains a set of one or more procedures plus
    global data
  • The procedures inside a remote program all share
    access to its global data

A single remote program
13
Identifying Remote Programs and Procedures
  • The ONC RPC standard specifies that each remote
    program be assigned a unique 32-bit integer to
    identify it
  • ONC RPC assigns an integer to each remote
    procedure inside a given remote program
  • The procedures are numbered 1, 2, N
  • ONC RPC divided the set of program numbers into 8
    groups of 32-bit numbers
  • Each remote program is assigned a unique number
  • ONC RPC includes an integer version number for
    each remote program
  • The RPC specification permits a computer to run
    multiple versions of a remote program

14
Mutual Exclusion for Procedures in a Remote
Program
  • The ONC RPC mechanism specifies that at most one
    remote procedure can execute in a remote program
    at one time
  • RPC provides automatic mutual exclusion among
    procedures within a given remote program
  • Important for remote programs that maintain a
    shared data area

15
Communication Semantics
  • ONC RPC does not enforce reliable semantics
  • Can use TCP or UDP as a transport protocol
  • When using UDP as the transport protocol the
    application must be able to tolerate zero-or-more
    execution semantics
  • Each remote procedure call needs to be idem
    potent
  • The standard does not specify additional
    protocols or mechanisms for reliable delivery
  • RPC semantics are defined as a function of the
    underlying transport protocol

16
RPC Retransmission
  • ONC RPC includes a simple timeout and
    retransmission strategy
  • Does not guarantee reliability
  • Default timeout mechanism implements a fixed
    timeout with a fixed number of retries

17
Map a Remote Program to a Protocol Port
  • TCP/UDP use 16-bit protocol numbers
  • RPC uses 32-bit numbers to identify remote
    programs
  • RPC programs can outnumber protocol ports
  • Unable to map RPC program to protocol ports
    directly
  • Each RPC program can obtain a protocol port
    number if port assignments are temporary

18
Dynamic Port Mapping
  • ONC RPC mechanism includes a dynamic mapping
    service to solve the identification problem
  • Each machine that supports RPC provides a
    mechanism that allows a mapping of RPC program
    numbers to protocol ports

RPC program register
RPC program (server)
RPC port mapper (server)
RPC program socket used by RPC
socket for well-known port
19
RPC Port Mapper Algorithm
  • Create a passive socket bound to the well-known
    port assigned to the ONC RPC port mapper service
    (111)
  • Repeatedly accept request to register an RPC
    program number or to look up a protocol port
    given an RPC program number

20
ONC RPC Message Format
  • ONC RPC does not use a fixed format for messages
  • The standard defines the general format of RPC
    messages
  • The XDR language defines the data items
  • The XDR language defines how to assemble a message

21
Data Marshaling Arguments
  • RPC must represent all arguments in an external
    form for transfer
  • Complex data structures must be encoded into a
    compact representation
  • marshal, linearize or serialize
  • Client side marshals the arguments into the
    message and the server side un-marshals them

22
Authentication
  • RPC uses several forms of authentication
  • Simple scheme that relies on UNIX
  • Complex scheme that uses the Data Encryption
    Standard (DES)
  • RPC leaves the format and interpretation up to
    the authentication subsystem

23
Example RPC Message
24
Summary
  • The remote procedure model helps make distributed
    programs easy to design and understand
  • The RPC model views each server as implementing
    one or more procedures
  • A message from a client corresponds to a call and
    a response from the server corresponds to a
    return
  • Remote procedures accept arguments and return one
    or more results
  • Sun Microsystems developed the de-facto standard
    form of remote procedure call (ONC RPC)
  • ONC RPC use a dynamic binding mechanism called
    the RPC Port Mapper
Write a Comment
User Comments (0)
About PowerShow.com