/
Chapter 2: Communications Chapter 2: Communications

Chapter 2: Communications - PowerPoint Presentation

lindy-dunigan
lindy-dunigan . @lindy-dunigan
Follow
380 views
Uploaded On 2016-05-28

Chapter 2: Communications - PPT Presentation

STIJ5014 Distributed Systems Contents Introduction Communication Protocols External Data Representation and Marshalling Clientserver Communication Group Communication Introduction Introduction ID: 338564

representation data external communication data representation communication external xml multicast group middleware client server xsd object java person pers

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Chapter 2: Communications" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

Chapter 2: Communications

STIJ5014 – Distributed SystemsSlide2

Contents

IntroductionCommunication Protocols

External Data Representation and Marshalling

Client/server Communication

Group CommunicationSlide3

IntroductionSlide4

Introduction

Open System Interconnection (OSI) Reference Model

Created by International Organization for Standardization (ISO)

Encourage the development of protocol standards that would meet the requirements of

open systems

Review of the basic concepts in networking

TCP/IP Model

Transmission

Control Protocol (

TCP)/Internet

Protocol (IP) 

Network

standards that define the Internet

8 challenges in developing distributed systems (Chapter 1):

Heterogeneity

Openness

Security

Scalability

Failure handling

Concurrency

Transparency

Quality of

serviceSlide5
Slide6

Communication Protocols

Message passing

a

form of communication between objects, processes or other resources used in 

distributed computing

2 types of message passing

Synchronous

both send and receive are blocking operations

Asynchronous

send operation is non-blocking

How computers communicate?

« »

SendReceiveProcess 1/Process 2/Slide7

Communication Protocols

Communications among processes are accomplished between portsA computer has 2

16

possible ports

Each port correspond to a single receiving process, however a process may involve more than one ports

Ports require a software abstraction to run processes that is called sockets

Message are sent between a pair of sockets

Each socket is associated with a transport protocol that is either TCP or UDP

Port

SocketSlide8
Slide9

Communication Protocols

message

agreed port

any port

socket

socket

IP address = 138.37.88.249

IP address = 138.37.94.248

other ports

client

server

Sockets and portsSlide10

Communication Protocols

Socket Programming

Most programming languages provide socket programming supports

E.g., Java, C++, C, Python,

Tutorial:

https

://

www.youtube.com/watch?v=aEDV0WlwXTs

http://www.tutorialspoint.com/java/java_networking.htmSlide11

Communication ProtocolsSlide12

Communication ProtocolsSlide13

External Data Representation and MarshallingSlide14

External Data Representation

How data are represented and how they are transferred? Slide15

External Data Representation

An

agreed standard for the representation of data structures and primitive

values

Allows

data to be transferred between different kinds of computer systems

D

ata

structure must be converted to a sequence of bytes before transmission and rebuilt on

arrival

How data are

converted into an acceptable form?

8 challenges in developing distributed systems (Chapter 1):HeterogeneityOpennessSecurityScalabilityFailure handlingConcurrencyTransparencyQuality of serviceSlide16

External Data Representation

Marshalling/Encoding

The process of taking a collection of data items and assembling them into a form suitable for transmission in a message

3 approaches to external data representation:

CORBA CDR

Java Object Serialization

XML

Unmarshalling

/Decoding

the process of disassembling a collection of data on arrival to produce an equivalent collection of data items at the destinationSlide17

External Data Representation

A transfer syntax that allows programs written in different programming languages work together in a client/server environment

Representation of structured/primitive data types during remote invocation of objects in CORBA.

CORBA Common Data Representation (CDR)

For more information on CORBA, see

http://

www.omg.org/gettingstarted/corbafaq.htmSlide18

External Data Representation

Short (16 bit)

Long (32 bit)

Unsigned short

Unsigned long

Float(32 bit)

Double(64 bit)

Char

Boolean(TRUE,FALSE)

Octet(8 bit)

Any(can represent any basic or constructed type)

CORBA Common Data Representation (CDR)

Primitive

types

Sequence

String

Array

Struct

Enumerated

union

Composite

typesSlide19

External Data Representation

Example

:

struct

with value {‘Smith’, ‘London’, 1934}

CORBA Common Data Representation (CDR)Slide20

External Data Representation

A mechanism where

an object can be represented as a sequence of bytes that includes the object's data as well as information about the object's type and the types of data stored in the

object

Tutorial on Java Object Serialization

http

://www.tutorialspoint.com/java/java_serialization.htm

Java Object Serialization

Serialization

is the activity of flattening object or a related set of objects in a serial form suitable for transmitting in a message.

Deserialization

is the activity of restoring the state of an object or a set of objects from their serialized formSlide21

Example, the Java class equivalent to the Person

struct

(of CORBA CDR)

