Professional Documents
Culture Documents
DCN - 8 - Error Correction Techniques in Datalink and Transport Layers
DCN - 8 - Error Correction Techniques in Datalink and Transport Layers
3
Flow & Error Control
4
Note
• Traditionally four protocols have been defined for the data-link layer
to deal with flow and error control:
– Simple
– Stop-and-Wait
– Go-Back-N
– Selective-Repeat.
• Although the first two protocols still are used at the data-link layer,
the last two have disappeared .
• In a connectionless service, the sender sends packets to the receiver without any
connection establishment.
• In a connection-oriented service, the client and the server first need to establish a
connection between themselves.
– The Stop-and-Wait protocol provides both flow and error control, but is inefficient.
– The Go-Back-N protocol is the more efficient version of the Stop-and-Wait protocol and takes
advantage of pipelining.
– The Selective-Repeat protocol, a modification of the Go-Back-N protocol, is better suited to handle
packet loss.
• We assume that the receiver can immediately handle any frame it receives. In
other words, the receiver can never be overwhelmed with incoming frames.
• The data-link layer at the sender gets a packet from its network layer, makes a
frame out of it, and sends the frame.
• The data-link layer at the receiver receives a frame from the link, extracts the
packet from the frame, and delivers the packet to its network layer.
• The data-link layers of the sender and receiver provide transmission services for
their network layers.
11.12
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
Simple Protocol
• Sender site should not send a frame until its network layer has a message to send.
•
• Receiver site cannot deliver a message to its network layer until a frame arrives.
• Sending machine remains in the ready state until a request comes from the process in
the network layer. When this event occurs, the sending machine encapsulates the
message in a frame and sends it to the receiving machine.
• Receiving machine remains in the ready state until a frame arrives from the sending
machine. When this event occurs, the receiving machine decapsulates the message out
of the frame and delivers it to the process at the network layer.
• It is very simple. The sender sends a sequence of frames without even thinking
about the receiver. To send three frames, three events occur at the sender site and
three events at the receiver site. Note that the data frames are shown by tilted
boxes; the height of the box defines the transmission time difference between the
first bit and the last bit in the frame.
Flow diagram
Algorithm _ Sender-site algorithm for the simplest protocol
Algorithm _ Receiver-site algorithm for the simplest protocol
Example 11.2
1. Stop-and-Wait Protocol
Example
Flow diagram
Algorithm _ Sender-site algorithm for Stop-and-Wait Protocol
Algorithm _ Receiver-site algorithm for Stop-and-Wait Protocol
2. Stop-and-Wait Automatic Repeat Request
25
Note
• Timers introduced
• Positive ACK sent only for frames received safe & sound
27
A Simplex Stop-and-Wait ARQ
28
1. Normal Procedure for Stop-And-Wait ARQ
• 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.
3. Stop-and-Wait, lost ACK frame
• If a node receive a frame and does not have data to be sent then an ACK
frame is sent alone
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.
Disadvantage of Stop-and-Wait
• In networking and in other areas, a task is often begun before the previous task has ended. This is
known as pipelining.
• There is no pipelining in the Stop-and-Wait protocol because a sender must wait for a packet to
reach the destination and be acknowledged before the next packet can be sent.
• However, pipelining does apply to our next two protocols because several packets can be sent
before a sender receives feedback about the previous packets.
• Pipelining improves the efficiency of the transmission if the number of bits in transition is large
with respect to the “bandwidth delay product”.
Idea:
Allow Sender to keep
transmitting a “window” of
packets while waiting for
ACKs
Window-based ARQs
48
3. Go-Back-N ARQ
49
Go-Back-N ARQ _ General Comments
• The first is called Go-Back-N (GBN) (the justification for the name will become clear
later).
• The key to Go-back-N is that we can send up to W frames before worrying about
ACKs.
Sequence numbers
Sent frames are numbered sequentially
Number of frames stored in the header
if the number of bits in the header is m than
sequence number goes from 0 to 2m -1
sequence
number
Sliding window frame
to hold the unacknowledged
outstanding frames
the receiver window size
always 1
acknowledged
frames
59
3. Go-Back-N ARQ _ Send Window
60
4. Receive
Go-Back-N Window
ARQ _ Receive Window
The receive window makes sure that the correct data packets are
received and that the correct acknowledgments are sent.
61
4. Go-Back-N ARQ _ Receive Window
Note that we need only one variable, Rn (receive window, next packet expected), to
define this abstraction.
The sequence numbers to the left of the window belong to the packets already
received and acknowledged; the sequence numbers to the right of this window
define the packets that cannot be received.
Any received packet with a sequence number in these two regions is discarded.
Only a packet with a sequence number matching the value of Rn is accepted and
acknowledged.
The receive window also slides, but only one slot at a time. When a correct packet is
received, the window slides, Rn (Rn 1)
62
4. Go-Back-N ARQ _ Receive Window
63
5. Go-back-N _Control variables
64
6. Timers
When the timer expires, the sender resends all outstanding packets.
For example
Suppose the sender has already sent packet 6 (Sn =holds the sequence number
that will be assigned to the next packet to be sent7), but the only timer
expires.
If First outstanding Frame (Sf ) 3,this means that packets 3, 4, 5, and 6 have not
been acknowledged; the sender goes back and resends packets 3, 4, 5, and 6.
That is why the protocol is called Go-Back-N.
On a time-out, the machine goes back N locations and resends all packets.
66
Hence the name of Go-back-N: why?
Re-sending frame
when the frame is damaged the sender goes back and sends a
set of frames starting from the last one ACKn’d
the number of retransmitted frames is N
67
8. Go-Back-N ARQ _Normal operation
ACK1 – not
necessary if ACK2
is sent
Cumulative ACK
• Acknowledgements
are cumulative
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
10_ Go-Back-N ARQ _Damaged /Lost / Delayed ACK
Data 0
Data 1 Lost ACK case
Data 2
Timer expires
ACK 3
Lost
Data 0
Data 1
Data 2
Window Size 3
ECE 766
Winter 2006
Computer Interfacing and
ECE Protocols
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Note
(continued)
11.77
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Algorithm _ Go-Back-N sender algorithm
11.78
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Algorithm 11.8 Go-Back-N receiver algorithm
Draw the sender and receiver windows for a system using Go-back-N ARQ, where
a 3 bit field is used and given the following:
(a) Frame 0 is sent; Frame 0 is acknowledged.
(b) Frames 1 and 2 are sent; Frames 1 and 2 are acknowledged.
(c) Frames 3, 4, and 5 are sent; Frames 3 and 4 is acknowledged; Timer for Frame 5
expires.
(d) Frames 5, 6, and 7 are sent; Frames 5 through 7 are acknowledged.
Go-back-N
Solution ?
re-send only the damaged frames so Selective Repeat ARQ i.e. avoid
unnecessary retransmissions
81
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2004
Strength and weakness of Go-Back-N ARQ
83
• 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 the processing at the receiver is
more complex.
Selective Repeat ARQ
• As in Go-Back-N
– Packet sent when available up to window limit
• Unlike Go-Back-N
– Out-of-order (but otherwise correct) is ACKed
– Receiver: buffers out-of-order packets
– Sender: on timeout of packet k, retransmit just k
• Comments
– More receiver buffering than Go-Back-N
– More complicated buffer management by both sides
– Saves bandwidth
89
Selective Repeat ARQ, sender and receiver windows
• Go-Back-N ARQ simplifies the process at the receiver site. Receiver only keeps
track of only one variable, and there is no need to buffer out-of-order frames,
they are simply discarded.
• However, Go-Back-N ARQ protocol is inefficient for noisy link. It bandwidth
inefficient and slows down the transmission.
• In Selective Repeat ARQ, only the damaged frame is resent. More bandwidth
efficient but more complex processing at receiver.
• It defines a negative ACK (NAK) to report the sequence number of a damaged
frame before the timer expires.
Selective Repeat ARQ, lost frame
• Receiver sends a
NAK2 to show that
frame 2 has not been
received and then
sender resends only
frame 2 and it is
accepted as it is in
the range of the
window.
Protocols Using Go-back N
Data 3
Data 6
Window size 7
• Bandwidth
• capacity of the system
• Throughput
• No. of bits that can be pushed through
• Latency (Delay)
• Delay incurred by a bit from start to finish
Some basic definitions
Propagation speed
Speed at which a bit travels though the medium from source to destination.
Transmission speed
the speed at which all the bits in a message arrive at the destination.
(difference in arrival time of first and last bit)
Some basic definitions
Bandwidth-Delay Product
In other words ‘The result of BDP is an amount of data
measured in bits (or bytes), is equivalent to the maximum
amount of data on the network circuit at any given time, i.e.,
data that has been transmitted but not yet acknowledged.’
Note
3.100
TCP and BD Product
Bandwidth-delay product
Capacity of the “pipe” between a TCP sender and a TCP
receiver
Inadequacy of TCP, as bandwidth-delay product
increases
Prone to instability
Inefficient
101
Revision _ Bandwidth*Delay Product
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%. For this reason, for a link with high bandwidth or long
delay, use of Stop-and-Wait ARQ wastes the capacity of the link.
Example 2
What is the utilization percentage of the link in Example 1 if the link uses Go-
Back-N ARQ with a 15-frame sequence?
Solution
The bandwidth-delay product is still 20,000. The system can send up to 15
frames or 15,000 bits during a round trip. This means the utilization is
15,000/20,000, or 75 percent. Of course, if there are damaged frames, the
utilization percentage is much less because frames have to be resent.
FLOW CONTROL
Note:
• The two methods we discussed for error control can actually provide
flow control at the same time.
• Stop and wait ARQ provides flow control because the frames are sent one by
one.
• Sliding-window ARQ provides flow control because the size of the sending
window can be matched to the size of the receiver buffer.
Thanks