Fundamentals Stream: Lecture 2 - PowerPoint PPT Presentation

1 / 25
About This Presentation
Title:

Fundamentals Stream: Lecture 2

Description:

Supports the calling of a procedure in a separate address ... Ideal for idempotent operations. At Most Once Protocols. Client. Server. Call. Request (#1473) ... – PowerPoint PPT presentation

Number of Views:29
Avg rating:3.0/5.0
Slides: 26
Provided by: gor450
Category:

less

Transcript and Presenter's Notes

Title: Fundamentals Stream: Lecture 2


1
Fundamentals Stream Lecture 2
  • Overview of Lecture
  • Definition and issues
  • Using RPC
  • Implementing RPC
  • From RPC to RMI
  • Alternative approaches
  • Additional reading
  • CDK chapter 5
  • CDK chapters 3 and 4 (as background)

2
What is RPC?
  • Higher level mechanism supporting the
    construction of distributed applications (see
    also discussion on transparency later)
  • Supports the calling of a procedure in a separate
    address space (process) as if it exists in the
    local address space the process may or may not
    be on the same machine
  • But what is the semantics of a local procedure
    call?

3
RPC and Middleware
4
Styles of RPC
  • First class RPC
  • Integrated into the language gt normal language
    mechanisms can be used for exceptions etc
  • Examples include Java RMI, Ada and Argus
  • Second Class RPC
  • A special Interface Definition Language (IDL) is
    used to define communications (see later) gt
    language independence
  • Examples include Sun RPC, CORBA and DCE

5
Programming with Interfaces
  • Separation of interface and implementation
  • Client software does not need to know the details
    of the implementation
  • Important for platform and language independence
  • Also important to support the evolution of
    software

6
Interface Definition Languages
  • What is an IDL?
  • A language independent means of specifying an
    interface
  • CF abstract data type specification
  • Dealing with Parameters
  • IN parameters value passed to server
  • OUT parameters value returned from server
  • IN/OUT parameters combination of above

7
Example CORBA IDL
interface inventory // attributes and type
definitions const long MAX_STRING 30
typedef long part_num typedef long
part_price typedef long part_quantity
typedef string part_nameltMAX_STRING1gt
struct part_stock part_quantity
max_threshold part_quantity min_threshold
part_quantity actual
8
CORBA IDL (continued)
// operations boolean is_part_available (in
part_num number) void get_price (in
part_num number, out part_price price) void
get_stock (in part_num number, out part_quantity
quantity) long order_part
(in part_num number, inout part_quantity
quantity, in account_num account)
9
The Issue of Transparency
  • Definition
  • Transparency (in distributed systems) refers to
    the property of hiding aspects of distribution
    from the user, e.g. location transparency
  • Transparency in RPC
  • Ultimate goal, but generally compromised by
  • overall cost of an RPC (see earlier)
  • extra exceptions that are raised
  • parameter passing is different, e.g. pointers

10
From RPC to RMI (Remote Method Invocation
N.B. Must also deal with distribution wrt object
references, exceptions, garbage collection,. etc
(see CDK chapter 5)
11
Implementing RPC
Communications modules
Remote Object B
Proxy
Dispatcher
Request
Object A
Reply
Server Stub
Client Stub
N.B. Proxies, stubs, dispatchers are generated
automatically by an appropriate IDL compiler
12
Overview of Key Components Client Side
  • Proxies (see also smart proxies)
  • Masquerades as a local version of the remote
    interface
  • Redirects calls to client stubs
  • May perform other actions (smart proxies)
  • Client stubs
  • Carries out marshalling (flattening) of calls and
    the requests the retransmission of the message
  • Also must unmarshal returning replies

13
Overview of Key Components Server Side
  • Dispatchers
  • Receive incoming messages and direct them to an
    appropriate server stub
  • Server stubs (skeletons)
  • Unmarshals message and then invokes appropriate
    code body
  • Must also marshal reply values and initiate
    transmission back to the client

14
Focus on Underlying Protocol
  • Task
  • You are asked to design the communications module
    for RPC which will provide a protocol that mimics
    the semantics of a local call
  • Problems
  • Request message may get lost
  • Reply message may get lost
  • Client may crash
  • Server may crash

15
Lightweight Protocols
  • Maybe
  • Send request to server which sends back a reply
  • No real guarantees at all if anything goes wrong
  • At least once
  • Sends message and if reply not received after a
    given time, the message is re-sent (failure
    assumed after n re-sends)
  • Will guarantee the call is made at least once,
    but possibly multiple times
  • Ideal for idempotent operations

16
At Most Once Protocols
Client
Server
Call
Re-send
17
From At Most Once to Exactly Once
  • Semantics
  • The remote procedure call will be carried out
    once (completely) or not at all (the operation
    will be aborted)
  • Approach
  • Builds on at most once protocol
  • Requires additional support for atomicity (see
    lecture 4, and CDK chapter 12)

18
Alternative 1 Asynchronous Message Passing
  • What is asynchronous message passing?
  • Sender sends a message then continues
  • At some unpredictable point in the future the
    receiver will receive the message
  • Messages typically directed to ports

Send
Receive
19
Analysis
  • Advantages
  • Lightweight and efficient
  • Distribution is completely non-transparent
  • Disadvantages
  • Very low level
  • Need to perform equivalent of marshalling and
    unmarshalling manually (plus reach agreement on
    formats)
  • Similarly with dispatching

20
Alternative 2 Event Services
Often referred to as the publish-subscribe
paradigm
21
Analysis
  • Advantages
  • Highly asynchronous
  • Strong de-coupling between publishers and
    subscribers
  • Naturally supports resource discovery (see Jini,
    lecture 5)
  • Also supports dynamic change
  • Disadvantages
  • Sometimes difficult to manage a high level of
    asynchronicity
  • New paradigm to master

22
Other Techniques
  • Distributed shared memory
  • Every process sees the same (large) logical
    address space
  • Memory is partially replicated on each machine
    and techniques are required to ensure data is
    available when required (cf paging)
  • Tuple space communication
  • A tuple space is a shared and persistent
    repository of tuples (cf generative
    communication)
  • Processes can place a tuple in tuple space using
    an out operation, then processes can select a
    tuple from tuple space using an in or read

23
Expected Learning Outcomes
  • You should understand the concept of RPC its role
    in middleware and also its relationship to RMI
  • You should appreciate the issues involved in the
    design of an RPC service, e.g. transparency
  • You should also appreciate how modern RPC
    services may be implemented, including the key
    architectural elements involved

24
Expected Learning Outcomes (continued)
  • You should be able to compare and contrast the
    service offered by RPC with alternative services
    such as event services or distributed shared
    memory
  • Again, you should be able to relate the concepts
    introduced in this lecture to those introduced in
    the practical stream (use of Java RMI)

25
Exam Question of the Week
  • A) Describe what is meant by the term remote
    procedure call (RPC) in the context of
    distributed systems design. Distinguish clearly
    between first and second class RPC services.
    5 marks
  • B) Discuss in detail the benefits of using an RPC
    service as opposed to a lower level service such
    as sockets. In addition comment on the different
    styles of programming offered by RPC and event
    services. 8 marks
  • C) State precisely the semantics of a local
    procedure call in the presence of failure
    carefully justify your answer. Outline a
    communications protocol which will provide the
    same level of service in a distributed
    environment. 7 marks
Write a Comment
User Comments (0)
About PowerShow.com