Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 71

CHAPTER-TWO

COMMUNICATION
Introduction
 Why communication in distributed systems? because
there is no shared memory
 Two communicating processes must agree on the syntax
and semantics of messages.
 A protocol is a set of rules that governs data communications
 A protocol defines what is communicated, how it is
communicated, and when it is communicated.
 Protocols are sets of instructions designed and coded
by programmers.
 The key elements of a protocol are syntax,
semantics, and timing
Cont…
 Syntax: refers to the structure or format of the data
 Semantics: refers to the meaning of each section of
bits.
 Timing: refers to when data should be sent and how
fast.
 Computer networks are created by different entities.
 Standards are needed so that these heterogeneous
networks can communicate with one another.
 The two best-known standards are the OSI model and
the TCP/IP model.
The OSI Model
 It was developed by the International Organization for
Standardization (ISO).
 It is a model for a computer protocol architecture
and as a framework for developing protocol
standards.
 An ISO standard that covers all aspects of network
communications is the Open Systems Interconnection
(OSI) model.
 Comprises of seven layers

4
Advantages of OSI

 Network communication is broken into smaller,


more manageable parts.
 Allows different types of network hardware and
software to communicate with each other.
 All layers are independent and changes does not
affect other layers.
 Easier to understand network communication.

5
Why layered communication?
 To reduce complexity of communication task by
splitting it into several layered small tasks
 Assists in protocol design
 Foster competition
 Changes in one layer do not affect other layers
 provides a common language

6
Summary of OSI Layers

7
LAYER 7: APPLICATION
 The application layer is responsible for providing
services to the user.
 Closest to the user and provides user interfaces
 Establishes the availability of intended communication
partners.
 Examples of Application layer protocols are:
Telnet, SMTP, FTP, SNMP, HTTP, DNS, DHCP

8
LAYER 6: PRESENTATION

 Presentation layer is concerned with the syntax and semantics of


the information exchanged between two systems
 Presentation layer serves as a translator.
 This layer is primarily responsible for the translation, encryption
and compression of data
 Defines coding and conversion functions

 Thislayer also manages security issues by providing services


such as data encryption and data compression
 Examples of these formats and schemes are: MPEG, QuickTime,
ASCII, EBCDIC, GIF, TIFF, JPEG
 Forexample, the popular audio format MP3uses MPEG
compression.
9
LAYER 5: SESSION

 The session layer defines how to start, control and end


conversations (called sessions) between applications
 Establishes dialog control between the two computers in a
session, regulating which side transmits, plus when and how
long it transmits (Full duplex)
 Synchronization: Allows processes to add check points. E.g.
Insert check point at every 100 pages of 2000 pages file to
ensure that each 100-page unit is received & acknowledged.

10
LAYER 4: TRANSPORT
 It regulates information flow to ensure process-to- process
connectivity between host applications reliably and
accurately
 Adds service point address or Port address
 Segmentation & Re-assembly: SEGMENTS data from
sending node and reassembles data on receiving node
 Flow control / Error control at Source to destination
level
 Connection oriented transport service ensures that data is
delivered error free, in sequence with no losses or
duplications
 Establishes, maintains and terminates virtual circuits
11
Transport Layer Cont…
 Connection oriented / Connectionless:
 TCP (Reliable,provides guaranteed delivery),
 UDP (Unreliable, less overhead, reliability can be
provided by the Application layer)
 Provides multiplexing: the support of different flows of
data to different applications on the same host

12
Transport Layer Cont…
 Transmission Control Protocol (TCP)
 TCP is a connection-oriented sub protocol, which means that a
connection must be established between communicating nodes
before this protocol will transmit data.
 TCP further ensures reliable data delivery through sequencing and
checksums.
 It takes large blocks of information from an application and breaks
them into segments.
 It numbers and sequences each segment to keep the order
the application intended.
 After these segments are sent on the transmitting host, TCP
waits for an acknowledgment of the receiving end’s.
 Retransmitting any segments that aren’t acknowledged.
Transport Layer Cont…
 It is Connection oriented means that a virtual
connection is established before any user data is
transferred.
 TCP can also recognize duplicate messages and will
discard them appropriately.
 If the sending computer is transmitting too fast for the
receiving computer, TCP can employ flow control
mechanisms to slow data transfer.
 TCP can also communicates delivery information to the
upper-layer protocols and applications it supports.
 All these characteristics makes TCP an end-to-end reliable
transport protocol.
Transport Layer Cont…
 Fig: Establishing a TCP connection
