Distributed Computing UnitII
Distributed Computing UnitII
COMMUNICATION IN DISTRIBUTED
SYSTEM
38System Outlin
models2.1 e
2 System models
1. Outline
What are the three basic ways to describe Distributed systems? –
• Physical models – consider DS in terms of hardware – computers and devices that constitute a
system and their interconnectivity, without details of specific technologies
• Fundamental models – take an abstract Difficulties and threats for distributed systems:
perspective in order to describe solutions to
individual issues faced by most distributed • Widely varying modes of use
systems
• Wide range of system environments
– interaction models
• Internal problems
– failure models
– security models • External threats
39System models2.2 Physical
models
2.2 Physical models
•Baseline physical model – minimal physical model of a distributed system as
an extensible set of computer nodes interconnected by a computer network
for the required passing of messages.
– mobile computing
* laptops or smart phones may move from location to location –
need for added capabilities (service discovery; support for
spontaneous interoperation)
– ubiquitous computing
* computers are embedded everywhere
– cloud computing
41System Physical
models2.2 models
* pools of nodes that together provide a given service
•What are the entities that are communicating in the distributed system?
– objects
* computation consists of a number of interacting objects
representing natural units of decomposition for the given problem
domain
* Objects are accessed via interfaces, with an associated interface
defi- nition language (or IDL)
45System models2.3 Architectural
Models
– web services
* closely related to objects and components
* intrinsically integrated into the World Wide Web
·using web standards to represent and discover services
46System Architectural
models2.3 Models
The World Wide Web consortium
(W3C):
Web service is a software application identified by a URI, whose interfaces
and bindings are capable of being defined, described and discovered as
XML artefacts. A Web service supports direct interactions with other
software agents using XML-based message exchanges via Internet-based
protocols.
•objects and components are often used within an organization to develop
tightly coupled applications
•web services are generally viewed as complete services in their own right
47System Architectural
models2.3 Models
Communication paradigms
What is:
•interprocess communication?
•remote invocation?
•indirect communication?
•senders-receivers of messages
Indirect communication
•Senders do not need to know who they are sending to ( space uncoupling)
•Senders and receivers do not need to exist at the same time ( time
uncoupling)
•Group communication
•Publish-subscribe systems:
50System models2.3 Architectural
Models
•Message queues:
communication paradigms
53System Architectural
models2.3 Models
Roles and responibilities
•Client-server
Figure 2.3 Clients invoke individual
servers
54System Architectural
models2.3 Models
•Peer-to-peer
Figure 2.4a Peer-to-peer
architecture
Layering
•given layer making use of the services offered by the layer below
•software abstraction
•presentation logic
•application logic
•data logic
Architectural
Models
Figure 2.8 Two-tier and three-tier • three aspects par-
63System models2.3
architectures titioned into two
processes
• proxy pattern
• Reflection pattern
What is:
•Interaction model?
•Failure model?
•Security model?
1. Interaction model
• clock drift rate – rate at which a computer clock deviates from a perfect
refer- ence clock
74System Fundamental
models2.4 models
Two variants of the interaction
model
Omission failures
– crash is called fail-stop if other processes can detect certainly that the
77System Fundamental
models2.4 models
Communication omission failures
•communication channel does not transport a message p’s outgoing
from message buffer to q’s incoming message buffer
Arbitrary failures
arbitrary or Byzantine failure is used to describe the worst possible failure
se-
mantics, in which any type of error may
occur Figure 2.15 Omission and
arbitrary failures
79System Fundamental
models2.4 models
Timing failures
Masking failures
•knowledge of the failure can enable a new service to be designed to mask the
failure of the components on which it depends
80System Fundamental
models2.4 models
Reliability of one-to-one communication
•reliable communication:
•association of each invocation and each result with the authority on which it
is issued
The enemy
or also: adversary
Figure 2.18 The enemy
84System Fundamental
models2.4 models
Threats to processes
Authentication
•Each of the processes knows reliably the identity of the principal on whose
behalf the other process is executing
•Denial of service:
•Mobile code:
End of week 2
144Interprocess Introductio
communication4.1 n
4 Interprocess communication
4.1 Introduction
Figure 4.1 Middleware layers
How middleware and application programs can use UDP and TCP?
What is specific about IP multicast? Why/how could it be made more
reliable? What is an overlay network?
What is MPI?
145Interprocess The API for the Internet
communication4.2 protocols
2. The API for the Internet protocols
4.2.2 Sockets
socket – abstraction providing an endpoint for communication
betwee
Figure 4.2 Sockets and
ports
147Interprocess The API for the Internet
communication4.2 protocols
Java API for Internet addresses
•create a socket bound to an Internet address of the local host and a local port
•The receive method returns the Internet address and port of the sender, in
addi- tion to the message (allowing the recipient to send a reply)
148Interprocess communication4.2 The API for the Internet
Blocking:
Timeouts:
•if needed, should be fairly large in comparison with the time for message
transmission
•Omission failures
•Ordering
Use of UDP
methods get-
•Data, getPort
Class and getAddress
– supports sockets for sending
DatagramSocket
•Message sizes
•Lost messages
•Flow control
•Message destinations
•Blocking –
Failure model
•integrity
157Interprocess The API for the Internet
communication4.2 protocols
– checksums
– sequence numbers
•validity
– timeouts
– retransmission
Use of TCP
HTTP, FTP, Telnet, SMTP
Class Socket:
•for use by pair of processes
•methods:
✞ ☎
importjava . net . * ;
importjava . i o . * ;
Figure 4.6 TCP
{ server makes a connection for each
p u b l i cc l a s sTCPServer
p u b l i cs t a t i
( S t r i n gargs [ ] ) {
client and then echoes the client’s request
cvoidmain try {
i n ts e r v e r Po r t = 7896 ;
Server Socketl i s t e n S o c k e = newServer Socket ( s e r v e r Po r t )
t while ( t ru e ) { ;
Socketc l i e n t S o c k e t = l i s t e n S o c k e t . a c c e p t ( )
;
} Connectionc = newConnection ( c l i e n t S o c k e t )
;
} catch ( IOExceptione ) { System . out . p r i n t l n ( "Li s t e :" +e . get Message ( ) ) ;
} n }
}
clas {
sConnectionextendsThread
Data Input Streamin ;
DataOutputStreamout ;
p u b l i cConnection
Socketc l i e n t S o c k e t ( Socketa
; ClientSocket )
{
try {
clientSocket = aClientSocket ;
161Interprocess communication4.2 The API for the Internet
in = newData Input Stream ( c l i e n t S o c k e t . get Input Stream ( ) ) ;
out =newDataOutputStream ( c l i e n t S o c k e t . get Output Stream ( ) ) ;
protocols
this . start () ;
} catch ( IOExceptione ) { System . out . p r i n t l n ( "Connection:" +e . get Message ( ) ) ;
} }
p u b l i cvoidrun () {
try { / /anechos e r v e r
S t r i n gdata = in . readUTF ( )
o; ut . writeUTF ( data ) ;
} catch ( EOFExceptione ) { System . out . p r i n t l n ( "EOF:" +e . get Message ( ) ) ;
} catch ( IOExceptione ) { System . out . p r i n t l n ( "IO:" +e . get Message ( ) ) ; }
} f i n a l l y { t r y { c l i e n t S o c k e t . c l o s e ( ) ; } catch ( IOExceptione ) { / * c l o s ef a i l e d * /
}}
} }
✝
162Interprocess communication4.3 External data representation and
marshalling
4.3 External data representation and marshalling
•messages ←−
⇒ either:
a) convert data to agreed external format, or
b) transmit data in sender’s format + format used – recipient converts the values if
needed
external data representation: agreed standard for the representation of data struc-
tures and primitive values
163Interprocess communication4.3 External data representation and
marshalling
marshalling: process of taking a collection of data items and assembling them into
a form suitable for transmission in a message
marshalling CORBA CDR that contains the three fields of a struct whose
•http://www.cdk5.net/ipc
167Interprocess External data representation and
communication4.3 marshalling
4.3.2
✞ Java object ☎
serialization
p u b l i cc l a s sPersonimplementsS e r i a l i z a b l e {
p r i v a t eS t r i n gname
;
;
p r i v a t eS t ri n gp l a c e
p u b l i cPerson ( S t ri n gaName , S t ri n gaPlace , i n taYear ) {
p r i v a t ei n ty ear ;
name = aName ;
p l a c e = a Place ;
year = aYear ;
}
/ /f o l l o w e dbymethodsf o ra c c e s s i n gt h ei n s t a n c ev a r i a b l e s
}
✝
•deserialize:
Reflection -– the ability to enquire about the properties of a class, such as the
names and types of its instance variables and methods
SOAP – XML format whose tags are published for use by web services and their
clients
XML elements and attributes
Figure 4.10 XML definition of the Person
✞ ☎
structure
< personid ="123456789" >
<name>Smith </ name>
< place >London </ place
>
<year >1984 </ year >
</ person > <!−− acomment −−>
✝
•An empty tag – no content and is terminated with /> instead of >
✞ •For example: ☎
xmlns : pers = "http: /
✝/www.cdk5.net/person"
Java, CORBA
notifications
IP multicast
177Interprocess Multicast
communication4.4 communication
•group specified by a Class D Internet address
•membership dynamic
•At the application programming level, IP multicast available only via UDP
•Multicast routers
178Interprocess Multicast
communication4.4 communication
Multicast address allocation:
• ureliable multicast
179Interprocess Multicast
communication4.4 communication
Java API to IP
multicast
Figure 4.14 Multicast peer joins a group and sends and receives
datagrams ☎
✞importjava . net . * ;
importjava . i o . * ;
p u b l i cc l a s sM u l t i c a s t Pe e {
r p u b l i cs t a t i ( S t r i n gargs [ ] ) {
cvoidmain
/ /a rgsg i v emessagec o n t e n t s&d e s t i n a t i o nm u l t i c a s tgroup(e.g." 2 2 8 . 5 . 6 . 7 " )
M u l t i c a s t S o c k e ts = n u l l ;
try {
Inet Addressgroup = Inet Address . getByName ( args [ 1 ] ) ;
s = newM u l t i c a s t S o c k e t ( 6 7 8 9 ) ;
s . join Group ( group ) ;
byte [ ] m = args [ 0 ] . g e t B y t e s ( ) ;
DatagramPacketmessageOut =
newDatagramPacket (m, m. l ength , group , 6789 ) ;
s . send ( messageOut ) ;
byte [ ] b u f f e r = newbyte [ 1 0 0 0 ] ;
f o r ( i n ti = 0 ; i < 3 ; i ++) { / /g e tmessagesfromo t h e r si ngroup
DatagramPacketmessage In =
newDatagramPacket ( buffer , b u f f e r . l e n g t h ) ;
s . r e c e i v e ( message In ) ;
System . out . p r i n t l n ( "Received:" + newS t r i n g ( message In . get Data ( ) )
);
180Interprocess communication4.4 Multicast
communication
}
s . leave Group ( group ) ;
} catch ( Socket Exceptione ) { System . out . p r i n t l n ( "Socket: " + e . get Message ( ) ) ;
} catch ( IOExceptione ) { System . out . p r i n t l n ( "IO: " + e . get Message ( ) ) ;
} f i n a l l y { i f ( s != n u l l ) s . c l o s e ( ) ; }
}
✝ }
End of week
4
181Interprocess communication4.5 Network virtualization: Overlay
networks
4.5 Network virtualization: Overlay networks
Network virtualization – construction of many different virtual networks over an
existing network
•each virtual network redefines its own addressing scheme, protocols, routing
algorithms – depending on particular application on top
182Interprocess Network virtualization: Overlay
communication4.5 networks
1. Overlay networks
overlay network – virtual network consisting of nodes and virtual links, which
sits on top of an underlying network (such as an IP network) and offers
something that is not otherwise provided:
Network virtualization:
Overlay networks
184Interprocess Network virtualization: Overlay
communication4.5 networks
Figure 4.15 Types of overlay
(Continued)
185Interprocess Network virtualization: Overlay
communication4.5 networks
•Advantages:
•Disadvantages:
Skype architecture
•hosts and super nodes (which being selected on
Voice connection
•TCP for signalling call requests and terminations and either UDP or TCP for
the streaming audio
188Interprocess communication4.5 Network virtualization: Overlay
networks
– UDP is preferred
– TCP can be used in certain circumstances to circumvent firewalls
189Interprocess communication4.6 Case study:
MPI
4.6 Case study: MPI
MPI as STANDARD
Goals of the MPI standard MPI’s prime goals are:
190Interprocess Case study:
communication4.6 MPI
•To provide source-code portability
•To allow efficient