Data Link Layer

2. Data Link Layer: Error
Control & Flow Control
Data Link Layer
 Data Link Layer provides a
service for Network Layer
(transfer of data from the
network layer of a sender to
the network layer of a
receiver)
 Data Link Layer uses the
Physical Layer to transmit
bits of Data Link Frames
over the physical medium
© Tallal Elshabrawy
Network
LLC
MAC
Physical
2
Bit Errors in Communication Systems
 At the physical layer, bit error are inevitable to
occur with small but non zero probability, example:
 Bit error probability in the order of 10-6 for systems using copper
wires
 Bit error probability in the order of 10-9 for modern optical fiber
systems
 High bit error probability in the order of 10-3 for wireless
transmission systems
 Some services are tolerant to relatively high bit error rates
such as digital speech transmission
 Some applications must experience error-free
communications such as electronic funds transfer
© Tallal Elshabrawy
3
Error Control
 Error Control is a system
to deal with errors that
occur due to disturbances
on the physical channel.
 Components of an error
control system:
Data
Frame 0
Timer
 Timers
No Errors
0
1
1
Errors
No Errors
Detection/
Correction
ACK
Frame is Good
 Error Correction and
Detection
 Acknowledgement (ACK) &
Non- Acknowledgement
Control Messages (NAK)
Receiver
Sender
1
Detection/
Correction
1
Detection/
Correction
ACK
Frame is Good
 Frame Sequencing
© Tallal Elshabrawy
4
Error Control Mechanisms
 Forward Error Correction (FEC)
 Detection of erroneous frames or packets
 Processing of received frame bits in attempt to correct
the errors
 Automatic Retransmission reQuest (ARQ)
 Detection of erroneous frames or packets
 Retransmission of erroneous frames with the hope that
no errors would occur in the next attempt
© Tallal Elshabrawy
5
Error Detecting Codes
 Add Redundant (Extra) Bits to deduce that an
error has Occurred. BUT NOT WHICH ERROR
 When it is detected that a packet is in error, a
retransmission is requested
 Example
 Parity Checks
 CRC: Cyclic Redundancy Check
© Tallal Elshabrawy
6
Flow Control
 Well-Defined Rules on when the sender could
transmit the next frame
© Tallal Elshabrawy
7
Automatic Repeat reQuest (ARQ) Protocols
 Purpose: to ensure a sequence of information
packets is delivered in order and without errors or
duplications despite transmission errors & losses
(Error Control & Flow Control)

We will look at:



Stop-and-Wait ARQ
Go-Back N ARQ
Selective Repeat ARQ
© Tallal Elshabrawy
8
Stop and Wait Protocol
Stop-and-Wait ARQ
 Stop after Transmitting a Frame
 Wait for an Acknowledgement
Packet
Information Frame
CRC
H
Transmitter
Error Free
Packet
Receiver
H CRC
ACK
H
CRC
© Tallal Elshabrawy
: Header
: Cyclic Redundancy Check
(Error Detection)
10
Importance of Sequence Numbers
Sender
A
Receiver
Sender
Frame 0
B
Receiver
Frame 0
ACK
ACK
Frame 1
Frame 1
Timeout
ACK
Timeout
Frame 1
Frame 1
ACK
Frame 2
ACK
Frame 2


In Scenario B, the receiver accepts Frame 1 Twice
If the frame number is not included in the header, how could the receiver distinguish
whether or not it has received Frame 1 correctly?
THEREFORE:
IT IS ESSENTIAL TO INCLUDE THE FRAME SEQUENCE NUMBER IN THE HEADER
© Tallal Elshabrawy
11
Sequence Numbers in ACK Frames

The sender may mistakenly
interpret ACK as it assumes
that the second ACK was
for Frame 1
Sender
C
Receiver
Frame 0

How Could the Sender
Know which Frame does an
ACK correspond to?
Timeout
ACK
Frame 0
ACK
BY INCLUDING THE
SEQUENCE NUMBER IN
THE ACK
Frame 1
ACK
Frame 2
© Tallal Elshabrawy
12
Stop-and-Wait ARQ Performance
Machine B
Machine A
Physical Channel
First Frame-Bit
enters Channels
Last Frame-Bit
enters Channels
Channel
is Idle
First Frame-Bit
arrives at B
Last Frame-Bit
arrives at B
Processing
Time
Last ACK-Bit
Arrives at A
 The Channel Idle Time (Wait for ACK) is an Inefficiency
because the channel is not used
© Tallal Elshabrawy
13
Stop-and-Wait ARQ Efficiency
Machine B
Machine A
Physical Channel
t0=2tprop+2tproc+tf+ta
t0=2tprop+2tproc+Lf/R+La/R
tprop
tf=Lf/R
t0=Total
Time to
Transmit
1 Frame
tprop
tproc
tf
ta
Lf
La
Propagation Time
Processing Time
Frame Transmission Time
ACK Transmission Time
No. of Bits/Frame
No. of Bits/ACK
© Tallal Elshabrawy
tproc
ta=La/R
tprop
tproc
14
Error-Free Channel
Headers and
CRC
Effective Transmission Rate
L f  Lh
No. of Inormation Bits per Frame
Reff 

Time Required to Deliver One Frame
t0
Effect of
Header
Transmission Efficiency
ηNo Error 
Reff
R

L f  Lh
Rt0
1

Lh
Lf
La 2 R  t proc  t prop 
1 
Lf
Lf
Effect of
ACK
Effect of Delay
Bandwidth Product
ηNoη NE
Error Efficiency Assuming ERROR FREE CHANNNEL
© Tallal Elshabrawy
15
Noisy Channel

Pf is the probability of Frame Error

If k Transmissions are Required

The Efficiency is
ηkE 
L f  Lh
R  kt0 
η No Error

k 
The Expected Efficiency

k 1
η No Error
η
1  Pf  Pf 

k 
k 1
© Tallal Elshabrawy
16