Transport Layer Cont…
 User Datagram Protocol(UDP)
 User Datagram Protocol (UDP) is basically the scaled-down
economy model of TCP, which is why UDP is sometimes referred to
as a thin protocol.
 Like a thin person , a thin protocol doesn’t take up a lot of room—or
in this case, require much bandwidth on a network.
 UDP does not sequence the segments and does not care about the
order in which the segments arrive at the destination.
 UDP just sends the segments off and forgets about them.
 UDP is a connectionless transport service.
 In other words, UDP offers no assurance that packets will be
received in the correct sequence.
 In fact, this protocol does not guarantee that the packets will be
received at all.
Transport Layer Cont…
 It doesn’t follow segments, check up on them, or even
allow for an acknowledgment of safe arrival. Because of
this, it’s referred to as an unreliable protocol.
 This does not mean that UDP is ineffective, only that it
doesn’t deal with reliability issues at all.
 Furthermore, UDP doesn’t create a virtual circuit or
doesn’t contact the destination before delivering
information to it.
- Because of this, it’s also considered a connectionless
protocol.
Transport Layer Cont…
LAYER 3: NETWORK
 Defines source to destination delivery of packets across
Networks.
 Defines logical addressing and best path determination.
 Treat each packet independently
 Defines how routing works and how routes are learned
 Converts frames to packets
 Routed protocols ( encapsulate data into packets) and
Routing protocols (create routing tables) work on this layer
 Examples of Routed protocols are: IP,
 Routers operate at Layer 3.

19
NETWORK Layer Cont…
 Internet Protocol (IP)
 Used for data communication in packet switched
network
 It belongs to the Network layer of the OSI model.
 It provides information about how and where data
should be delivered, including the data’s source and
destination addresses.
 IP is an unreliable, connectionless protocol, which
means that it does not guarantee delivery of data.
However, use IP to ensure that data packets are delivered
to the right addresses.
NETWORK Layer Cont…
 ARP (Address Resolution Protocol)
 ARP (Address Resolution Protocol) is a Network layer protocol that
obtains the MAC (physical) address of a host, or node, and then
creates a database that maps the MAC address to the host’s IP
(logical) address.
 RARP (Reverse Address Resolution Protocol)
 If a device doesn’t know its own IP address, it cannot use ARP.
 This is because without an IP address, a device cannot issue an ARP
request or receive an ARP reply.
 One solution to this problem is to allow the client to send a broadcast
message with its MAC address and receive an IP address in reply.
 This process, which is the reverse of ARP, is made possible by RARP
(Reverse Address Resolution Protocol).
 Finding logical address from physical address
NETWORK Layer Cont…
 Example of ARP broad cast:
Network Layer Cont…
 IP Address:

 It is a numeric identifier assigned to each machine on a network.


 Allows a host on one network to communicate with a host on a different
network.
 IP address – is a famous layer 3 address.
 Four types of addresses are used :
Physical Addresses
Logical (IP) Addresses
Port Addresses, and
Specific Addresses
Network Layer Cont…
 Physical(Hardware) address is used to uniquely identify a host within
a local network. (by data link layer of OSI)
 Ethernet utilizes the 48-bit MAC address as its hardware address.
A MAC address is most often represented in hexadecimal, using

one of two accepted formats:
e.g. 00:43:AB:F2:32:13
0043.ABF2.3213
 Logical Addressing
 Logical addressing is a function of the Network layer of the OSI Model and
provides a hierarchical structure.
 Example: 198.168.1.1
 Specific Address- are user-friendly addresses
E.g. www.aau.edu.et
Network Layer Cont…
 Port Number is a pre-assigned unique numbers so that the
computer knows how to respond when it is contacted on a
specific port.
 It is 16-bit address.
 Example:
 Web Servers use port 80.
 SMTP (Simple Mail Transfer Protocol) is delivered to
port 25.
 FTP(File Transfer Protocol) is delivered to port 21.
Network Layer: Logical IP addressing
 Internet Protocol moves data between hosts in the form of datagram.
 Each datagram delivered to destination address w/c contains 32 – bit IP
address.
 Each data packet sent along a network contains source and destination IP
addresses
 A router uses the IP address of the destination to forward the packet to the
correct destination
 IP address – has two versions
 IPv4 – is the current version of IP .
 IPv6- is the next version of the Internet Protocol
Network Layer: Logical IP addressing
• IP addresses are 32 bits wide.

