Professional Documents
Culture Documents
Distributed Systems
2
What is a Distributed System?
Examples:
Distributed object-based systems (CORBA, DCOM)
Distributed file systems (NFS)
etc.
TvS 1.2 3
Heterogeneity
Applies to all of the following:
– networks
• Internet protocols mask the differences between networks
– computer hardware
• e.g. data types such as integers can be represented differently
– operating systems
• e.g. the API to IP differs from one OS to another
– programming languages
• data structures (arrays, records) can be represented differently
– implementations by different developers
• they need agreed standards so as to be able to interwork
6
Layered Protocols: OSI
Layers, interfaces, and protocols in the OSI model.
2-1
TvS 2.2 7
Middleware Protocols
2-5
TvS 2.6 8
Middleware
A software layer that
– masks the heterogeneity of systems
– provides a convenient programming abstraction
– provides protocols for providing general-purpose services
to more specific applications, eg.
• authentication protocols
• authorization protocols
• distributed commit protocols
• distributed locking protocols
• high-level communication protocols
– remote procedure calls (RPC)
– remote method invocation (RMI)
9
Middleware
General structure of a distributed system as middleware.
1-22
TvS 1.24 10
Middleware and Openness
1.23
TvS 1.25 11
Middleware programming models
Remote Calls
– remote Procedure Calls (RPC)
– distributed objects and Remote Method Invocation (RMI)
• eg. Java RMI
Common Object Request Broker Architecture (CORBA)
– cross-language RMI
Other programming models
– remote event notification
– remote SQL access
– distributed transaction processing
CDK Ch 1 12
External Data Representation
CDK 4.3 14
Motivation
Data in running programs:
Not just primitives, but
arrays, pointers, lists, trees, etc.
In general:
complex graphs of interconnected structures or objects
CDK 4.3 15
What is an External Data Representation?
“An agreed standard for the representation of data structures and
primitive values.”
Examples:
CORBA’s Common Data Representation (CDR)
Java Object Serialization
Sun XDR (RFC 1832)
16
CORBA CDR
Defined in CORBA 2.0 in 1998
Primitive types:
Standard data types, both big/little endian, conversion by the
receiver.
Constructed types:
sequence, string, array, struct, enumerated, union
(not objects)
Data types are not specified in the external format: receiver is
assumed to have access to the definition (via IDL).
(unlike Java Object Serialization!)
CDK 4.3 17
CORBA CDR
– only defined in CORBA 2.0 in 1998, before that, each
implementation of CORBA had an external data
representation, but they could not generally work with one
another. That is:
• the heterogeneity of hardware was masked
• but not the heterogeneity due to different programmers
(until CORBA 2)
– CORBA CDR represents simple and constructed data types
(sequence, string, array, struct, enum and union)
• note that it does not deal with objects
– it requires an IDL specification of data to be serialised
CDK 4.3 18
CORBA CDR Example
Index in sequence 4 bytes wide Notes
of bytes
CDK 4.3 19
Remote Procedure Calls
(RPC)
What is RPC?
Call a procedure (function, subroutine, method, …)
in a program
running on a remote machine,
21
Conventional Procedure Call
a) Parameter passing in a local procedure call: the stack before the call to read
b) The stack while the called procedure is active
TvS 2.7 22
Parameter Passing Techniques
Call-by-value
Call-by-reference
Call-by-copy/restore
23
Client and Server Stubs
Principle of RPC between a client and server program.
TvS 2.8 24
Steps of a Remote Procedure Call
1. Client procedure calls client stub in normal way
2. Client stub builds message, calls local OS
3. Client's OS sends message to remote OS
4. Remote OS gives message to server stub
5. Server stub unpacks parameters, calls server
6. Server does work, returns result to the stub
7. Server stub packs it in message, calls local OS
8. Server's OS sends message to client's OS
9. Client's OS gives message to client stub
10. Stub unpacks result, returns to client
TvS 2.9 25
Passing Value Parameters
Steps involved in doing remote computation through RPC
2-8
TvS 2.10 26
Passing Value Parameters:
Data Representation Issues
a) A procedure
b) The corresponding message.
TvS 2.12 28
Passing Reference Parameters
Reference variables (pointers):
pointers to arrays
pointers to structures (objects without methods)
“Parameter marshalling”
2-12
TvS 2.14 30
Asynchronous RPC:
Deferred Synchronous RPC
A client and server interacting through two asynchronous RPCs
TvS 2.15 31
Distributed Computing Environment (DCE)
A middleware system
Developed by The Open Group (previously OSF)
Includes
distributed file service
directory service
security service
distributed time service
Adopted by Microsoft for distributed computing
32
DCE: Binding a Client to a Server
2-15
TvS 2.17 33
Remote Method Invocation
(RMI)
What is RMI?
RPC to a method in an object on another machine.
35
Object Orientation:
Remote Method Invocation (RMI)
An object encapsulates
State (fields or instance variables)
Methods (often described by an interface)
Distributed object:
An interface known locally may describe an object on
another machine.
36
Distributed Objects
TvS 2.18 37
Binding a Client to an Object
TvS 2.19 38
Parameter Passing
The situation when passing an object by reference or by value.
2-18
TvS 2.20 39
The DCE Distributed-Object Model
a) Distributed dynamic objects in DCE.
b) Distributed named objects
TvS 2.21 40