Public class Person implements Serializable {

Private String name;

Private String place;

Private

int

year;

Public Person(String

aName

,String

aPlace, int aYear) { name = aName; place = aPlace; year = aYear;}//followed by methods for accessing the instance variables}External Data Representation

Java Object SerializationSlide22

External Data

Representation

Java Object SerializationSlide23

External Data

Representation

Extensible Markup Language (XML)

XML is a mark up language that was defined by the WWW Consortium (W3C) for general use of web.

Mark

up language refers to a textual encoding that represents both a text and details as to its structure or its appearance

It is used to enable clients to communicate with web services and for defining the interfaces and other properties of web services.

XML data items are tagged with “markup” strings.

The tags are used to describe the logical structure of the data and to associate attribute-value pairs with logical structureSlide24

Extensible – users can define their own tags.

If a document is intended to be used by more than one application, the names of the tags must be agreed between them

Advantage

of XML

Binary data representation is not required

Disadvantage of XML

Longer processing time

Try writing XML -

www.w3schools.com/xml/default.asp

External Data

Representation

Extensible Markup Language (XML)Slide25

XML elements and attributes:

Element: a portion of character data surrounded by matching start and end tags

Attribute : a start tag may optionally include pairs of associated attribute name and values such as id=“123456789”

External Data

Representation

Extensible Markup Language (XML)

<person id="123456789">

<name>Smith</name>

<place>London</place>

<year>1984</year>

<!-- a comment -->

</person >Slide26

Parsing and well-formed documents

Well-formed documents – matching tags and nested

Example: <x>….<y>….</y>….</x>

Visit this website to develop and parse your own XML

http://www.xmlfiles.com/examples/tryit.asp?filename=note_parsertest

XML prolog

prolog must be written in the first line of a XML document

Example : <?xml version="1.0"?>

External Data

Representation

Extensible Markup Language (XML)Slide27

XML namespaces

A set of names for a collection of element types and attributes that is referenced by a URL. Any other XN documents can use an XML namespace by referring to its URL

External Data

Representation

Extensible Markup Language (XML)

<person

pers:id

="123456789"

xmlns:pers

= "

http://www.cdk5.net/person

">

<

pers:name

> Smith </

pers:name

>

<

pers:place

> London </

pers:place

>

<

pers:year

> 1984 </

pers:year

>

</person>Slide28

XML Schemas

Defines the elements and attributes that can appear in a document, how the elements are nested and the order and number of elements, and whether the element can empty or include text.

<

xsd:schema

xmlns:xsd

= URL of XML schema definitions >

<

xsd:element

name= "person" type ="

personType

" />

<xsd:complexType name="personType"> <xsd:sequence> <xsd:element name = "name" type="xs:string"/> <xsd:element name = "place" type="xs:string"/> <xsd:element name = "year" type="xs:positiveInteger"/> </xsd:sequence> <xsd:attribute name= "id" type = "

xs:positiveInteger

"/>

</

xsd:complexType

>

</

xsd:schema

>

External Data

Representation

Extensible Markup Language (XML)Slide29

Client/Server CommunicationSlide30

Client/Server Communications

Review of Chapter 1

Remote invocation in client/server communicationSlide31

Client/Server Communications

Review of Chapter 1

Remote invocation in client/server communication requires middleware

8 challenges in developing distributed systems (Chapter 1):

Heterogeneity

Openness

Security

Scalability

Failure handling

Concurrency

Transparency

Quality of

service

Middleware

Software

which allows an application to

interoperate

with other software, without requiring the user to understand and code the low-level operations required to achieve interoperabilitySlide32

Client/Server Communications

Middleware

Middleware

Client

Server

Remote invocation

Middleware provides support for (some of):

Naming, Location, Service discovery, Replication

Protocol handling, Communication faults,

QoS

Synchronisation, Concurrency, Transactions, Storage

Access control, AuthenticationSlide33

Client/Server Communications

Middleware

The earliest middleware is remote procedure call (RPC)

An

interprocess

communication (IPC) mechanism that enables data exchange and invocation of functionality residing in a different process

RPC ProcessesSlide34

Client/Server Communications

Types of Middleware

Middleware for Distributed Objects

Middleware for Distributed Components

Middleware for publish-subscribe systems

Middleware for Message Queues

Middleware for Web services

Middleware peer-to peerSlide35

Client/Server Communications

Database Middleware

ODBC

OLE-DB

JDBC

CORBA

DCOMSlide36

Group

CommunicationSlide37

Group Communication

Multicast

The

pairwise

exchange of messages is not the best model for a group communication

A

multicast operation

is more appropriate

Multicast operation

is an operation that sends a single message from one process to each of the members of a group of processes.

The simplest way of multicasting, provides no guarantees about message delivery or ordering. Slide38

Group Communication

Characteristics of Multicast

Fault tolerance based on replicated services

A replicated service consists of a group of servers.

Client requests are multicast to all the members of the group, each of which performs an identical operation.

Finding the discovery servers in spontaneous networking

Multicast messages can be used by servers and clients to locate available discovery services in order to register their interfaces or to look up the interfaces of other services in the distributed system. Slide39

Group Communication

Characteristics of Multicast

Better performance through replicated data

Data are replicated to increase the performance of a service.

Propagation of event notifications

Multicast to a group may be used to notify processes when something happens.Slide40

Group Communication

IP Multicast

IP multicast is built on top of the Internet protocol, IP.

IP multicast allows the sender to transmit a single IP packet to a

multicast group

.

A multicast group is specified by class D IP address for which first 4 bits are 1110 in IPv4.

The membership of a multicast group is dynamic.

A computer belongs to a multicast group if one or more processes have sockets that belong to the multicast group.Slide41

End of the Chapter