• To work with this 32 bit wide IP addresses ,it needs to be divided into four
fields
• Each field is 8 bits wide, can be converted to base 10 and separated by
dots.
• Each octet has a decimal value from 0 to 255
• This writing scheme is called dotted decimal format and each part is called
an octet b/c it is made of eight bits.
Network Layer: Logical IP addressing
 IP address formats
 Example
 Dotted binary format
 00001010.00000100.00001111.00001100
 Dotted decimal format
 10.4.15.12
 IP addresses have two portions , such as:
 Network portion and
 Host portion.
Network Layer: Logical IP addressing
 The network portion/ addresses
 Uniquely identifies the network in which the computer is located
 Example: In the IP address 172.16.30.56, 172.16 is the network
address.
 The host portion/ addresses
 Identifies the source and destination computer / machine in the
network, also called node address.
 Example: In the IP address 172.16.30.56, 30.56 is the host/node
address.
Network Layer: Logical IP addressing
 Host and network portions
Network Layer: Logical IP addressing
 IP address classes:
 IP addresses are classified into three main address classes to
define large, medium and small networks.
 Class A IP addresses are used for larger networks.
 Class B for medium networks.
 Class C for small networks.
 Other classes – w/c are used for multicasting and research purposes
are D and E .

 This grouping of addresses is referred to as class full


addressing.
Network Layer: Logical IP addressing
IP address classes – Ranges

IP Address Class High Order Bits First Octet Number of Bits


Address Range in the Network
Address

Class A 0 0 – 127* 8

Class B 10 128 – 191 16

Class C 110 192 – 223 24

Class D 1110 224 – 239 0

Class E 1111 240 - 255 0


Network Layer: Logical IP addressing
 IP address classes – network and host portions
Network Layer: Logical IP addressing
 Reserved IP addresses
 Certain IP addresses are reserved and cannot be used as an
address to a host.
 Some of them are:
 Network addresses – w/c used to identify the network.

 Broadcast addresses – w/c used to broadcast messages.


 Network addresses
 Used to identify the network itself.
 Example: a class C network which starts with 200.150.56.0
Network Layer: Logical IP addressing
 Network addresses…
 The address 200.150.56.0 is called the network address.
 An addresses can be assigned for hosts from 200.150.56.1 to
200.150.56.254
 The only time when the host portion of the address matters is
when data is on the local area network.
 In general, network addresses have all zeros for the host
portion.
Network Layer: Logical IP addressing
 Network addresses (cont...)
Network Layer: Logical IP addressing
 Broadcast Addresses:

 It is the address that used by applications and hosts to send


information to all hosts / nodes on a network.
 Used for broadcasting packets to all the devices on a network.
 Hosts use broadcast addresses to send data to all hosts on a network.
 Assume a class C network with a network address 200.150.56.0
 The broadcast address for this network is 200.150.56.255
 In general, broadcast addresses have all ones for the host portion.
Network Layer: Logical IP addressing
 Broadcast addresses (cont...)
LAYER 2: DATA LINK
 Packages raw bits from the physical layer into FRAMES
 The data link layer provides reliable transit of data across a
physical link by using the Media Access Control (MAC)
addresses
 Source & Destination ( address of device that connects one Network
to next) address
 Flow Control: refers to a set of procedures used to restrict the amount of
data that the sender can send before receiving an acknowledgement
 Error Control: refers to both error detection and error correction
 Data Link LAN specifications: Fast Ethernet, Token Ring,
FDDI .
 Data Link WAN specifications are: Frame Relay, PPP, X.25.
 Bridges and Switches operate at this layer
39
Layer 1: Physical Layer
 Physical Layer
 Define physical characteristics of network. E.g. wires, connector,
voltages, data rates, Asynchronous, Synchronous Transmission
 Handles bit stream or binary transmission
 Used to maintain, activate and deactivate physical link.
 For receiver it reassembles bits and send to upper layer for
frames.
 For Sender it convert frames
into bit stream and send on
transmission medium.

40
Properties of Physical Layers
 Deals with bit stream.
 Transmits raw bit stream over physical cable
 defines cables, cards, and physical aspects
 defines NIC attachments to hardware, how cable is
attached to NIC
 defines techniques to transfer bit stream to cable
 Layer 1 Device: Repeater, Hub, Multiplexer

41
Physical layer
physical
connection

Transporting bits from one end node to the next


 Type of the transmission media (twisted-pair, coax, optical
fiber, air)
Bit representation (voltage levels of logical values)
Data rate (speed-the number of bits sent each second)
Synchronization of bits (time synchronization)
42
Cont…

 layers, interfaces, and protocols in the OSI model


