Vous êtes sur la page 1sur 14

Instructors Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn.

4
Pearson Education 2005
Slides for Chapter 4:
Inter process Communication
Instructors Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
Pearson Education 2005
Middleware layers
Applications, services
Middleware
layers
requestreply protocol
marshallin! and e"ternal data representation
#$% and &C%
&his
chapter
'MI and '%C
Instructors Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
Pearson Education 2005
Soc(ets and ports
messa!e
a!reed port
any port
soc(et soc(et
Internet address ) *+,-+.-,,-/40 Internet address ) *+,-+.-04-/4,
other ports
client
server
Instructors Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
Pearson Education 2005
C1'2A C$' for constructed types
Type Representation
sequence length (unsigned long) followed by elements in order
string length (unsigned long) followed by characters in order (can also
can have wide characters)
array array elements in order (no length specified because it is fixed)
struct in the order of declaration of the components
enumerated unsigned long (the values are specified by the order declared)
union type tag followed by the selected member
Instructors Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
Pearson Education 2005
C1'2A C$' messa!e
&he flattened form represents a Person struct with value: 34Smith, 45ondon, *0+46
03
47
811
1215
1619
20-23
2427
5
"Smit"
"h___"
6
"Lond"
"on__"
1934
index in
sequence of bytes 4 bytes
notes
on representation
length of string
Smith
length of string
London
unsigned long
Instructors Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
Pearson Education 2005
Indication of 7ava seriali8ed form
&he true seriali8ed form contains additional type mar(ers9 h: and h* are handles
Serialized values
Person
3
1934
8-byte version number
int year
5 Smith
java.lang.String
name:
6 London
h0
java.lang.String
place:
h1
Explanation
class name, version number
number, type and name of
instance variables
values of instance variables
Instructors Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
Pearson Education 2005
'epresentation of a remote o;<ect
reference
Internet address port number time object number
interface of
remote object
32 bits 32 bits 32 bits 32 bits
Instructors Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
Pearson Education 2005
'equestreply communication
'equest
Server Client
do1peration
=wait>
=continuation>
'eply
messa!e
!et'equest
e"ecute
method
messa!e
select o;<ect
send'eply
Instructors Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
Pearson Education 2005
'equestreply messa!e structure
messageType
requestId
objectReference
methodId
arguments
int (0=Request, 1= Reply)
int
RemoteObjectRef
int or Method
array of bytes
Instructors Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
Pearson Education 2005
'%C e"chan!e protocols

R
Request
RR Reply
RRA Acknowledge reply
Request
Request Reply
Client
Server Client
Name Messages sent by
Instructors Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
Pearson Education 2005
?&&% request messa!e
GET //www.dcs.qmw.ac.uk/index.html HTTP/ 1.1
URL or pathname method HTTP version headers message body
Instructors Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
Pearson Education 2005
?&&% reply messa!e
HTTP/1.1 200 OK resource data
HTTP version status code reason headers message body
Instructors Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
Pearson Education 2005
Soc(ets used for data!rams
ServerAddress and ClientAddress are soc(et addresses
Sendin! a messa!e 'eceivin! a messa!e
;ind=s, ClientAddress>
sendto=s, @messa!e@, ServerAddress>
;ind=s, ServerAddress>
amount ) recvfrom=s, ;uffer, from>
s ) soc(et=AABICD&, S1CEB$F'AM, :>
s ) soc(et=AABICD&, S1CEB$F'AM, :>
Instructors Guide for Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edn. 4
Pearson Education 2005
Soc(ets used for streams
'equestin! a connection 5istenin! and acceptin! a connection
;ind=s, ServerAddress>9
listen=s,G>9
sCew ) accept=s, ClientAddress>9
n ) read=sCew, ;uffer, amount>
s ) soc(et=AABICD&, S1CEBS&'DAM,:>
connect=s, ServerAddress>
write=s, @messa!e@, len!th>
s ) soc(et=AABICD&, S1CEBS&'DAM,:>
ServerAddress and ClientAddress are soc(et addresses

Vous aimerez peut-être aussi