Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Interprocess Communications
-
unicast
4
...
m u ltic ast
P ro c ess 1
P ro c ess 2
d a ta
sender
5
r e c e iv e r
S1
S3
H TTP
re qu e st
a proce ss
a n o p e ra tio n
d a ta flo w
S 4
H TTP
re spon se
C 1
C 2
C 3
C 4
o p e ra tio n s:
S 1 : a cce p t co n n e ctio n
S 2 : re ce ive (re q u e st)
S 3 : se n d (re sp o n s e )
Ss43 : d i s c o n n e c t
C 1 : m a k e co n n e ctio n
C 2 : se n d (re q u e st)
C 3 : re ce ive (re sp o n se )
C 4 : disco n n e ct
W e b brow se r
Event Synchronization
Interprocess
process 2
running o n ho st 2
Event Diagram
b lo c k in g r e c e iv e s t a r t s
b lo c k in g s e n d s t a r t s
a n o p e r a t io n
e x e c u t io n f lo w
b lo c k in g s e n d r e t u r n s
a c k n o w le d g e m e n t o f d a t a r e c e iv e d
p r o v id e d b y t h e I P C f a c ilit y
s u s p e n d e d p e r io d
b lo c k in g r e c e iv e e n d s
10
Client
Sender
Server
Receiver
Event Diagram
P ro cess 1
b lo c k in g r e c e iv e s t a r t s
n o n b lo c k in g s e n d
o p e r a t io n
e x e c u t io n f lo w
s u s p e n d e d p e r io d
b lo c k in g r e c e iv e r e t u r n s
11
Client
Sender
Server
Receiver
b lo c k in g s e n d is s u e d
t r a n s p a r e n t a c k n o w le d g e m e n t
p r o v id e d b y t h e I P C f a c ilit y
n o n b lo c k in g r e c e iv e is s u e d
e x e c u t io n f lo w
s u s p e n d e d p e r io d
12
n o n b lo c k in g r e c e iv e is s u e d
a n d r e t u r n e d im m e d ia t e ly
b lo c k in g s e n d is s u e d
in d e f in it e
b lo c k in g
e x e c u t io n f lo w
s u s p e n d e d p e r io d
P ro cess 2
P rocess 1
13
n o n b lo c k in g r e c e iv e is s u e d
a n d r e t u r n e d im m e d ia t e ly
b lo c k in g s e n d is s u e d
t r a n s p a r e n t a c k n o w le d g e m e n t
p r o v id e d b y t h e I P C f a c ilit y
p r o c e s s is n o t if ie d
o f t h e a r r iv a l o f
d a ta
e x e c u t io n f lo w
s u s p e n d e d p e r io d
14
n o n b lo c k in g r e c e iv e is s u e d
a n d r e t u r n e d im m e d ia t e ly
b lo c k in g s e n d is s u e d
p r o c e s s is n o t if ie d
o f t h e a r r iv a l o f
d a ta
e x e c u t io n f lo w
s u s p e n d e d p e r io d
15
Event diagram
Proce ss B
P roce ss A
t im e
req u est 1
resp o n se 1
req u est 2
in t e r p r o c e s s c o m m u n ic a t io n
e x e c u t io n f lo w
p r o c e s s b lo c k e d
resp o n se2
E v e n t d i a g r a m fo r a p r o t o c o l
16
17
m a in t h r e a d
new
m a in t h r e a d c o n t in u e s w it h
o t h e r p r o c e s s in g
t h r e a d is s u e s a b lo c k in g I P C o p e r a t io n
t h r e a d is b lo c k e d
t h r e a d is u n b lo c k e d a f t e r t h e o p e r a t io n is f u lf ille d
18
19
P roce ss 2
" r e c e iv e fr o m p r o c e s s 2 " is s u e d ;
p r o c e s s 1 b lo c k e d p e n d in g d a ta
fro m pro ce ss 2 .
a n o p e ra tio n
" r e c e iv e f r o m p r o c e s s 1 " is s u e d ;
p r o c e s s 2 b lo c k e d p e n d in g d a ta
fro m pro ce ss 1 .
proce ss
e x e cu tin g
proce ss
blo ck e d
20
Data Representation
21
d a t a e n c o d in g s c h e m e s
a p p lic a tio n s p e c if ic d a ta e n c o d in g la n g u a g e
g e n e r a l d a ta e n c o d in g la n g u a g e
n e tw o r k d a ta e n c o d in g s ta n d a r d
22
S a m p le S t a n d a r d s
X M L :( E x te n s ib le M a r k u p L a n g u a g e )
A S N .1 ( A b s tr a c t S y n ta x N o ta tio n )
S u n X D R ( E x te r n a l D a ta R e p r e s e n ta tio n )
http://java.sun.com/xml/docs/tutorial/overview/1_xml.html#intro
23
</message>
Data Marshalling
" T h is i s a t e s t . "
1 .2
7 .3
-1 .5
m a rsh a llin g
host A
1 . f la t t e n i n g o f s t r u c t u r e d d a t a i t e m s
2 . c o n v e r t in g d a t a t o e x t e r n a l ( n e t w o r k )
r e p r e s e n t a t io n
1 1 0 0 1 1 ... 1 0 0 0 0 1 0 0 ...
u n m a rsh a llin g
" T h is is a t e s t . "
-1 .5
7 .3
1 .2
24
host B
1 . c o n v e r t d a t a t o in t e r n a l r e p r e s e n t a t i o n
2 . r e b u il d d a t a s t r u c t u r e s .
E x t e r n a l t o in t e r n a l r e p r e s e n t a t io n a n d v ic e v e r s a
is n o t r e q u ir e d
- if t h e t w o s id e s a r e o f t h e s a m e h o s t t y p e ;
- if t h e t w o s id e s n e g o t ia t e s a t c o n n e c t io n .
a p p lic a t io n la y e r
p r e s e n t a t io n la y e r
p r e s e n t a t io n la y e r
s e s s io n la y e r
25
Message
s e s s io n la y e r
t r a n s p o r t la y e r
Segment
t r a n s p o r t la y e r
n e t w o r k la y e r
Datagram
n e t w o r k la y e r
d a t a lin k la y e r
Frame
d a t a lin k la y e r
p h y s ic a l la y e r
0/1
p h y s ic a l la y e r
Text-based protocols
26
Event diagram
P roce ss 2
P roce ss 1
t im e
req u est 1
resp o n se 1
request 2
in t e r p r o c e s s c o m m u n ic a t io n
e x e c u t io n f lo w
p r o c e s s b lo c k e d
resp o n se2
E v e n t d i a g r a m fo r a p r o t o c o l
27
w eb b ro w ser
req u est
resp o n se
28
r e q u e s t is a m e s s a g e in 3 p a r t s :
- < c o m m a n d > < d o c u m e n t a d d d r e s s > < H T T P v e r s io n >
- a n o p t io n a l h e a d e r
- o p t io n a l d a t a f o r C G I d a t a u s in g p o s t m e t h o d
r e s p o n s e is a m e s s a g e c o n s is t in g o f 3 p a r t s :
- a s t a t u s lin e o f t h e f o r m a t < p r o t o c o l> < s t a t u s c o d e > < d e s c r ip t io n >
- h e a d e r in f o r m a t io n , w h ic h m a y s p a n s e v e r a l lin e s ;
- t h e d o c u m e n t it s e lf .
Sequence Diagram
Process A
P roce ss B
req u est 1
resp o n se 1
req u est 2
in t e r p r o c e s s c o m m u n ic a t io n
resp o n se 2
29
P roce ss B
req u est 1
resp o n se 1
req u est 2
in t e r p r o c e s s c o m m u n ic a t io n
resp o n se 2
30
Protocol
In a distributed application, two processes perform
interprocess communication in a mutually agreed
upon protocol.
The specification of a protocol should include
(i) the sequence of data exchange, which can be
described using a time event diagram.
(ii) the format of the data exchange at each step.
31
32
w eb b ro w ser
req u est
resp on se
r e q u e s t is a m e s s a g e in 3 p a r t s :
- < c o m m a n d > < d o c u m e n t a d d d r e s s > < H T T P v e r s io n >
- a n o p t io n a l h e a d e r
- o p t io n a l d a t a f o r C G I d a t a u s in g p o s t m e t h o d
r e s p o n s e is a m e s s a g e c o n s is t in g o f 3 p a r t s :
- a s t a t u s lin e o f t h e f o r m a t < p r o t o c o l> < s t a t u s c o d e > < d e s c r ip t io n >
- h e a d e r in f o r m a t io n , w h ic h m a y s p a n s e v e r a l lin e s ;
- t h e d o c u m e n t it s e lf .
W e w ill e x p lo r e H T T P in d e t a ils la t e r t h is q u a r t e r .
33
34
HTTP Request
HTTP response status line
HTTP response header
document content
HTTP Session
1. Telnet to your favorite Web server:
unix> telnet ise.gmu.edu 80
Opens a TCP connection to port 80 at ise.gmu.edu.
(default HTTP server port)
Type above commands and hit carriage return twice, you send this
minimal but complete GET request to HTTP server
le v e l o f
a b s tr a c tio n
I P C p a r a d ig m s
r e m o te p ro c e d u re /m e th o d
socket API
d a t a t r a n s m is s io n
36
E x a m p le I P C I m p le m e n t a tio n s
R e m o t e P r o c e d u r e C a ll ( R P C ) , J a v a R M I
U n ix s o c k e t A P I , W in s o c k
s e r ia l/ p a r a lle l c o m m u n ic a t io n