OSI Model Cont…
 Data Encapsulation
 Data Encapsulation is the process of adding a header to
wrap/envelop the data that flows down the OSI model.
 The 5 Steps of Data Encapsulation are:
 The Application, Presentation and Session layers create
DATA from users' input.
 The Transport layer converts the DATA to SEGMENTS
 The Network layer converts the Segments to Packets
(datagram)
 The Data Link layer converts the PACKETS to FRAMES
 The Physical layer converts the FRAMES to BITS.
The TCP/IP Reference Model
 TCP/IP -Transmission Control Protocol/Internet Protocol
 used by ARPANET and its successor the Internet
 design goals
 The ability to connect multiple networks (internetworking)
in a seamless way.
 The network should be able to survive loss of subnet
hardware, i.e., the connection must remain intact as long as
the source and destination machines are properly
functioning.
 Flexible architecture to accommodate requirements of
different applications -ranging from transferring files to real-
time speech transmission
The TCP/IP Reference Model
 These requirements led to the choice of a packet-switching
network based on a connectionless internetwork layer
 Has 4 (or 5 depending on how you see it) layers: Application,
Transport, Internet (Internetwork), Host-to-network (some split it
into Physical and Data Link)
 Summery of TCP/IP Reference Model

b. Categorization into Five layers


OSI and TCP/IP Layers Correspondence
Client-Server TCP
Assuming no messages are lost,
 the client initiates a setup
connection using a three-way
handshake (1-3)
 the client sends its request (4)
 it then sends a message to close the
connection (5)
 the server acknowledges receipt and
informs the client that the
connection will be closed down (6)
 then sends the answer (7) followed
by a request to close the connection
(8)
 the client responds with an ack to
finish conversation (9)
Middleware Protocols
 A middleware is an application that contains general-
purpose protocols to provide services
 example of middleware services
 authentication and authorization services
 distributed transactions (commit protocols; locking
mechanisms)
 middleware communication protocols (calling a
procedure or invoking an object remotely,
synchronizing streams for real-time data, multicast
services)
Cont…

 an adapted reference model for networked communication


Remote Procedure Call
 The first distributed systems were based on explicit message exchange
between processes through the use of explicit send and receive
procedures; but do not allow access transparency
 RPC concept : to make a remote procedure call appear like a local
procedure call.
 The goal is to hide the details of the network communication (namely,
the sending and receiving of messages).
 The calling procedure should not be aware that the called procedure is
executing on a different machine.
 Allow programs on different machines to interact using simple
procedure call/return semantics
 Widely accepted
 Standardized
 Client and server modules can be moved among computers and operating systems easily
Cont…
 When making a RPC:
 The calling environment is suspended.
 Procedure parameters are transferred across the network to
the environment where the procedure is to execute.
 The procedure is executed there.
 When the procedure finishes, the results are transferred
back to the calling environment.
 Execution resumes as if returning from a regular
procedure call.
Cont…
 Client and Server Stubs
 RPC would like to make a remote procedure call look the
same as a local one; it should be transparent, i.e., the
calling procedure should not know that the called
procedure is executing on a different machine or vice
versa
Cont…
 When a program is compiled, it uses different versions of
library functions called client stubs
 A server stub is the server-side equivalent of a client stub

Steps of a Remote Procedure Call


1. Client procedure calls client stub in the normal way
2. Client stub builds a message and calls the local OS (packing
parameters into a message is called parameter marshaling)
3. Client's OS sends the message to the remote OS
4. Remote OS gives the message to the server stub
5. Server stub unpacks the parameters and calls the server
Cont…
6. Server does the work and returns the result to the stub
7. Server stub packs it in a message and calls the local OS
8. Server's OS sends the message to the client's OS
9. Client's OS gives the message to the client stub
10. Stub unpacks the result and returns to client
Remote Object (Method) Invocation
(RMI)
 Resulted from object-based technology that has proven its value in
developing non distributed applications.
 It is an expansion of the RPC mechanisms
 It enhances distribution transparency as a consequence of an object that
hides its internal from the outside world by means of a well-defined
interface.
 Distributed Objects
 An object encapsulates data, called the state, and the operations on
those data, called methods
 Methods are made available through interfaces
 The state of an object can be manipulated only by invoking methods
 This allows an interface to be placed on one machine while the
object itself resides on another machine; such an organization is
referred to as a distributed object
Cont…
 Remote Method Invocation (RMI) allows a client application to
call methods on an object residing on a remote server
 When a client desires to connect to a server it queries the
