Академический Документы
Профессиональный Документы
Культура Документы
5/19/16
Requirements:
A fast sender should not overwhelm a slow
receiver, which must perform a certain
amount of processing before passing the
data on to the higher-level software.
If error occur during transmission, it is
necessary to devise mechanism to correct it
The most important functions of Data Link
layer to satisfy the above requirements are
error control and flow control.
Collectively, these functions are known as
data link control
5/19/16
Flow Control
Flow Control is a technique so that transmitter
and receiver with different speed characteristics
can communicate with each other.
Flow control ensures that a transmitting station,
such as a server with higher processing
capability, does not overwhelm a receiving
station, such as a desktop system, with lesser
processing capability.
This is where there is an orderly flow of
transmitted data between the source and the
destination.
5/19/16
Flow Control
Flow control coordinates the amount of data that can be
sent before receiving acknowledgement
It is one of the most important functions of data link layer.
Flow control is a set of procedures that tells the sender
how much data it can transmit before it must wait for an
acknowledgement from the receiver.
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.
5/19/16
5/19/16
5/19/16
10
5/19/16
11
link utilization(cont..)
link utilization is strongly dependent on the
ratio of the propagation time to the
transmission time.
When the propagation time is small, as in
case of LAN environment, the link utilization is
good.
But, in case of long propagation delays, as in
case of satellite communication, the utilization
can be very poor.
To improve the link utilization, we can use the
sliding-window protocol instead of using stopand-wait protocol.
5/19/16
12
Sliding Window
With the use of multiple frames for a single
message, the stop-and-wait protocol does
not perform well.
Only one frame at a time can be in transit.
In stop-and-wait flow control, if a > 1,
serious inefficiencies result.
Efficiency can be greatly improved by
allowing multiple frames to be in transit at
the same time.
Efficiency can also be improved by making
use of the full-duplex line.
5/19/16
13
Sliding Window(sender)
To keep track of the frames, sender station sends
sequentially numbered frames.
Since the sequence number to be used occupies
a field in the frame, it should be of limited size.
If the header of the frame allows k bits, the
sequence numbers range from 0 to 2k 1.
Sender maintains a list of sequence numbers
that it is allowed to send (sender window).
The size of the senders window is at most 2k
1.
The sender is provided with a buffer equal to
the window size.
5/19/16
14
Sliding
Window(Receiver)
15
5/19/16
16
5/19/16
17
5/19/16
18
Sender
5/19/16
19
Receiver
5/19/16
20
U = 1,
for N > 2a + 1
N /(1+2a),
for N < 2a + 1
Where N = the window size,
and a = Propagation time /
transmission time
EX. K=5 then N=2^5-1=31
a=10 then U=1 &
When a=100 then U=31/(1+200)
5/19/16
21
Types of Errors
Detection
Correction
Basic concepts
Networks must be able to transfer
data from one device to another with
complete accuracy.
Data can be corrupted during
transmission.
For reliable communication, errors
must be detected and corrected.
Error detection and correction are
implemented either at the data link
layer or the transport layer of the OSI
5/19/16
23
Types of Errors
5/19/16
24
Single-bit error
5/19/16
25
26
Burst error
5/19/16
27
5/19/16
28
5/19/16
29
Error detection
Error detection means to decide
whether the received data is correct
or not without having a copy of the
original message.
Error detection uses the concept of
redundancy, which means adding
extra bits for detecting errors at the
destination.
5/19/16
31
Redundancy
5/19/16
32
Error detection
techniques:
Popular techniques are:
1.Simple Parity check
2.Two-dimensional Parity
check
3.Checksum
4.Cyclic redundancy check
5/19/16
33
5/19/16
34
5/19/16
35
5/19/16
36
1110010
37
5/19/16
38
Performance can be improved by using twodimensional parity check, which organizes the
block of bits in the form of a table.
Parity check bits are calculated for each row,
which is equivalent to a simple parity check bit.
Parity check bits are also calculated for all
columns then both are sent along with the data.
At the receiving end these are compared with
the parity bits calculated on the received data
5/19/16
39
5/19/16
40
5/19/16
41
5/19/16
42
Performance
It can detect single bit error
It can detect burst errors only if the
total number of errors is odd.
5/19/16
43
5/19/16
44
Performance
LCR increases the likelihood of
detecting burst errors.
If two bits in one data units are
damaged and two bits in exactly
the same positions in another data
unit are also damaged, the LRC
checker will not detect an error.
5/19/16
45
5/19/16
46
(2) Checksum
The sender follows these steps:
The unit is divided into k sections, each of n bits.
All sections are added using ones complement to get
the sum.
The sum is complemented and becomes the
checksum.
The checksum is sent with the data.
47
Example Part 1
Suppose the following block of 16 bits is to be sent
using a checksum of 8 bits.
10101001 00111001
10101001
00111001
-----------11100010
Sum
Checksum
00011101
10101001 00111001
48
Example part 2
Now suppose the receiver receives the pattern sent in
Example 7 and there is no error.
10101001 00111001 00011101
When the receiver adds the three sections, it will get all 1s,
which, after complementing, is all 0s and shows that there
is no error.
10101001
00111001
00011101
Sum11111111
Complement
5/19/16
49
50
Cyclic Redundancy
Check
5/19/16
51
5/19/16
52
5/19/16
53
54
Binary Division
5/19/16
55
5/19/16
56
5/19/16
57
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.
5/19/16
58
59
60
5/19/16
61
5/19/16
62
63
5/19/16
64
5/19/16
65
Stop-andWait
5/19/16
67
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.
5/19/16
68
Stop-and-Wait, delayed
ACK frame
The ACK can be
delayed at the
receiver or due to
some problem
It is received after the
timer for frame 0 has
expired.
Sender retransmitted
a copy of frame 0.
However, R =1 means
receiver expects to
see frame 1. Receiver
discards the duplicate
frame 0.
Sender receives 2
ACKs, it discards the
second ACK.
5/19/16
69
Piggybacking
A method to
combine a data
frame with ACK.
Station A and B
both have data to
send.
Instead of sending
separately, station
A sends a data
frame that includes
an ACK.
Station B does the
same thing.
Piggybacking saves
bandwidth.
5/19/16
70
Disadvantage of Stop-andWait
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
5/19/16
71
Go-Back-N ARQ
We can send up to W frames before
worrying about ACKs.
We keep a copy of these frames until
the ACKs arrive.
This procedure requires additional
features to be added to Stop-andWait ARQ.
5/19/16
72
Sequence Numbers
Frames from a sender are numbered sequentially.
We need to set a limit since we need to include the
sequence number of each frame in the header.
If the header of the frame allows m bits for
sequence number, the sequence numbers range
from 0 to 2 m 1. for m = 3, sequence numbers
are: 0,1, 2, 3, 4, 5, 6, 7.
We can repeat the sequence number.
Sequence numbers are:
0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1,
5/19/16
73
Sender Sliding
Window
At the sending site,
to hold the
outstanding frames
until they are
acknowledged, we
use the concept of a
window.
The size of the
window is at most
2m -1 where m is the
number of bits for
the sequence
number.
Size of the window
can be variable, e.g.
5/19/16
TCP.
74
Receiver Sliding
Window
Size of the window
at the receiving
site is always 1 in
this protocol.
Receiver is always
looking for a
specific frame to
arrive in a specific
order.
Any frame arriving
out of order is
discarded and
needs to be resent.
Receiver window
slides as shown in
5/19/16
75
Control Variables
5/19/16
76
Acknowledgement
Receiver sends positive ACK if a frame arrived safe and in
order.
If the frames are damaged/out of order, receiver is silent and
discard all subsequent frames until it receives the one it is
expecting.
The silence of the receiver causes the timer of the
unacknowledged frame to expire.
Then the sender resends all frames, beginning with the one
with the expired timer.
For example, suppose the sender has sent frame 6, but the
timer for frame 3 expires (i.e. frame 3 has not been
acknowledged), then the sender goes back and sends
frames 3, 4, 5, 6 again. Thus it is called Go-Back-N-ARQ
The receiver does not have to acknowledge each frame
received, it can send one cumulative ACK for several frames.
5/19/16
77
5/19/16
78
Go-Back-N ARQ,
damaged or lost frame
5/19/16
Frame 2 is
lost
When the
receiver
receives
frame 3, it
discards
frame 3 as it
is expecting
frame 2
(according to
window).
After the
timer for
frame 2
expires at the
79
5/19/16
80
5/19/16
81
82
5/19/16
83
5/19/16
Accepts
as the
1st
frame in
the next
84
cycle-an
5/19/16
85
Frames 0
Selective Repeat ARQ, lost frame
5/19/16
and 1 are
accepted
when
received
because
they are in
the range
specified by
the receiver
window.
Same for
frame 3.
Receiver
sends a
NAK2 to
show that
frame 2 has
not been
received and
86
then sender
Size of the sender and receiver windows must be at most onehalf of 2 m. If m = 2, window size should be 2 m /2 = 2. Fig
compares a window size of 2 with a window size of 3. Window
size is 3 and all ACKs are lost, sender sends duplicate of frame
0, window of the receiver expect to receive frame 0 (part of the
window), so accepts frame 0, as the 1st frame of the next cycle
an error.
5/19/16
87