DCN Unit 2 Notes
DCN Unit 2 Notes
DCN Unit 2 Notes
Data
Communication
& Networks
Notes
Unit 2
02
Syllabus
UNIT – II
Data Link Layer: Design issues, Data Link Control and Protocols:
Flow and Error Control, Stop-and-wait
ARQ. Sliding window protocol, Go-Back-N ARQ, Selective Repeat
ARQ, HDLC, Point-to –Point Access: PPP
Point –to- Point Protocol, PPP Stack,
Medium Access Sub layer: Channel allocation problem, Controlled
Access, Channelization, multiple access
protocols, IEEE standard 802.3 & 802.11 for LANS and WLAN, high-
speed LANs, Token ring, Token Bus,
FDDI based LAN, Network Devices-repeaters, hubs, switches
bridges.
COLLATE
SOURCE - IPU
Unit 2
Framing
Flow Control
Error Control
Protocols
~ for Noiseless ( ideal ) Channels
~ for Noisy (practical or real ) Channels
HDLC Protocol
2-1 FRAMING
Note
Note
If the data frames arrives at the receiver site faster than they can
processed, the frames must be stored until their use.
Normally, the receiver does not have enough storage space, especially
if it is receiving data from many sources.
Hence to prevent the receiver from becoming overwhelmed with
incoming frames, we somehow need to tell the sender to slow down. As
such there must be feedback from the receiver to the sender. In other
words we need to employ a flow control mechanism in the protocol.
Acknowledgement (ACK) frames that are auxiliary frames help in this
regard.
Note :The regions highlighted with red shade indicate additions to the previous protocol.
b) Algorithms
Sender Site
Receiver Site
c) Flow Diagram [ for Stop & Wait Protocol ]
2-3 b) NOISY CHANNELS
(continued) . . . . .
(continued) . . . . . .
Receiver Site
c) Flow Diagram
Solution
The bandwidth-delay product is
The system can send 20,000 bits during the time it takes for the
data to go from the sender to the receiver and then back again.
However, the system sends only 1000 bits. We can say that the link
utilization is only 1000/20,000, or 5 percent. For this reason, for a
link with a high bandwidth or long delay, the use of Stop-and-Wait
ARQ wastes the capacity of the link.
Efficiency : 2nd Numerical
For example,
~ if m=2 then the sequence numbers will range from 0 to 3.
( 0, 1, 2, 3 )
~ If m=4 then the sequence numbers will range from 0 to 15.
( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 )
ii) Windows :
a) Send Window :
The send window is an abstract concept
defining an imaginary box of size 2m − 1
with three variables: Sf, Sn, and Ssize.
Multiple Frames
Window size for Go-Back-N ARQ
Note
In Go-Back-N ARQ, the size of the send window must be less than 2m;
the size of the receiver window is always 1.
b) Algorithm
Sender Site
(continued . . . . . . . . )
(continued . . . . . . . . . )
Receiver Site
Retransmission of
Frames 1, 2 and 3.
Note
(continued . . . . . . . . . )
(continued . . . . . . . . . )
Receiver Site
(continued . . . . . . . . . )
(continued . . . . . . . . . )
Delivery of data in Selective Repeat ARQ
c) Flow diagram
11.58
c) Control Field Format ( for the different frame types )
U-frame control command and response
Numerical 1 on connection & disconnection in HDLC
Figure in the next slide shows how U-frames can be used
for connection establishment and connection release.
Node A asks for a connection with a set asynchronous
balanced mode (SABM) frame; node B gives a positive
response with an unnumbered acknowledgment (UA)
frame. After these two exchanges, data can be transferred
between the two nodes (not shown in the figure). After
data transfer, node A sends a DISC (disconnect) frame to
release the connection; it is confirmed by node B
responding with a UA (unnumbered acknowledgment).
Example of connection and disconnection
Numerical 2 on piggybacking without error in HDLC
Data link layer works between two hosts which are directly connected in
some sense. This direct connection could be point to point or broadcast.
Systems on broadcast network are said to be on same link. The work of
data link layer tends to get more complex when it is dealing with multiple
hosts on single collision domain.
Data link layer is responsible for converting data stream to signals bit by
bit and to send that over the underlying hardware. At the receiving end,
Data link layer picks up data from hardware which are in the form of
electrical signals, assembles them in a recognizable frame format, and
hands over to upper layer.
Logical Link Control: It deals with protocols, flow-control, and error control
Framing
Data-link layer takes packets from Network Layer and encapsulates them into
Frames.Then, it sends each frame bit-by-bit on the hardware. At receiver’ end,
data link layer picks up signals from hardware and assembles them into
frames.
Addressing
Synchronization
When data frames are sent on the link, both machines must be synchronized
in order to transfer to take place.
Error Control
Sometimes signals may have encountered problem in transition and the bits
are flipped.These errors are detected and attempted to recover actual data
bits. It also provides error reporting mechanism to the sender.
Flow Control
Stations on same link may have different speed or capacity. Data-link layer
ensures flow control that enables both machine to exchange data on same
speed.
Multi-Access
When host on the shared link tries to transfer the data, it has a high probability
of collision. Data-link layer provides mechanism such as CSMA/CD to equip
capability of accessing a shared media among multiple Systems.
Data-link layer uses some error control mechanism to ensure that frames
(data bit streams) are transmitted with certain level of accuracy. But to
understand how errors is controlled, it is essential to know what types of
errors may occur.
Types of Errors
There may be three types of errors:
Burst error
Error detection
Error correction
Error Detection
Errors in the received frames are detected by means of Parity Check and
Cyclic Redundancy Check (CRC). In both cases, few extra bits are sent
along with actual data to confirm that bits received at other end are same
as they were sent. If the counter-check at receiver’ end fails, the bits are
considered corrupted.
Parity Check
One extra bit is sent along with the original bits to make number of 1s
either even in case of even parity, or odd in case of odd parity.
The sender while creating a frame counts the number of 1s in it. For
example, if even parity is used and number of 1s is even then one bit with
value 0 is added. This way number of 1s remains even.If the number of 1s
is odd, to make it even a bit with value 1 is added.
The receiver simply counts the number of 1s in a frame. If the count of 1s
is even and even parity is used, the frame is considered to be not-
corrupted and is accepted. If the count of 1s is odd and odd parity is used,
the frame is still not corrupted.
If a single bit flips in transit, the receiver can detect it by counting the
number of 1s. But when more than one bits are erro neous, then it is very
hard for the receiver to detect the error.
Error Correction
In the digital world, error correction can be done in two ways:
Backward Error Correction When the receiver detects an error in the data
received, it requests back the sender to retransmit the data unit.
Forward Error Correction When the receiver detects some error in the data
received, it executes error-correcting code, which helps it to auto-recover and
to correct some kinds of errors.
The first one, Backward Error Correction, is simple and can only be
efficiently used where retransmitting is not expensive. For example, fiber
optics. But in case of wireless transmission retransmitting may cost too
much. In the latter case, Forward Error Correction is used.
To correct the error in data frame, the receiver must know exactly which
bit in the frame is corrupted. To locate the bit in error, redundant bits are
used as parity bits for error detection.For example, we take ASCII words
(7 bits data), then there could be 8 kind of information we need: first seven
bits to tell us which bit is error and one more bit to tell that there is no
error.
For m data bits, r redundant bits are used. r bits can provide 2r
combinations of information. In m+r bit codeword, there is possibility that
the r bits themselves may get corrupted. So the number of r bits used
must inform about m+r bit locations plus no-error information, i.e.
m+r+1.
Flow Control
When a data frame (Layer-2 data) is sent from one host to another over a
single medium, it is required that the sender and receiver should work at
the same speed. That is, sender sends at a speed on which the receiver
can process and accept the data. What if the speed (hardware/software)
of the sender or receiver differs? If sender is sending too fast the receiver
may be overloaded, (swamped) and data may be lost.
Sliding Window
In this flow control mechanism, both sender and receiver agree on the number
of data-frames after which the acknowledgement should be sent. As we learnt,
stop and wait flow control mechanism wastes resources, this protocol tries to
make use of underlying resources as much as possible.
Error Control
When data-frame is transmitted, there is a probability that data-frame
may be lost in the transit or it is received corrupted. In both cases, the
receiver does not receive the correct data-frame and sender does not know
anything about any loss.In such case, both sender and receiver are
equipped with some protocols which helps them to detect transit errors
such as loss of data-frame. Hence, either the sender retransmits the data-
frame or the receiver may request to resend the previous data-frame.
Error detection - The sender and receiver, either both or any, must ascertain
that there is some error in the transit.
Positive ACK - When the receiver receives a correct frame, it should
acknowledge it.
There are three types of techniques available which Data-link layer may
deploy to control the errors by Automatic Repeat Requests (ARQ):
Stop-and-wait ARQ
When the sender sends all the frames in window, it checks up to what
sequence number it has received positive acknowledgement. If all frames are
positively acknowledged, the sender sends next set of frames. If sender finds
that it has received NACK or has not receive any ACK for a particular frame, it
retransmits all the frames after which it does not receive any positive ACK.
The sender in this case, sends only packet for which NACK is received.
Multiple Access Links and Protocols
Two types of “links”:
• point-to-point
– PPP for dial-up access
– point-to-point link between Ethernet switch and host
• broadcast (shared wire or medium)
– old-fashioned Ethernet
– 802.11 wireless LAN
humans at a
cocktail party
shared wire (e.g., shared RF
shared RF (shared air, acoustical)
cabled Ethernet) (e.g., 802.11 WiFi)
(satellite)
MUNESH MEENA
MCA 3rd Sem (MLSU)
Point-to-point networks
MUNESH MEENA
MCA 3rd Sem (MLSU)
Broadcast networks
Broadcast networks have a single communication channel that is shared by all the
machines on the network.
Shared channel
MUNESH MEENA
MCA 3rd Sem (MLSU)
Multiple Access protocols
MUNESH MEENA
MCA 3rd Sem (MLSU)
Need of protocols in Broadcast channel
MUNESH MEENA
MCA 3rd Sem (MLSU)
Types of Multiple –access protocol
MUNESH MEENA
MCA 3rd Sem (MLSU)
RANDOM ACCESS
MUNESH MEENA
MCA 3rd Sem (MLSU)
ALOHA
There are two versions of Aloha system which differ with respect to
whether or not time is divided up into discrete slots into which all
frames must fit. :
PURE ALOHA
SLOTTED ALOHA
MUNESH MEENA
MCA 3rd Sem (MLSU)
Pure Aloha
MUNESH MEENA
MCA 3rd Sem (MLSU)
If the first bit of a new frame overlaps with just the last bit of a frame
almost finished, both the frames will be totally destroyed. It does not
distinguish between a total loss or a near miss.
MUNESH MEENA
MCA 3rd Sem (MLSU)
Slotted Aloha
• The stations can only transmit data in one of the time slots only.
• The vulnerable period is now reduced in half. If the frames collide they will
overlap completely instead of partially.
MUNESH MEENA
MCA 3rd Sem (MLSU)
Vulnerable time for slotted ALOHA protocol
MUNESH MEENA
MCA 3rd Sem (MLSU)
MUNESH MEENA
MCA 3rd Sem (MLSU)
CSMA (Carrier Sense Multiple Access)
CSMA: listen before transmit:
MUNESH MEENA
MCA 3rd Sem (MLSU)
CSMA collisions
spatial layout of nodes
collision:
entire packet transmission
time wasted
note:
role of distance & propagation delay in
determining collision probability
MUNESH MEENA
MCA 3rd Sem (MLSU)
Carrier sense multiple access with collision detection
• Carrier Sense:- listen for traffic on medium and determines gap between frames.
• Multiple Access:- Station can transmit any time when find network quite.
• Collision Detection:- Occurs when two stations transmits at same time. It gets detected
and trans. Holds for random time.
MUNESH MEENA
MCA 3rd Sem (MLSU)
CSMA/CD (Collision Detection)
MUNESH MEENA
MCA 3rd Sem (MLSU)
Station is
Station is ready to send
ready to send
New attempt
Wait according to
backoff
Station strategy
is ready to send
(6)
Sense
channel
(1) Channel busy (3)
Channel free
(2)
MUNESH MEENA
MCA 3rd Sem (MLSU)
Carrier sense multiple access with collision avoidance(CSMA/CA)
• Motivation
– In a wireless network, the received signal has very little energy due
to energy loss in transmission a collision may add only 5~10%
additional energy not useful for effective collision detection
• Features
– Tries to avoids collision
– Used in Wireless LAN
Difficult to detect collisions
Hidden node problem!
(CTS/RTS used in 802.11)
MUNESH MEENA
MCA 3rd Sem (MLSU)
• Timing in CSMA/CA
MUNESH MEENA
MCA 3rd Sem (MLSU)
1-persistent
MUNESH MEENA
MCA 3rd Sem (MLSU)
Controlled Access
• Approach
– The stations consult one another to find which station has the right
to send
• Controlled access methods
– Reservation
• Ex. DQDB, Cable modem, …
– Polling
• Select and Poll
• Ex. HDLC (normal response mode)
– Token passing
• Ex. Token ring (FDDI), token bus, …
MUNESH MEENA
MCA 3rd Sem (MLSU)
Reservation
• Features
– Time is divided into intervals
• In each interval, a reservation frame precedes the data frames sent in
that interval
– N stations N reservation minislots in the reservation frame
• When a station needs to send a data frame it makes a reservation
in its own minislot
MUNESH MEENA
MCA 3rd Sem (MLSU)
Polling
• Motivation and features
– Communication for primary-secondary stations topology
• Ex. NRM mode of HDLC
– The primary station is always the initiator of a session
• By polling (PS) and selecting (PS)
• Select and Poll
MUNESH MEENA
MCA 3rd Sem (MLSU)
Token Passing
• Features
– A station is authorized to send data when it receives a special frame called
a token
– Stations are arranged around a ring (physically or logically)
• A token circulates around the ring
– If a station needs to send data, it waits for the token
– The station captures the token and sends one or more frames as long as
the allocated time has not expired
– It releases the token to be used by the successor station
MUNESH MEENA
MCA 3rd Sem (MLSU)
• Procedure
MUNESH MEENA
MCA 3rd Sem (MLSU)
Channelization
• Definition
– A Multiple-access method in which the available BW of a link is
shared in time, frequency, or through code, between different
stations
• Features
– FDMA, TDMA are based on FDM and TDM in the physical layer
– CDMA is a data link multiple-access protocol
MUNESH MEENA
MCA 3rd Sem (MLSU)
FDMA
• Approach and features
– A data link layer protocol that uses FDM at the physical layer
– The available BW is shared by all stations
– Each stations uses its allocated band to send its data
– Ex. AMPS (1G cellular networks)
MUNESH MEENA
MCA 3rd Sem (MLSU)
MUNESH MEENA
MCA 3rd Sem (MLSU)
TDMA
• Approach and features
– A data link layer protocol that uses TDM at the physical layer
– The stations share the capacity of the channel in time
– Each station is allocated a time slot during which it can send data
– Ex. GSM (2G cellular networks - Europe)
MUNESH MEENA
MCA 3rd Sem (MLSU)
MUNESH MEENA
MCA 3rd Sem (MLSU)
Code Division Multiple Access (CDMA)
• used in several wireless broadcast channels (cellular, satellite,
etc) standards
• unique “code” assigned to each user; i.e., code set partitioning
• all users share same frequency, but each user has own “chipping”
sequence (i.e., code) to encode data
• encoded signal = (original data) X (chipping sequence)
• decoding: inner-product of encoded signal and chipping
sequence
• allows multiple users to “coexist” and transmit simultaneously
with minimal interference (if codes are “orthogonal”)
MUNESH MEENA
MCA 3rd Sem (MLSU)
CDMA Encode/Decode
.
d0 = 1
Zi,m= di cm
data d1 = -1
1 1 1 1 1 1 1 1
sender bits -1 -1 -1 -1 -1 -1 -1 -1
slot 1 slot 0
1 1 1 1 1 1 1 1
channel channel
code -1 -1 -1 -1 -1 -1 -1 -1 output output
slot 1 slot 0
M
.
Di = S Zi,m cm
m=1
1 1 1 1 1 1
M
received 1 1
d0 = 1
-1 -1 -1 -1 -1 -1 -1 -1
receiver input d1 = -1
slot 1 slot 0
1 1 1 1 1 1 1 1
channel channel
code -1 -1 -1 -1 -1 -1 -1 -1 output output
slot 1 slot 0
MUNESH MEENA
MCA 3rd Sem (MLSU)
CDMA: two-sender interference
MUNESH MEENA
MCA 3rd Sem (MLSU)
Thanks!
MUNESH MEENA
MCA 3rd Sem (MLSU)