Registry on the correct machine for an object with a certain
name and uses the returned reference to make method calls on
the remote object.
 Stubs generated by the rmic (Remote Method
 Invocation Compiler) serve as a client proxy to the remote
object.
 Marshaling means converting a method argument from its
native binary representation into some language-independent
format, and then converting this generic representation into a
binary format that is appropriate to the called method.
Cont…
Cont…
 Developing a distributed application using RMI
involves the following steps:
Define a remote interface
Implement the remote interface
Develop the server
Develop a client
Generate Stubs and Skeletons, start the RMI
registry, server, and client
Cont…
 Stubs and Skeletons:
 Stubs and skeletons are used in the implementation of remote
objects.
 When you invoke a method on a remote object (which could be on
a different host), you are actually calling some local code that
serves as a proxy for that object. This is the stub.
 The skeleton is another proxy that lives with the real object on its
original host.
 It receives remote method invocations from the stub and
passes them to the object.
 Stubs and skeletons for your remote objects are created by running
the rmic (RMI compiler) utility. After compiling your Java source
files normally, you run rmic on the remote object classes as a
second pass.
Cont…
 Remote Interfaces:
 Remote objects are objects that implement a special
remote interface that specifies which of the object's
methods can be invoked remotely.
 The remote interface must extend the java.rmi.Remote
interface.
 Your remote object will implement its remote interface;
as will the stub object that is automatically generated for
it.
 All methods in the remote interface must declare that
they can throw the exception
java.rmi.RemoteException.
Cont…
 This exception (actually, one of many subclasses to
RemoteException) is thrown when any kind of
networking error happens:
 for example, the server could crash, the network
could fail, or you could be requesting an object that
for some reason isn't available.
Cont…
 The RMI Registry:
 The registry is the RMI phone book.
 You use the registry to look up a reference to a
registered remote object on another host.
 The registry is implemented by a class called Naming
and an application called rmiregistry.
 This application must be running on the local host
before you start a Java program that uses the registry.
You can then create instances of remote objects and
bind them to particular names in the registry.
Message-Oriented Communication
 RPC and RMI are not adequate for all distributed
system applications
 The provision of access transparency may be good but
they have semantics that is not adequate for all
applications.
 Example problems
 They assume that the receiving side is running at the time of
communication.
 A client is blocked until its request has been processed.
 Messaging is the solution.
Stream-Oriented Communication
 Stream-oriented communication provides facilities for the
exchange of time-dependent information(continuous
media) such as audio and video streams
 Timing in transmission modes
 Asynchronous transmission mode: data items are
transmitted one after the other, but no timing constraints;
e.g. text transfer
 Synchronous transmission mode: a maximum end-to-end
delay defined for each data unit; it is possible that data can
be transmitted faster than the maximum delay, but not
slower
Cont…
 A continuous data stream can be simple or complex
 Simple stream: consists of a single sequence of data; e.g.,
mono audio, video only (only visual frames)
 Complex stream: consists of several related simple streams,
called sub-streams, that must be synchronized; e.g., stereo
audio, video consisting of audio and video (may also contain
subtitles, translation to other languages, ...)
Quality of Service (QoS)
 Timing and other nonfunctional requirements are expressed as
Quality of Service requirements
 QoS requirements describe what is needed from the underlying
distributed system and network to ensure acceptable delivery; e.g.
viewing experience of a user
 For continuous data, the concerns are
 Timeliness: data must be delivered in time
 Initial delay: maximum delay until a session has been setup
 maximum end-to-end delay
 maximum delay variance or jitter
 Volume/bandwidth: the required throughput (bit rate) must be met
 Reliability: a given level of loss of data must not be exceeded
 Quality of perception: highly subjective
Cont…
 Enforcing QoS
 The underlying system offers a best-effort delivery service
 A distributed system can help to improve QoS
 Three methods:
 Buffering, forward error correction, and interleaving frames

 Buffering - Client Side


 Buffer (store) flows on the receiving side (client machine) before
delivery (playback)
 Forward Error Correction -Client Side
 packets may be lost
 retransmission is not applicable for time-dependent data
 the overhead for forward error correction may be high.
Cont…
 Interleaving Frames -Server Side
 A single packet may contain multiple audio and video frames
 if such a packet is lost, there will be a large gap during play
back
 hence, the idea is to distribute the effect of a packet loss over
time
 but, a larger buffer is required at the receiver/client
 for example, to play the first four frames, four packets
need to be delivered and stored
Cont…
Cont…

Thank You!

You might also like