Unit I
Unit I
Topics
INTRODUCTION: Data Communications - Networks - Network
criteria - Physical Structure - Network Types - Standards and
Administration.
• Military
• Banking
• Air traffic control
• Nuclear reactor safety
• Shopping
• Trading
Networks for people
• People started using computer networks instead of
super/mainframe computers
• Access to remote information
• Person – to – person communication
• Interactive entertainment
• Access to remote information
• To manage bank accounts
• To pay bills
• To handle investments
• Home shopping
• Newspapers
• Online digital library
• Web access for arts, business, cooking, government, health,
history, hobbies, recreation, science, sports, travel etc.,
Networks for people
• Person – to – person communication
• Email (audio, video, text )
• Video conferencing (remote school, medical opinion)
• Discussion forums, news groups
• Interactive entertainment
• Video on demand
• Live television
• New film story directions
• Games (multi person real time simulation games)
Social issues
• Social , ethical, and political problems
• Views posted to groups(politics, religion, sex)may be
deeply offensive to some people
• Censor messages
• Computer networks offer the potential for sending
anonymous messages
Network Architecture
Topics
• Layering and protocols
• Encapsulation
• Multiplexing and Demultiplexing
• OSI Architecture
• Internet Architecture
Network Architecture
• A computer network must provide general, cost effective, fair and
robust among a large number of computers.
• It must evolve to accommodate changes in both the underlying
technologies.
• To help to deal this network designers have developed general
blueprints called network architecture that guide the design and
implementation of networks.
Layering and Protocols
Layering and Protocols
• To reduce the complexity of getting all the functions maintained by one
a new technique called layering technology was introduced.
• In this, the architecture contains several layers and each layer is
responsible for certain functions.
• The general idea is that the services offered by underlying hardware,
and then add a sequence of layers, each providing a higher level of
service.
• The services provided at the higher layers are implemented in terms of
the services provided by the lower layers.
• A simple network has two layers of abstraction sandwiched between
the application program and the underlying hardware.
Contd…
RRP RRP
HHP HHP
Fig. High level messages are encapsulated inside of low level messages
Contd…
• Encapsulation
• Header
• It is a small data structure from a few bytes to a few dozen bytes.
• It is used among peers to communicate with each other.
• Headers are usually attached to the front of message.
• Trailer
• Peer to peer control information is sent at the end of the message is called trailer.
• The exact format for the header attached by RRP is defined by the protocol
specification.
Contd…
• The rest of the message that is the data being transmitted on behalf of
the application is called the message’s body or payload.
• The application’s data is encapsulated in the new message created by
protocol RRP.
• The process of encapsulation is then repeated at each level of the
protocol graph.
Contd…
• For example :
• HHP encapsulates RRP’s message by attaching a header of its own.
• Assume HHP sends messages to its peer it is processed in opposite
order.
• HHP first strips its header off the front of the message , interprets it and
passes the body of the message to RRP , which removes the header
that’s its peer attached and do the actions indicated in the header and
passes the body of the message to the application program.
ISO/OSI MODEL
ISO / OSI MODEL
• ISO refers International Standards Organization was established in
1947.
• It is a multinational body dedicated to worldwide agreement on
international standards.
• OSI refers to Open System Interconnection that covers all aspects of
network communication.
• It is a standard of ISO.
• Here open system is a model that allows any two different systems to
communicate regardless of their underlying architecture.
• Mainly, it is not a protocol it is just a model.
OSI MODEL
• The open system interconnection model is a layered framework.
• It has seven separate but interrelated layers. Each layer having unique
responsibilities.
ARCHITECTURE
• The architecture of OSI model is a layered architecture.
• The seven layers are,
1. Physical layer
2. Data link layer
3. Network layer
4. Transport layer
5. Session layer
6. Presentation layer
7. Application layer
Figure Seven layers of the OSI model
•Functions are
• Physical characteristics of interfaces and medium
• Representation of bits
• Data rate
• Synchronization of bits
• Line configuration
• Physical topology
• Transmission mode
Figure: Physical layer
Functions
1. Physical Characteristics Of Interfaces and Media:
• It defines the electrical and mechanical characteristics of the interface and the
media.
• It defines the types of transmission medium
2. Representation of Bits
• To transmit the stream of bits they must be encoded into signal.
• It defines the type of encoding whether electrical or optical.
3. Data Rate
• It defines the transmission rate i.e. the number of bits sent per second.
4. Synchronization of Bits
• The sender and receiver must be synchronized at bit level.
Contd…
5. Line Configuration
• It defines the type of connection between the devices.
Two types of connection are,
1. point to point
2. multipoint
6. Physical Topology
• It defines how devices are connected to make a network.
Five topologies are,
1. mesh
2. star
3. tree
4. bus
5. ring
Contd…
7. Transmission Mode
• It defines the direction of transmission between devices.
• Three types of transmission are,
1. simplex
2. half duplex
3. Full Duplex
Data Link Layer
Functions are
• Framing
• Physical addressing
• Flow control
• Error control
• Access control
Figure: Data link layer
Data Link Layer
The responsibilities of Data link layer are,
1. Framing
• It divides the stream of bits received from network layer into manageable data
units called frames.
2. Physical Addressing
• It adds a header that defines the physical address of the sender and the
receiver.
• If the sender and the receiver are in different networks, then the receiver
address is the address of the device which connects the two networks.
Contd…
3. Flow Control
• It imposes a flow control mechanism used to ensure the data rate at the sender and
the receiver should be same.
4. Error Control
• To improve the reliability the Data link layer adds a trailer which contains the error
control mechanism like CRC, Checksum etc.
5. Access Control
• When two or more devices connected at the same link, then the Data link layer
used to determine which device has control over the link at any given time.
Figure: Hop-to-hop delivery
Network Layer
•Logical addressing
•Routing
Figure 2.8 Network layer
Network Layer
The responsibilities are,
1. Logical Addressing
• If a packet passes the network boundary that is when the sender and receiver
are places in different network then the network layer adds a header that
defines the logical address of the devices.
2. Routing
• When more than one networks connected and to form an internetwork, the
connecting devices route the packet to its final destination.
• Network layer provides this mechanism.
Figure 2.9: Source-to-destination delivery
Transport Layer
The transport layer is responsible for the delivery
of a message from one process to another.
•The Transport layer is responsible for the end to end delivery
of the entire message.
•It ensures that the whole message arrives in order.
• It ensures the error control and flow control at source to
destination level.
•Functions are
• Service-point addressing
• Segmentation and reassembly
• Connection control
• Flow control
• Error control
Figure: Transport layer
Transport Layer
The responsibilities are,
1. Service point Addressing
• A single computer can often run several programs at the same time.
• The transport layer gets the entire message to the correct process on that
computer.
• It adds a header that defines the port address which used to identify the
exact process on the receiver.
2. Segmentation and Reassembly
• A message is divided into manageable units called as segments.
• Each segment is reassembled after received that information at the
receiver end.
• To make this efficient each segment contains a sequence number.
Contd…
3. Connection Control
• The transport layer creates a connection between the two end ports.
• It involves three steps. They are,
• 1. connection establishment
• 2. data transmission
• 3. connection discard
4. Flow Control
• Flow control is performed at end to end level
5. Error Control
• Error control is performed at end to end level.
Figure: Reliable process-to-process delivery of a message
Session Layer
The session layer is responsible for dialog
control and synchronization.
It acts as a dialog controller
It establishes, maintains and synchronizes the
interaction between the communication devices.
•Functions are
• Dialog control
• Synchronization
Figure 2.12 Session layer
Session Layer
The responsibilities are,
1. Dialog Control
• The session layer allows two systems to enter into a dialog.
• It allows the communication between the devices.
2. Synchronization
• It adds a synchronization points into a stream of bits.
Presentation Layer
•Translation
•Encryption
•Compression
Figure 2.13 Presentation layer
Presentation Layer
The responsibilities are,
1. Translation
• Different systems use different encoding systems.
• The presentation layer is responsible for interoperability between different
systems.
• The presentation layer at the sender side translates the information from the
sender dependent format to a common format.
• Likewise, at the receiver side presentation layer translate the information from
common format to receiver dependent format.
Contd…
2. Encryption
• To ensure security encryption/decryption is used Encryption means transforms
the original information to another form
• Decryption means retrieve the original information from the encrypted data
3. Compression
• It used to reduce the number of bits to be transmitted.
Application Layer
• What is a socket?
– The point where a local application process attaches to the network
– An interface between an application and the network
– An application creates the socket
• The interface defines operations for
– Creating a socket
– Attaching a socket to the network
– Sending and receiving messages through the socket
– Closing the socket
Socket
• Socket Family
– PF_INET denotes the Internet family
– PF_UNIX denotes the Unix pipe facility
– PF_PACKET denotes direct access to the network interface (i.e., it bypasses
the TCP/IP protocol stack)
• Socket Type
– SOCK_STREAM is used to denote a byte stream
– SOCK_DGRAM is an alternative that denotes a message oriented service,
such as that provided by UDP
Creating a Socket
int socket(int domain, int type, int protocol)
int sockfd = socket(address_family, type, protocol);
• The socket number returned is the socket descriptor for the newly created socket
Client invokes
int connect (int socket, struct sockaddr *address,
int addr_len)
Connect
– Does not return until TCP has successfully established a connection at which
application is free to begin sending data
– Address contains remote machine’s address
Client-Serve Model with TCP
Server
– Passive open
– Prepares to accept connection, does not actually establish a connection
Server invokes
int bind (int socket, struct sockaddr *address,
int addr_len)
int listen (int socket, int backlog)
int accept (int socket, struct sockaddr *address,
int *addr_len)
Client-Serve Model with TCP
Bind
– Binds the newly created socket to the specified address i.e. the network
address of the local participant (the server)
– Address is a data structure which combines IP and port
Listen
– Defines how many connections can be pending on the specified socket
Client-Serve Model with TCP
Accept
• Carries out the passive open
• Blocking operation
• Does not return until a remote participant has established a connection
• When it does, it returns a new socket that corresponds to the new
established connection and the address argument contains the remote
participant’s address
Client-Serve Model with TCP
Once a connection is established, the application process invokes two
operation
Bandwidth: The bandwidth of a network is given by the number of bits that can
be transmitted over the network in a certain period of time.
How long it takes to transmit each bit of data.
For example, a network might have a bandwidth of 10 million bits/second
(Mbps), meaning that it is able to deliver 10 million bits every second.
Contd…
At the physical level, bandwidth is constantly improving, with no end in sight.
Intuitively, if you think of a second of time as a distance you could measure with
a ruler and bandwidth as how many bits fit in that distance, then you can think of
each bit as a pulse of some width.
Contd…
Bandwidth and throughput are two of the most confusing terms used in net-
working.
Bandwidth is literally a measure of the width of a frequency band.
For example, a voice-grade telephone line supports a frequency band ranging
from 300 to 3300 Hz; it is said to have a bandwidth of 3300 Hz−300 Hz = 3000
Hz.
When we talk about the bandwidth of a communication link, we normally refer to
the number of bits per second that can be transmitted on the link. This is also
sometimes called the data rate.
We tend to use the word throughput to refer to the measured performance of a
system.
For example, bandwidth of 10 Mbps might achieve a throughput of only 2
Mbps.
Contd…
The second performance metric, latency, corresponds to how long it takes a
message to travel from one end of a network to the other.
Latency is measured strictly in terms of time.
There are many situations in which it is more important to know how long it takes
to send a message from one end of a network to the other and back, rather than the
one-way latency. We call this the round-trip time (RTT) of the network.
latency has three components,
Propagation delay
Amount of time it takes to transmit a unit of data
Queuing delays
Contd…
Propagation delay - This delay occurs because nothing, including a bit on a wire,
can travel faster than the speed of light.
Amount of time it takes to transmit a unit of data. This is a function of the network
bandwidth and the size of the packet in which the data is carried.
Queuing delays inside the network, since packet switches generally need to store
packets for some tie before forwarding them on an outbound link.
Latency = Propagation + Transmit + Queue
Propagation = Distance/ SpeedOfLight
Transmit = Size/Bandwidth
Bandwidth and latency combine to define the performance characteristics of a given
link or channel. Their relative importance, however, depends on the application.
One bit transmission => propagation is important
Large bytes transmission => bandwidth is important
Delay X Bandwidth Product
Product of these two metrics, often called the delay ×bandwidth product.
Consider the channel between a pair of processes as a hollow pipe, as shown
below,
Latency corresponds to the length of the pipe and the bandwidth gives the
diameter of the pipe.
delay × bandwidth product gives the volume of the pipe (i.e.) maximum
number of bits that could be in transit through the pipe at any given instant.
Contd…
For example, a transcontinental channel with a one-way latency of 50 ms and a
bandwidth of 45 Mbps is able to hold
50×10−3 s×45×106 bits/s
= 2.25×106 bits
The delay × bandwidth product is important to know when constructing high-
performance networks, because it corresponds to how many bits the sender must
transmit before the first bit arrives at the receiver.
If the sender is expecting the receiver to somehow signal that bits are starting to
arrive, and it takes another channel latency for this signal to propagate back to the
sender, then the sender can send up one RTT × bandwidth worth of data before
hearing from the receiver that all is well.
RTT is simply refer to as the delay ×bandwidth product, without explicitly
saying that “delay” is the RTT
High Speed Networks
There is eternal optimism that network bandwidth will continue to improve.
“High Speed” does not mean that latency improves at the same rate as bandwidth;
the transcontinental RTT of a 1-Gbps link is the same 100 ms as it is for a 1-Mbps
link.
Ever-increasing bandwidth in the face of fixed latency.
Contd………
• The effective end-to-end throughput that can be achieved over a network is given
by the simple relationship
Throughput = TransferSize/TransferTime
where TransferTime includes not only the elements of one-way Latency identified
earlier in this section, but also any additional time spent requesting or setting up the
transfer. Generally, we represent this relationship as
TransferTime = RTT+1/Bandwidth×TransferSize
We use RTT in this calculation to account for a request message being sent
across the network and the data being sent back.
Contd……..
• It transferring a larger amount of data will help improve the effective
throughput, where in the limit an infinitely large transfer size will
cause the effective throughput to approach the network bandwidth.
• One of the wires is used to carry signals to the receiver, and the other is used only as a
ground reference.
• In addition to the signal sent by the sender on one of the wires, interference (noise) and
crosstalk may affect both wires and create unwanted signals.
• If the two wires are parallel, the effect of these unwanted signals is not the same in both
wires because they are at different locations relative to the noise or crosstalk sources .
• This results in a difference at the receiver.
• By twisting the pairs, a balance is maintained.
• For example, suppose in one twist, one wire is closer to the noise source and the other is
farther; in the next twist, the reverse is true.
• Telephone company uses twisted-pair copper wires to link telephones.
Physical links (contd.)
• The most common twisted-pair cable used in communications is
referred to as unshielded twisted-pair (UTP).
• IBM has also produced a version of twisted-pair cable for its use
called shielded twisted-pair (STP).
• STP cable has a metal foil or braided- mesh covering that
encases each pair of insulated conductors.
• Although metal casing improves the quality of cable by
preventing the penetration of noise or crosstalk, it is bulkier and
more expensive.
• Figure shows the difference between UTP and STP.
Physical links (contd.)
Table 7.1 Categories of unshielded twisted-pair cables
Contd…
• Performance :
• One way to measure the performance of twisted-pair cable is to
compare attenuation versus frequency and distance.
• A twisted-pair cable can pass a wide range of frequencies.
• However, Figure shows that with increasing frequency, the
attenuation, measured in decibels per kilometer (dB/km),
sharply increases with frequencies above 100 kHz.
• Note that gauge is a measure of the thickness of the wire.
Figure: UTP performance
Contd…
• Applications
• Twisted-pair cables are used in telephone lines to provide
voice and data channels.
• The local loop--the line that connects subscribers to the
central telephone office---commonly consists of unshielded
twisted-pair cables.
• The DSL lines that are used by the telephone companies to
provide high-data-rate connections also use the high-
bandwidth capability of unshielded twisted-pair cables.
• Local-area networks, such as 10Base-T and 100Base-T, also
use twisted-pair cables.
Coaxial cable
• Coaxial cable (or coax) carries signals of higher frequency ranges than
those in twisted- pair cable, in part because the two media are constructed
quite differently.
• Instead of having two wires, coax has a central core conductor of solid or
stranded wire (usually copper) enclosed in an insulating sheath, which is, in
turn, encased in an outer conductor of metal foil, braid, or a combination of
the two.
• The outer metallic wrapping serves both as a shield against noise and as the
second conductor, which completes the circuit. This outer conductor is also
enclosed in an insulating sheath, and the whole cable is protected by a
plastic cover .
Contd…
172
UNGUIDED MEDIA: WIRELESS
Unguided media transport electromagnetic waves without using a physical conductor.
This type of communication is often referred to as wireless communication.
Radio, satellite microwave,, Bluetooth, and infrared light are all different forms of
electromagnetic waves that are used to transmit data
unguided signal can travel from the source to destination in several ways:
1.Ground Propagation:
• Radio waves travel through the lowest portion of the atmosphere, hugging the earth.
• The low frequency signal follow the curvature of the planet.
• Distance depends on the amount of the power.
2.Sky Propagation:
Higher frequency radio radiate upward into the ionosphere where they are reflected back to
the earth.
Sky propagation allow for greater distance with lower power output.
3.line-of-sight Propagation: Very high frequency signals are transmitted in straight lines
directly from antenna to antenna.
• The section of the electromagnetic spectrum defined as
radio waves and microwaves is divided into eight
ranges, called bands, each regulated by government
authorities.
• These bands are rated from very low frequency(VLF)
to extremely high frequency (EHF).
• Table lists these bands, their ranges, propagation
methods, and some applications.
Table: Bands
Contd…
These speeds are restricted to the maximum speed of the modem at the
other end of the connection.
Physical links (contd.)
3. The type of data movement allowed on the channel.
• Simplex transmission - One way transmission.
• Half-duplex transmission - Flows only one way at a time.
• Full-duplex transmission - Two-way transmission at the
same time.
Physical links (contd.)
4.The method used to transport the data.
• Two types of data transmission, each requiring a different modem.
• Asynchronous transmission -
• Information is sent byte by byte.
• Cheaper and more commonly used.
• Synchronous transmission -
• Data is sent in large blocks rather than in small pieces.
• Preceded by special information, concerning error detection and block size.
• These modems are expensive but very fast.
Physical links (contd.)
5. Single channel versus multichannel transmission
• Channel - A path of a signal.
• Single channel - Capable of only sending/receiving one signal at a time.
• Phone line: Single line = single phone call at a time.
• Multichannel - Capable of more than one channel at a time.
• Fiber-optic cable, microwaves, Satellite transmissions.
Physical links (contd.)
• How is it possible to measure the capacity of communications links?
• Bandwidth: Digital
• Number of bits per second (bps) that can be sent over a link.
• The wider the bandwidth, the more diverse kinds of information can be sent.
• Simplest is voice, most sophisticated is moving videos.
• Bandwidth: Analog
• The difference between the highest and lowest frequencies that can be sent over an analog link (like
phone lines).
• Measurement is given in hertz (Hz).
• For both: The wider the bandwidth, the more information can flow over the channel.
Physical links (contd.)
Typical cable bandwidths used in local area networks.
Cable: Typical Bandwidth:
Twisted Pair 10 to 100 Mbps
Coaxial Cable 10 to 100 Mbps
Fiber-optic cable 100 to 200 Mbps
ALOHA Network
Contd…
• ALOHA(Abramson's Logic Of Hiring Access) is a system proposed for
solving the channel allocation problem.
- there are two versions of ALOHA:
1. Pure ALOHA;
2. Slotted ALOHA
Figure: Frames in a pure ALOHA network
Pure ALOHA
"Multiple Access" describes the fact that multiple stations send and receive on the
medium. Transmissions by one node are generally received by all other stations
using the medium.
CSMA: Vulnerable Time
Types
• There are several versions of carrier sense protocols:
- 1-persistent CSMA
- Non-persistent CSMA
- P-persistent CSMA
Note
Note
contention window
size is 2K-1
• Advantages
• Can assign more time to senders with heavier loads
• Disadvantages
• Requires precise synchronization.
Figure: Time-division multiple access (TDMA)
Combining FDMA and TDMA
• Each channel gets a certain frequency band for a certain amount of
time.
• Ex. GSM
• Advantage:
• More robust against frequency.
• Much greater capacity with time compression.
• Inherent tapping protection.
• Disadvantage :
• Frequency changes must be coordinated.
Code Division Multiple Access(CDMA)
• CDMA focuses primarily on the “Direct Sequence SS” technique
• Instead of using frequencies or time slots, as do FDMA & TDMA, it uses digital
codes to transmit and distinguish between multiple users
• Each user is assigned a unique PN(Pseudo Noise) code sequence with which to
encode its data and the assigned code is uncorrelated with the data
• Because the signals are distinguished by digital codes, many users can share the
same bandwidth simultaneously
• signals are transmitted in the same frequency at the same time
Contd…
• Multiplying the data by the high data rate PN code results in dividing the signal
into smaller bits, thus, increasing its BW
• The PN code used for spreading must have
• low cross-correlation values and
• be unique to every user
• This is the reason why a receiver which has knowledge about the code of the
intended transmitter, is capable of selecting the desired signal
How CDMA works
• A unique code is assigned to all users
• Signals for all calls are spread across a broad frequency spectrum
• CDMA – An Analogy
Contd…
• 4 speakers are simultaneously giving a presentation, and they each speak different
native language -- Arabic, Chinese, English & Hindu.
• You are in the audience, and English is your native language.
• You only understand the words of the English speaker and tune out the Arabic,
Chinese, and Hindu speakers.
• You hear only what you know and recognize
• The same is true for CDMA
Contd…
• Multiple users share the same frequency band at the same time, yet each user only
hears his or her intended conversation.
• Each conversation is specially encoded and decoded for each
• particular user
• This technique allows numerous telephone calls to be simultaneously transmitted
in one radio frequency band.
Contd…
• At transmitter, signal is first “correlated” with the PN sequence
• At the receiver, the spread signal is “demodulated” to a narrow band and then
decorrelated using unique PN code intended for it.
• A signal correlated with a given PN code and decorrelated with the same PN code
returns the original signal
• Decorrelating the signal with the wrong PN code would result in pure noise
CDMA
• One channel carries all transmissions at the same time
• Each channel is separated by code
CDMA: Chip Sequences
• Each station is assigned a unique chip sequence
• At the start of a new TDMA frame, the user hops to a new channel
• This avoids severe fades or erasure in any particular channel
• The user is allowed to hop according to a predefined sequence
• Transmitter are made to transmit on different frequencies at different times
FRAMING
Topics
• Byte Oriented Protocols (BISYNC , PPP)
• Sentinel Approach
• Byte - Counting Approach (DDCMP)
• Bit Oriented Protocols ( HDLC)
• Clock – Based Framing (SONET)
FRAMING
•The stream of bits are not advisible to maintain in networks.
•When an error occurs, then the entire stream have to retransmitted.
•To avoid this, the framing concept is used.
•In this, the stream of bits are divided into manageable bit units called frames.
•To achieve, we are using several ways.
They are,
• 1. Byte Oriented Protocols
• 2. Bit Oriented Protocols
• 3. Clock Based Protocols
Contd…
1. BYTE ORIENTED PROTOCOLS:
• Each frame is considered as a collection of bytes rather than a collection of bits.
• There are two approaches. They are,
• 1. Sentinel Approach
• 2. Byte – Counting Approach
1. Sentinel approach
• In this approach it uses special characters called sentinel characters to indicate where
frames start and end.
• This approach is called character stuffing because extra characters are inserted in the
data portion of the frame.
Ex: 1. Binary Synchronous Communication (BISYNC)
2. Point to Point Protocol
Contd…
• It is arranged as nine rows of 90 bytes each, and the first 3 bytes of each row
are overhead, with the rest being available for data.
• The first 2 bytes of the frame contain a special bit pattern, and these bytes
that enable the receiver to determine where the frame starts.
• The receiver looks for the special bit pattern consistently, once in every 810
bytes, since each frame is 9 x 90 = 810 bytes long.
Contd…
Note
In a single-bit error, only 1 bit in the data unit has changed.
Figure: Single-bit error
Note
A burst error means that 2 or more bits in the data
unit have changed.
Figure: Burst error of length 8
Note
To detect or correct errors, we need to send extra (redundant) bits with data.
Figure: The structure of encoder and decoder
Contd…
Redundancy
• One method is to send every data twice, so that receiver checks every bit
of two copies and detect error.
Drawbacks
• Sends n-redundant bits for n-bit message.
• Many errors are undetected if both the copies are corrupted.
• Instead of adding entire data, some bits are appended to each unit.
• This is called redundant bit because the bits added will not give any new
information. These bits are called error detecting codes.
Redundancy check
Contd…
Four types of redundancy checks are used in data communications.
They are,
1. vertical redundancy check (VRC)
2. longitudinal redundancy check (LRC)
3. cyclic redundancy check (CRC)
4. checksum
Vertical Redundancy Check (VRC)
• It is also known as parity check.
• In this technique a redundant bit called a parity bit is appended to every
data unit so that the total number of 1s in the unit including the parity
bit becomes even for even parity or odd for odd parity.
• In even parity, the data unit is passed through the even parity generator.
Contd…
• It counts the number of 1s in the data unit. If odd number of 1s, then it
sets 1 in the parity bit to make the number of 1s as even.
• If the data unit having even number of 1s then it sets in the parity bit to
0 maintain the number of 1s as even.
• When it reaches its destination, the receiver puts all bits through an
even parity checking function.
• If it counts even number of 1s than there is no error. Otherwise there is
some error.
Contd…
• EXAMPLE:
The data is : 01010110
The VRC check : 01010110 0
• In odd parity, the data unit is passed through the odd parity generator. It counts the
number of 1s in the data unit.
• If even number of 1s, then it sets 1 in the parity bit to make the number of 1s as odd.
• If the data unit having odd number of 1s then it sets in the parity bit to maintain the
number of 1s as odd.
• When it reaches its destination, the receiver puts all bits through an odd parity
checking function. If it counts odd number of 1s than there is no error. Otherwise
there is some error.
• Another EXAMPLE
The data is: 01010110
The VRC check: 01010111
Parity Check
Simplest technique.
A redundant bit (parity bit), is appended to every data
unit.
Even parity - the total number of 1's in the data plus
parity bit must be an even number.
Even Parity Generator
Even Parity
Even Parity
Even Parity
• In short VRC can detect all single-bit errors. It can detect burst errors only if the
total number of errors in each data unit is odd.
LONGITUDINAL REDUNDANCY CHECK (LRC)
In longitudinal redundancy check LRC, a block of bits is
divided into rows and a redundant row of bits is added to
the whole block.
Original data
11100111 11011101 00111001 10101001
11100111
11011101
00111001
10101001
-----------------
LRC 10101010
11100111 11011101 00111001 10101001 10101010
The above is the original data plus LRC
e.g. problem in LRC
Suppose the following block is sent
However, it is hit by a burst noise of length eight and some bits are corrupted.
When the receiver checks the LRC, some of the bits do not follow the even-parity rule and the whole
block is discarded (the nonmatching bits are shown in blue)
Fig: Two-dimensional parity
• For example frame containing 6 bytes of data. In this third bit of the parity byte is 1 since there are
an odd number of 1’s is in the third bit across the 6 bytes in the frame.
• In this case, 14 bits of redundant information are added with original information.
Figure: Two-dimensional parity-check code
Figure: Two-dimensional parity-check code
Figure: Two-dimensional parity-check code
CRC
The most powerful of the redundancy checking technique.
Based on binary division.
The redundancy bits used by CRC are derived by dividing the data unit by
a predetermined divisor; the remainder is the CRC.
A CRC must:
have exactly one less bit than the divisor
appending it to the end of the data string must make the resulting bit
sequence exactly divisible by the divisor.
CRC generator and checker
Ethernet frame
Checksum generator
• In the sender, the checksum generator subdivides the data unit into equal segments
of n bits (usually 16).
• These segments are added together using one’s complement arithmetic in such a
way that the total is also n bits long.
• The total(sum) is then complemented and appended to the end of the original data
unit as redundancy bits, called checksum field.
• The extended data unit is transmitted across the network.
• So if the sum of the data segment is T, the checksum will be -T
Data unit and checksum
Checksum checker
• The receiver subdivides the data unit as above and adds all segments together and
complements the result.
• If the extended data unit is intact, the total value found by adding the data
segments and the checksum field should be zero.
• If the result is not zero, the packet contains an error and the receiver rejects it.
Checksum
The sender follows these steps:
• The unit is divided into k sections, each of n bits
• All sections are added together using one’s complement to get the sum.
• The sum is complemented and becomes the checksum.
• The checksum is sent with the data.
In the Hamming code, each r bit is the VRC bit for one combination of data bits:
r1 is the VRC bit for one combination of data bits, r2 is the VRC bit for another
combination of data bits, and so on. The combinations used to calculate each of the
four r values for a seven-bit data sequence are as follows:
r1 : bits 1, 3, 5, 7, 9, 11
r2 : bits 2, 3, 6, 7, 10, 11
r4 : bits 4, 5, 6, 7
r5 : bits 8, 9, 10, 11
• All bit positions that are powers of 2 are used as parity bits. (positions 1, 2, 4, 8…)
• All other bit positions are for the data to be encoded. (positions 3, 5, 6, 7, 9, 10, 11…)
• Each parity bit calculates the parity for some of the bits in the code word. The position of the parity bit
determines the sequence of bits that it alternately checks and skips.
• General rule for position n: skip n−1 bits, check n bits, skip n bits, check n bits...
• Position 1 (n=1): skip 0 bit (0=n−1), check 1 bit (n), skip 1 bit (n), check 1 bit (n), skip 1 bit (n), etc.
(1,3,5,7,9,11...)
• Position 2 (n=2): skip 1 bit (1=n−1), check 2 bits (n), skip 2 bits (n), check 2 bits (n), skip 2 bits (n), etc.
(2,3,6,7,10,11...)
• Position 4 (n=4): skip 3 bits (3=n−1), check 4 bits (n), skip 4 bits (n), check 4 bits (n), skip 4 bits (n), etc.
(4,5,6,7,12...)
• Position 8 (n=8): skip 7 bits (7=n−1), check 8 bits (n), skip 8 bits (n), check 8 bits (n), skip 8 bits (n), etc.
(8-15,24-31,40-47,...)
Redundancy bits calculation
r1 will take care of these bits
d d d r8 d d d r4 d r2 r1
r2 will take care of these bits
11 10 7 6 3 2
d d d r8 d d d r4 d r2 r1
r4 will take care of these bits
7 6 5 4
d d d r8 d d d r4 d r2 r1
r8 will take care of these bits
11 10 9 8
d d d r8 d d d r4 d r2 r1
Contd…
• Calculating the r Values:
• In the first step, place each bit of the original character in its
appropriate positions in the 11 bit unit.
• Then, calculate the even parities for the various bit combinations.
• The parity value of each combination is the value of the corresponding r bit.
• For example r1 is calculated to provide even parity for a combination of bits
3, 5, 7, 9, 11.
Example of redundancy bit calculation
Single-Bit Error
Error detection using Hamming code
Error
Detection
Example Question
Consider the transmitted data to be 00101010111. Show how the error bit
position is determined
???????????????
Answer:
10101010111
2. Consider the transmitted data to be 00101010111. Show how the
error bit position is determined.
1011 = 11
Flow Control
Topics
• Functions Of data link layer
1. Line discipline or Access control
1. ENQuiry / ACKnowledgement (ENQ / ACK)
2. poll / select (POLL / SELECT)
2. Flow control
1. stop and wait protocol
2. sliding window protocol
3. Error control
4. Framing
LINE DISCIPLINE
• Communications requires at least two devices, one to send and one to
receive.
• If both devices are ready to send some information and put their
signals on the link then the two signals collides each other and became
nothing.
• To avoid such a situation the data link layer use a mechanism called
line discipline.
Contd…
• Line discipline coordinates the link system.
• It determines which device can send and when it can send.
• Line discipline can serve in two ways:
1. ENQuiry / ACKnowledgement (ENQ / ACK)
2. poll / select (POLL / SELECT)
Contd…
• ENQ / ACK:
• This method is used in peer to peer communications. That is where
there is a dedicated link between two devices.
• The initiator first transmits a frame called an enquiry (ENQ) asking the
receiver is available to receive data.
• The receiver must answer either with an acknowledgement
• (ACK) frame if it ready to accept or with a negative acknowledgement (NAK)
frame if it is not ready.
• If the response is positive, the initiator is free to send its data.
• Otherwise it waits, and try again.
• Once all its data have been transmitted, the sending system finishes with an
end of transmission (EOT) frame.
Contd…
Contd…
• POLL / SELECT
• This method of line discipline works with topologies where one device
is designated as primary and the other devices are secondary.
• Whenever a multi point link consists of a primary device and multiple
secondary devices using a single transmission line, all exchanges must be made
through the primary device even when the ultimate destination is a secondary.
Contd…
• The primary device controls the link.
• The secondary devices follow its instructions.
• The primary device only determines which device is allowed to use the
channel at a given time.
• The primary asks the secondary if they have anything to send;
this function is called polling.
• And the primary tells the target secondary to get ready to
receive;
• This function is called selecting.
Contd…
• POLL:
• This function is used by the primary device to solicit transmission from
the secondary devices.
• The secondary are not allowed to transmit data unless asked by the primary
device.
• When the primary ready to receive data, it must ask (poll) each device in turn if
it has anything to send.
• If the secondary have data to transmit it sends the data frame otherwise sends a
negative acknowledgment (NAK).
Contd…
• The primary then polls the next secondary.
• When the response is positive (a data frame), the primary reads the
frame and returns an acknowledgment (ACK).
• There are two possibilities to terminate the transmission:
• either the secondary sends all data, finishing with an EOT frame, or the
primary says “timers up”.
• Then the primary call polls for the remaining devices.
Contd…
Contd…
SELECT:
• This mode of function is used whenever the primary device has
something to send.
• It alerts the intended secondary device get ready to receive data.
• Before sending data it sends the select (SEL) frame.
• The receiver returns an ACK frame . Then the primary sends data.
Select Line Discipline
FLOW CONTROL
• It refers to a set of procedures used to restrict the amount of data flow
between sending and receiving stations.
• It tells the sender how much data it can transmit before it must wait for
an acknowledgement from the receiver.
Contd…
• Receiver has a limited speed at which it can process incoming data and
a limited amount of memory in which to store incoming data.
• Receiver must inform the sender before the limits are reached and
request that the transmitter to send fewer frames or stop temporarily.
• Since the rate of processing is often slower than the rate of
transmission, receiver has a block of memory (buffer) for storing
incoming data until they are processed.
Error Control
• Error control includes both error detection and error correction.
• It allows the receiver to inform the sender if a frame is lost or damaged
during transmission and coordinates the retransmission of those frames
by the sender.
• Error control in the data link layer is based on automatic repeat request
(ARQ). Whenever an error is detected, specified frames are
retransmitted.
Contd…
• There are two methods are used. They are,
1. stop and wait protocol
2. sliding window protocol
STOP-AND- Sender keeps a copy of the last frame until
WAIT it receives an acknowledgement.
For identification, both data frames and
acknowledgements (ACK) frames are
numbered alternatively 0 and 1.
Sender has a control variable (S) that holds
the number of the recently sent frame. (0 or
1)
Receiver has a control variable (R)that
holds the number of the next frame
expected (0 or 1).
Sender starts a timer when it sends a frame.
If an ACK is not received within a allocated
time period, the sender assumes that the
frame was lost or damaged and resends it
Receiver send only positive ACK if the
frame is intact.
ACK number always defines the number of
the next expected frame
Stop-and-Wait ARQ, lost frame
• When a receiver
receives a damaged
frame, it discards it and
keeps its value of R.
• After the timer at the
sender expires, another
copy of frame 1 is sent.
STOP-AND-WAIT, LOST ACK FRAME
• If the sender receives
a damaged ACK, it
discards it.
• When the timer of
the sender expires,
the sender
retransmits frame 1.
• Receiver has already
received frame 1 and
expecting to receive
frame 0 (R=0).
Therefore it discards
the second copy of
frame 1.
STOP-AND-WAIT, DELAYED ACK FRAME
• In stop-and-wait, at any point in time, there is only one frame that is sent and
waiting to be acknowledged.
• This is not a good use of transmission medium.
• To improve efficiency, multiple frames should be in transition while waiting for
ACK.
• Two protocol use the above concept,
– Go-Back-N ARQ
– Selective Repeat ARQ
Sliding window protocol
• Sliding window algorithm
• First the Sender assigns a sequence number denoted SeqNum to each frame.
• Sequence number is implemented by a finite – size header field and instead
assume that it can grow indefinitely large.
Contd…
• Sender maintains 3 variables
• Send Window Size(SWS) – gives the upper bound on the number of
outstanding(unacknowledged) frames that the sender can transmit
• Last Acknowledgement Received (LAR) – sequence number of the last acknowledgement
received.
• Last Frame Sent (LFS) – sequence number of the last frame sent
LFS – LAR ≤ SWS
LAR LFS
Contd…
• When an ACK arrives the sender moves LAR to the right , allowing
the sender to transmit another frame.
• The sender associates a timer with each frame it transmits and it
retransmits the frame should the timer expire before an ACK is
received.
Contd…
• Receiver maintains 3 variables
• Receive Window Size(RWS) –gives the upper bound on the number of out – of –order
frames that the receiver is willing to accept.
• Largest Acceptable Frame (LAR) – sequence number of the largest acceptable Frame.
• Last Frame Received (LFS) – sequence number of the last frame received.
LAF – LFR ≤ RWS
LFR LAF
Contd…
• When a frame with SeqNum arrives the receiver, the receiver takes
• If SeqNum ≤ LFR or SeqNum > LAF then the frame is outside the receiver
window and it is discarded.
• If LFR <SeqNum ≤ LAF then the frame is within the receivers window and it
is accepted.
Note
In the Go-Back-N Protocol, the sequence
numbers are modulo 2m,where m is the size of
the sequence number field in bits.
Figure Send window for Go-Back-N ARQ
Note
The send window is an abstract concept
defining an imaginary box of size 2m − 1 with
three variables: Sf, Sn, and Ssize.
Note
The send window can slide one
or more slots when a valid acknowledgment
arrives.
Figure Receive window for Go-Back-N ARQ
Note
• Another important point is that a NAK is sent after the second arrival, but not after the
third, although both situations look the same.
• The reason is that the protocol does not want to crowd the network with unnecessary
NAKs and unnecessary resent frames.
• The second NAK would still be NAK1 to inform the sender to resend frame 1 again; this
has already been done.
• A NAK is sent once for each window position and defines the first slot in the window.
• The next point is about the ACKs. Notice that only two ACKs are sent here. The first one
acknowledges only the first frame; the second one acknowledges three frames.
• In Selective Repeat, ACKs are sent when data are delivered to the network layer. If the
data belonging to n frames are delivered in one shot, only one ACK is sent for all of them.
Figure Flow diagram for Selective Repeat ARQ , Lost Frame
Figure Design of piggybacking in Go-Back-N ARQ
Sliding Window Summary
• Sliding window is best known algorithm in networking
• First role is to enable reliable delivery of packets
• Timeouts and acknowledgements
• Second role is to enable in order delivery of packets
• Receiver doesn’t pass data up to app until it has packets in order
• Third role is to enable flow control
• Prevents server from overflowing receiver’s buffer