Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 2: Communications

Similar presentations


Presentation on theme: "Chapter 2: Communications"— Presentation transcript:

1 Chapter 2: Communications
STIJ5014 – Distributed Systems

2 Contents Introduction Communication Protocols
External Data Representation and Marshalling Client/server Communication Group Communication

3 Introduction

4 Introduction Review of the basic concepts in networking
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 8 challenges in developing distributed systems (Chapter 1): Heterogeneity Openness Security Scalability Failure handling Concurrency Transparency Quality of service TCP/IP Model Transmission Control Protocol (TCP)/Internet Protocol (IP)  Network standards that define the Internet

5

6 Communication Protocols
How computers communicate? « » 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 Process 1/ Process 2/ Synchronous message passing systems require the sender and receiver to wait for each other while transferring the message. In asynchronous communication the sender and receiver do not wait for each other and can carry on their own computations while transfer of messages is being done. Source: Message Passing Interface (MPI) Standards: Send Receive

7 Communication Protocols
Port Socket Communications among processes are accomplished between ports A computer has 216 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

8

9 Communication Protocols
Sockets and ports message agreed port any port socket IP address = IP address = other ports client server

10 Communication Protocols
Socket Programming Most programming languages provide socket programming supports E.g., Java, C++, C, Python, Tutorial: XTs rking.htm

11 Communication Protocols

12 Communication Protocols

13 External Data Representation and Marshalling

14 External Data Representation
How data are represented and how they are transferred?

15 External Data Representation
How data are converted into an acceptable form? An agreed standard for the representation of data structures and primitive values Allows data to be transferred between different kinds of computer systems Data structure must be converted to a sequence of bytes before transmission and rebuilt on arrival 8 challenges in developing distributed systems (Chapter 1): Heterogeneity Openness Security Scalability Failure handling Concurrency Transparency Quality of service

16 External Data Representation
3 approaches to external data representation: CORBA CDR Java Object Serialization XML Marshalling/Encoding The process of taking a collection of data items and assembling them into a form suitable for transmission in a message Unmarshalling/Decoding the process of disassembling a collection of data on arrival to produce an equivalent collection of data items at the destination

17 External Data Representation
CORBA Common Data Representation (CDR) 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. What is Common Object Request Broker Architecture (CORBA) See For more information on CORBA, see

18 External Data Representation
CORBA Common Data Representation (CDR) 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) Primitive types Composite types Sequence String Array Struct Enumerated union

19 External Data Representation
CORBA Common Data Representation (CDR) Example: struct with value {‘Smith’, ‘London’, 1934}

20 External Data Representation
Java Object Serialization 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 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 form

21 External Data Representation
Java Object Serialization 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

22 External Data Representation
Java Object Serialization

23 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 structure

24 External Data Representation
Extensible Markup Language (XML) 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 -

25 External Data Representation
Extensible Markup Language (XML) 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=“ ” <person id=" "> <name>Smith</name> <place>London</place> <year>1984</year> <!-- a comment --> </person >

26 External Data Representation
Extensible Markup Language (XML) 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 ertest XML prolog prolog must be written in the first line of a XML document Example : <?xml version="1.0"?>

27 External Data Representation
Extensible Markup Language (XML) 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 <person pers:id=" " xmlns:pers = " <pers:name> Smith </pers:name> <pers:place> London </pers:place > <pers:year> 1984 </pers:year> </person>

28 External Data Representation
Extensible Markup Language (XML) 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>

29 Client/Server Communication

30 Client/Server Communications
Review of Chapter 1 Remote invocation in client/server communication

31 Client/Server Communications
Review of Chapter 1 8 challenges in developing distributed systems (Chapter 1): Heterogeneity Openness Security Scalability Failure handling Concurrency Transparency Quality of service Remote invocation in client/server communication requires middleware 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 interoperability

32 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, Authentication

33 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 Processes

34 Client/Server Communications
Types of Middleware Middleware for Distributed Objects Middleware for Message Queues Middleware for Distributed Components Middleware for Web services Middleware for publish-subscribe systems Middleware peer-to peer

35 Client/Server Communications
Database Middleware ODBC CORBA OLE-DB DCOM JDBC

36 Group Communication

37 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.

38 Group Communication Fault tolerance based on replicated services
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.

39 Group Communication Better performance through replicated data
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.

40 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. Please check out the following videos on Multicast:

41 End of the Chapter


Download ppt "Chapter 2: Communications"

Similar presentations


Ads by Google