Unit II - PPT Slides
Unit II - PPT Slides
a) Fixed-Size Framing
[ The size itself acts as delimiter or frame boundary ]
b) Variable-Size Framing
[ special character or bit pattern called flag is used as delimiter ]
A frame in a character-oriented protocol
Note
Note
➢ I-frames are designed to carry user data from the network layer.
➢ Unnumbered frames are used to exchange session management and control
information between connected devices.
➢ Supervisory frames are used for flow and error control
c) Control Field Format ( for the different frame types )
Error control in the data link layer is based on automatic repeat request (ARQ),
which is the retransmission of data.
Error Detection and Correction
What does accuracy means?
NOTE:
Burst error is more likely to occur
than a single-bit error
Redundancy
The central concept in detecting or correcting errors
is redundancy. To be able to detect or correct errors,
we need to send some extra bits with our data. These
redundant bits are added by the sender and removed
by the receiver. Their presence allows the receiver to
detect or correct corrupted bits.
Detection versus Correction
▪ Block coding
▪ Convolution coding
BLOCK CODING
• Modulo 2 arithmetic
— Binary addition with no carries
— Binary subtraction with no carries
— The same as XOR operation
10.24
Example
Let us find the Hamming distance between two pairs of
words.
10.25
Example 10.3
Table 10.1: A code for error detection in Example 10.1
10.32
Performance
It can detect single bit error
It can detect burst errors only if the total number of errors
is odd.
An observation of the
table reveals that to
move from one code
word to another, at least
two data bits should be
changed. Hence these
set of code words are
said to have a minimum
distance ( hamming
distance ) of 2
Error Detection Methods
• Longitudinal Redundancy Check (LRC)
– Organize data into a table and create a parity
for each column
11100111 11011101 00111001 10101001
11100111
11011101
00111001
10101001
10101010
NOTE:
➢ Calculate the parity bit for each data unit, then organize
them into table (rows and columns)
➢ Calculate the parity bit for each column and create a new
row (column parity)
➢ A redundant row of bits is added to the whole block.
Two-dimensional Performance
Two-dimensional Performance
➢ Increases the likelihood of detecting burst errors.
➢ A redundancy of n-bits can detect a burst error of n bits.
➢ A burst error of more than n bits is also detected with a
very high probability.
➢ One pattern of errors still elusive:
If 2 bits in one data unit are damaged and two
bits in exactly the same position in another data unit are
also damaged. The error will not be detected.
Cyclic Redundancy Check
• Given a k-bit frame or message, the
transmitter generates an n-bit sequence,
known as a frame check sequence (FCS) ,
so that the resulting frame, consisting of
(k+n) bits, is exactly divisible by some
predetermined number.
• The receiver then divides the incoming
frame by the same number and, if there is
no remainder, assumes that there was no
error.
Cyclic Redundancy Check
• Powerful error detection scheme
• Rather than addition, binary division is
used
• Can be easily implemented with small
amount of hardware
– Shift registers
– XOR (for addition and subtraction)
k bits n bits
• Associate bits with coefficients of a
polynomial
1 0 1 1 0 1 1
1x 6 +0x 5 +1x 4 +1x 3 +0x 2 +1x1+1
= x 6 +x 4 +x 3 +x+1
Cyclic Redundancy Check
• Let M(x) be the message polynomial
• Let P(x) be the generator polynomial
– P(x) is fixed for a given CRC scheme
– P(x) is known both by sender and receiver
• Create a block polynomial F(x) based on
M(x) and P(x) such that F(x) is divisible by
P(x)
Cyclic Redundancy Check
• Sending
1. Multiply M(x) by x n
2. Divide x n M(x) by P(x)
3. Ignore the quotient and keep the reminder C(x)
4. Form and send F(x) = x n M(x)+C(x)
• Receiving
1. Receive F’(x)
2. Divide F’(x) by P(x)
3. Accept if remainder is 0, reject otherwise
10.50
Figure 10.15 Division in CRC encoder
10.
Figure 10.16 Division in the CRC decoder for two cases
10.
Figure 10.9: CRC division using polynomials
10.53
Advantages of Cyclic Codes
➢ We have seen that cyclic codes have a very good
performance in detecting single-bit errors, double
errors, an odd number of errors, and burst
errors.
10.
CHECKSUM
Example 10.18
10.
Example
10.
Example
10.
(continued)
➢ The receiver follows the same procedure as the sender. It adds all data items
(including the checksum); the result is 45.
➢ The sum is wrapped and becomes 15. The wrapped sum is complemented and
becomes 0. Since the value of the checksum is 0, this means that the
data is not corrupted.
➢ The receiver drops the checksum and keeps the other data items. If the
checksum is not zero, the entire packet is dropped.
1111
1001 0000
10.
Table 10.5: Procedure to calculate the traditional checksum
10.61
Checksum Performance
➢ Checksum can detect errors in a message of
any size.
10.63
Hamming Code
➢ Developed by R.W.Hamming
➢ It applied to data units of any length uses the data & redundancy bits.
➢ positions of redundancy bits in Hamming code
❖ All bit positions that are powers of two (have only one 1 bit in the
binary form of their position) are parity bits.
• 7 bit data require 4 bit redundancy placed in 1,2,4,8
❖ Parity bit 1 covers all bit positions which have the least significant bit set: bit
1 (the parity bit itself), 3, 5, 7, 9, etc.
❖ Parity bit 2 covers all bit positions which have the second least significant bit
set: bit 2 (the parity bit itself), 3, 6, 7, 10, 11, etc.
❖ Parity bit 4 covers all bit positions which have the third least significant bit
set: bits 4–7, 12–15, 20–23, etc.
❖ Parity bit 8 covers all bit positions which have the fourth least significant bit
set: bits 8–15, 24–31, 40–47, etc.
Example: 8-bit data word 1001101
Include 4 parity bits and the 7-bit word 11 bits
Bit position: 11 10 9 8 7 6 5 4 3 2 1
1 0 0 P 8 1 1 0 P 4 1 P2 P 1
Calculate the parity bits: even parity ⎯ assumption
P1 = XOR of bits (3, 5, 7, 9, 11) = 1 0 1 0 1 = 1
P2 = XOR of bits (3, 6, 7, 10, 11) = 1 1 1 0 1 = 0
P4 = XOR of bits (5, 6, 7) = 0 1 1 = 0
P8 = XOR of bits (9, 10, 11) = 0 0 1 = 1
Error Detection and Correction
• each r bit is the VRC bit for one combination of data bits
r1 = bits 1, 3, 5, 7, 9, 11
r2 = bits 2, 3, 6, 7, 10, 11
r4 = bits 4, 5, 6, 7
r8 = bits 8, 9, 10, 11
Error detection using Hamming Code
r1 = bits 1, 3, 5, 7, 9, 11
r2 = bits 2, 3, 6, 7, 10, 11
r4 = bits 4, 5, 6, 7
r8 = bits 8, 9, 10, 11
➢ 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
3.89
Propagation and Transmission Delay
◼ The transmission delay is the amount of time required for the router
to push out all the packet in a message
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
In the Go-Back-N Protocol, the sequence numbers are modulo 2m, where m is
the size of the sequence number field in bits.
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
Will work
correctly Will work
Note erroneously
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
Acknowledgement
Frame-2 lost.
Retransmission of
Frames 1, 2 and 3.
Note
Stop-and-Wait ARQ is a special case of Go-Back-N ARQ in which the size of
the send window is 1.
5. Selective Repeat ARQ Protocol
➢ Go-Back-N ARQ simplifies the process at the receiver site.
The receiver keeps track of only one variable, and there is no
need to buffer out-of-order frames; they are simply discarded.
➢ However, this protocol is very inefficient for a noisy link. In a
noisy link a frame has higher probability of damage, which
means the resending of multiple frames. This resending uses
up the bandwidth and slows down the transmission.
➢ For noisy links, there is another mechanism that does not
resend N frames when just one frame is damaged; only the
damaged frame is resent. This mechanism is called Selective
Repeat ARQ. It is more efficient for noisy links, but
processing at the receiver is more complex.
Windows
a) Send window for Selective Repeat ARQ
Will work
correctly Will work
erroneously
Note : In Selective Repeat ARQ, the size of the sender and receiver
window must be at most one-half of 2m.
b) Algorithms
Sender Site
(continued . . . . . . . . . )
(continued . . . . . . . . . )
Receiver Site
(continued . . . . . . . . . )
(continued . . . . . . . . . )
Delivery of data in Selective Repeat ARQ
c) Flow diagram
A is ready to receive
frame 0