0% found this document useful (0 votes)
26 views64 pages

Chapter3 DataLinkLayer Withnotes

Data Link Layer - Computer Architecture notes

Uploaded by

c lamp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views64 pages

Chapter3 DataLinkLayer Withnotes

Data Link Layer - Computer Architecture notes

Uploaded by

c lamp
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 64

The Data Link Layer

Chapter 3

Slides courtesy: Sweta & Chebrolu

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
The Data Link Layer
• Responsible for delivering frames of
information over a single link (node-to-
node delivery)
Application
• Use services of the Physical Layer Transport
(which delivers bits) to deliver frames
Network
Link
Physical

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Frames

Link layer accepts packets from the network layer, and


encapsulates them into frames that it sends using the
physical layer; reception is the opposite process

Network

Link
Virtual data path

Physical Actual data path

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Link Layer Protocols

• Link can be point-to-point or multipoint (or broadcast)


• Protocol:
• Define format of frames to be exchanged over the
link
• In response to frames, action to be taken by
nodes
• Examples: Ethernet, Token-Ring, Wi-Fi, PPP, etc.

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Possible Services
• Framing
− Encapsulated packets into frames
− Establishes frame synchronization

• Error Control
− Ensuring that all frames are eventually delivered to the
network layer at the destination and in the proper order.

• Flow Control
− Ensuring that the sender does not overwhelm the receiver

• Link access: MAC protocol coordinates frame


transmissions of many nodes in multiaccess
channels.

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Outline

• Framing
• Error Control
• Error Detection
• Elementary Data Link Protocols
• Sliding Window Protocols

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Framing

• Byte count
• Flag bytes with byte stuffing
• Flag bits with bit stuffing

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Framing
• Blocks of data (termed frames at data link layer)
exchanged between nodes
• Typical frame structure

• How do you determine which set of bits constitutes a


frame?

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Framing – Byte count

Frame begins with a count of the number of bytes in it


• Simple, but difficult to resynchronize after an error

Expected
case

Error
case

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Framing – Byte stuffing

Special flag bytes delimit frames; occurrences of flags in


the data must be stuffed (escaped)
• Longer, but easy to resynchronize after error

Frame
format

Need to escape
extra ESCAPE
bytes too!
Stuffing
examples

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Framing – Bit stuffing

Stuffing done at the bit level:


• Frame flag has six consecutive 1s (01111110, not
shown)
• On transmit, after five 1s in the data, a 0 is added
• On receive, a 0 after five 1s is deleted
Data bits

Transmitted bits
with stuffing

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Error Control

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Error Control
What cause errors?
• Distortion of signals due to frequency dependent
attenuation, noise (PHY layer)
• Random single-bit vs Burst errors
Error control repairs frames that are received in error
• Requires errors to be detected at the receiver
• After detection:
− Drop Frame
» Higher layers (e.g., TCP) will recover or few losses don’t hurt
applications (e.g., audio)
− Recover Frame
» Error Correction
» Retransmission
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Error Correction vs Retransmission

Error correction requires more redundant bits per frame


than error detection
• Redundancy bits are sent all the time (every frame)
Retransmission requires another copy to be transmitted
• Copy sent only on error

Error correction is useful when error rate is high (e.g.,


wireless) or cost of retransmission is too high (e.g.,
satellite link)

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Framework
• Add redundant information to a frame to detect or correct
errors
• At sender: add k bits of redundant data to a m bit
message, where k is derived from the original message
through some algorithm
• At receiver: reapply same algorithm as sender to detect
errors; take corrective action if necessary
• Code rate: m/(m+k)
• Detection: k<<m; k=32; m ~ 12,000 for Ethernet
• Correction: Wi-Fi code rates range from ½ to 5/6

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Error Bounds – Hamming distance (1)

Code turns data of m bits into a codeword of m+k bits


Hamming distance between two codewords:
• Number of bits they differ in
• XOR the two codewords
• Example:
• Codewords: 01110110, 00011101

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Error Bounds – Hamming distance (2)
Number of possible codewords: 2𝑚+𝑘
Number of legal codewords: 2𝑚
Hamming distance of a code (=d):
• Minimum bit flips to turn one valid codeword into any
other valid one.
• Among the list of legal codewords, find the smallest
hamming distance between two codewords
• Example:
− 0000000000, 0000011111, 1111100000, and 1111111111
− Hamming distance is 5

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Error Bounds – Hamming distance (3)

Bounds for a code with distance:


• 2d+1 – can correct d errors
• d+1 – can detect d errors

Example:
• 0 -> 000; 1 -> 111
• m=1, k=2, m+k = 3
• Hamming distance is 3, code rate is 1/3
• Can detect up to 2 errors and correct up to 1 error

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Design Considerations of a Code

• Reduce k to achieve high code rate


• For given values of m and k, maximize d
• Easy encoding and decoding
• Minimize memory and processing time

We will focus on error detection and retransmission, but


not error correction.

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Review - 1
Data link layer services
Framing: how to detect beginning and end of frames
• Byte count, byte stuffing, bit stuffing
Error Control
• Error Detection
• Error Recovery: Error correction or Retransmission
Framework of Error Detection/Correction
• Hamming distance-> error detection/correction
capabilities

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Error Detection

• Parity
• Cyclic Redundancy Checks (CRCs)

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Parity (1)

Parity bit is added as the modulo 2 sum of data bits


• Equivalent to XOR; this is even parity
• Ex: 1110000 → 11100001
• Detection checks if the sum is wrong (an error)

Simple way to detect an odd number of errors


• Ex: 1 error, 11100101; detected, sum is wrong
• Ex: 3 errors, 11011001; detected sum is wrong
• Ex: 2 errors, 11101101; not detected, sum is right!
• Error can also be in the parity bit itself

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Parity (2)

Interleaving of N parity bits detects burst errors up to N


• Each parity sum is made over non-adjacent bits
• An even burst of up to N errors will not cause it to fail

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Cyclic Redundancy Check (CRC)

• Used by many link-layer protocols:


• HDLC, Ethernet, Token-Ring, etc.
• Uses powerful math based on finite fields
• Background: Polynomial Arithmetic

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Polynomial Arithmetic

• Represent a m bit message as a polynomial of


degree “m-1”
• 11000101 = 𝑥 7 + 𝑥 6 + 𝑥 2 + 1
• Polynomial arithmetic is done modulo 2. It does not
have carries for addition or borrows for subtraction.
• Addition or subtraction are identical to XOR.
• Division is same as the integer division except that
the subtraction is done modulo 2.

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
CRC

• Message polynomial M(x): m bit message represented


with a polynomial of degree m-1
• Sender and receiver agree on a divisor polynomial
(called generator polynomial) G(x) of degree k.
• Both the high- and low-order bits of the generator
must be 1.
• k is the number of redundant bits

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Key Idea

• Sender:
• Append a CRC (k bits) to the end of the frame =>
Transmitted message T(x),
• where T(x) is divisible by G(x).
• Receiver:
• Divide the received frame R(x) by G(x).
• If there is no remainder, there are no transmission
errors
• If there is a remainder, there are transmission errors.

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Algorithm for Computing T(x)
• You have M(x) and G(x). How to compute T(x)
1. Append k zero bits to the low-order end of the frame,
which is 𝑥 𝑘 𝑀(𝑥)
2. Divide 𝑥 𝑘 𝑀 𝑥 by G(x) to get remainder C(x)
3. Subtract remainder C(x) from 𝑥 𝑘 𝑀 𝑥 to get T(x)

𝑥 𝑘 𝑀(𝑥) = Q(x)G(x) + C(x)


T(x) = 𝑥 𝑘 𝑀(𝑥) – C(x) = Q(x)G(x)

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Example

Start by adding
0s to frame
and try dividing

Offset by any remainder


to make it evenly divisible

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Elementary Data Link Protocols

• Utopian Simplex Protocol »


• Stop-and-Wait Protocol

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Motivation
Node-to-node delivery of frames
• Frames can get corrupted or lost
• Error Detection helps detect corrupted frames
• What next?
Recover the corrupted/lost frames
• Reliable data transfer protocols (RDT) are needed
Implementation
Service Receiving
Sending
Network
process process
Sending Receiving
Network
process process
Data Link Sending Receiving
side RDT side RDT
Data Link Reliable Channel
Unreliable Channel
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Utopian Simplex Protocol (p1)
Assumptions:
Functionalities:
• Receiver as fast as sender
• None
• No errors
• No losses

TX RX
Frame0

• No error control
Frame1 • No flow control

Frame2

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Stop-and-Wait (p2)
Assumptions:
Functionalities:
• Receiver may not run as
fast as sender • Receiver feedback
• No errors
• No losses
TX RX
Frame0
• Flow control added
• No error control
ACK

Frame1 Only one frame out


at a time – called
stop-and-wait

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Stop-and-Wait (p3.1)
Assumptions: Functionalities:
• Receiver may not run as fast • Receiver feedback
as sender
• Error detection
• Errors exist
• No losses
TX RX TX RX
Frame0 Frame0
• Flow control added
• Error control added
ACK NACK

Frame1 Frame0
What if ACK/NACK
get corrupted?

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Stop-and-Wait (p3.2)
Assumptions: Functionalities:
• Receiver may not run as fast as • Receiver feedback
sender • Error detection
• Errors exist • Data sequence
• ACK/NACK can get corrupted number
• No losses
TX RX TX RX TX RX TX RX

Frame0 Frame0 Frame0 Frame0

ACK NACK ACK NACK

Frame1 Frame0 Frame0 Frame0



Duplicate RX accepts
RX discards
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Stop-and-Wait (p3.3)
What is the sequence number space?
• Two numbers, ”0, 1”, will suffice
Can we get rid of NACK?
• Instead of NACK, receiver sends ACK of last correctly
received frame
TX RX
Frame0
ACK0

Frame1

ACK0
Duplicate ACK
Retransmit frame Frame1

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Stop-and-Wait (p4)
Assumptions: Functionalities:
• Errors exist • Receiver feedback
• Receiver may not run as fast as • Error detection
sender • Data sequence
• Losses can happen number
• Timeout mechanism
TX RX TX RX
Frame0 Frame0

ACK

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Stop-and-Wait (p4)
TX RX TX RX
Frame0 Frame0
ACK0

Timeout
Frame1 Frame0
Retransmit frame
ACK1 ACK0


a) No loss b) Lost frame

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Stop-and-Wait (p4)

TX RX
Frame0

ACK0

Timeout Frame0

ACK0 Duplicate frame,


Discard frame,
Send ACK

c) Lost ACK

How long to wait?

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Summary of Stop-and-Wait
• Source transmits frame
• Destination receives frame and replies with
acknowledgement (ACK)
• Source waits for ACK before sending next
• Destination can stop flow by not sending ACK
• Works well for a few large frames
• Stop and wait becomes inadequate if large block of
data is split into small frames

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Review - 2

• Error detection
• Parity & CRC
• Reliable data transfer protocols provide “reliable
channel” service abstraction to higher layers.
• We incrementally determined the required functionalities
needed in RDT protocols (stop-and-wait).
• Receiver feedback
• Error detection
• Data sequence number
• Timeout mechanism

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Performance of Stop-and-Wait
What is the achieved throughput?
• 10 Mbps link, 10ms propagation delay, 1KB frame,
small ACK (with negligible transmission time)

Sender Receiver

TX Time Throughput: 8000


Frame0 bits/[(8000/10^7)+2*0.01]=384.6Kbps

RTT ACK0
Utilization = 384.6Kbps/10^7 =
(8000/10^7)/(8000/10^7+2*0.01) = 3.8%
Frame1

𝑇𝑋 𝑇𝑖𝑚𝑒
Utilization =
𝑇𝑋 𝑇𝑖𝑚𝑒+𝑅𝑇𝑇
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Sliding Window Protocols

• Sliding Window concept »


• Go-Back-N »
• Selective Repeat »

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Key Idea

Sender Receiver Sender Receiver


TX Time TX Time
Frame0 Frame0
Frame1 ACK0
Frame2 ACK1
RTT Frame3 RTT ACK0
ACK2
ACK3
Frame4 Frame1
Frame5


Frame6 Utilization = Utilization =
Frame7 4∗𝑇𝑋 𝑇𝑖𝑚𝑒 𝑇𝑋 𝑇𝑖𝑚𝑒
𝑇𝑋 𝑇𝑖𝑚𝑒+𝑅𝑇𝑇 𝑇𝑋 𝑇𝑖𝑚𝑒+𝑅𝑇𝑇

e.g., 15.2% e.g., 3.8%


Sliding window Stop-and-Wait

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Sliding Window Concept
Sender maintains window of frames it can send
• Needs to buffer them for possible retransmission
• Window advances with next acknowledgements
Receiver maintains window of frames it can receive
• Needs to keep buffer space for arrivals
• Window advances with in-order arrivals

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Sender
Assign a sequence number to each frame

Maintain 3 variables:

• Send Window Size (SWS): upper bound on the number of


outstanding frames

• Last Acknowledgement Received (LAR): Seq. no of the last ACK


received.

• Last Frame Sent (LFS): Seq. no of the last frame sent

Maintain Invariant: LFS – LAR <= SWS


LAR Sent, but not yet acknowledged LFS Can send, but not yet sent

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

Already acknowledged SWS Can’t send


Receiver
Maintain 3 variables:

• Received Window Size (RWS): upper bound on the number of out of


order frames

• Last Acceptable Frame (LAF): Seq. no of the last acceptable frame.

• Last Frame Received (LFR): Seq. no of the last in-order frame


received

Maintain equality: LAF = LFR + RWS


Acceptable, not
Received, but out-of-order received yet
LFR LAF

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

Expected, not received RWS Not acceptable,


In order, passed up discarded
Bandwidth-Delay Product

Sender can send a maximum of w Sender Receiver


frames (window size) without
TX Time
waiting for an ACK Frame0
Frame1 ACK0
What can the window size be? Frame2 ACK1
RTT Frame3 ACK2
• To keep utilization maximum, ACK3
sender can send ”roughly” up to Frame4
DataRate*RTT before hearing an Frame5
ACK Frame6
Frame7
• w >= 2BD + 1


• BD = Bandwidth *Propagation
Utilization =
Delay/FrameSize 4∗𝑇𝑋 𝑇𝑖𝑚𝑒
𝑇𝑋 𝑇𝑖𝑚𝑒+𝑅𝑇𝑇
BD: bandwidth-delay CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Discussions

Larger windows enable pipelining for efficient link use


• Stop-and-wait (w=1) is inefficient for long links
• Best window (w) depends on bandwidth-delay (BD)

Pipelining leads to different choices for errors/buffering


• We will consider Go-Back-N and Selective Repeat

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Receiver Actions
Frame “SeqNum” arrives

• If SeqNum <= LFR or SeqNum > LAF, discard frame

• If LFR < SeqNum <= LAF, accept

Always good to send an ACK, which improves performance

• Exception: depends on protocol (e.g., Go-Back-N doesn’t send ACK


when frames are discarded)

Types of ACK: Cumulative ACK ; Selective ACK


Acceptable, not
Received, but out-of-order received yet
LFR LAF

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

Expected, not received RWS Not acceptable,


In order, passed up discarded
Cumulative ACK
SeqNumToAck
• Largest sequence number received such that all
frames with sequence number less than
SeqNumToAck have also been received.
• LFR is set to this value

Acceptable, not
Received, but out-of-order received yet
LFR LAF

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

Expected, not received RWS Not acceptable,


In order, passed up discarded
Cumulative ACK-Example (1)
Example:
• frames 0,1,2,3,5,7 arrive in that order
• State: receiver acked frame 3, assume RWS is 4
(1) When 5 arrives: buffer 5, ack 3, LFR = 3, LAF = 7

0 1 2 3 4 5 6 7 4

0 1 2 3 E 5

(2) When 7 arrives: buffer 7, ack 3, LFR = 3, LAF = 7

0 1 2 3 4 5 6 7 4

0 1 2 3 E 5 E 7
CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Cumulative ACK-Example (2)
Example:
• frames 0,1,2,3,5,7 arrive in that order
• State: receiver acked frame 3, assume RWS is 4
(3) When 4 arrives: accept 4, pass up frames till 5, ack 5, LFR = 5, LAF = 9
0 1 2 3 4 5 6 7 4

0 1 2 3 E 5 E 7 4

(4) When 6 arrives: accept and pass up 6, ack 7, LFR = 7, LAF = 11


0 1 2 3 4 5 6 7 4 8 9 10 6

0 1 2 3 E 5 E 7 4 E E E 6

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Selective ACK
ACK sequence number of whatever packet accepted
In previous example:
• When 5 arrives, ack 3, sack 5
• When 7 arrives, ack 3, sack 7, 5
• When 4 arrives, ack 5, sack 7

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Sender Actions (1)
On receiving frames from higher layers:

• Determine next sequence number to use (SeqNum)

• If SeqNum – LAR <= SWS, send the frame, else buffer or inform
application

LAR Sent, but not yet acknowledged LFS Can send, but not yet sent

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

Already acknowledged SWS Can’t send


Sender Actions (2)
On receiving ACK:

• Can get very complex (e.g., TCP variants)

• Simple version: use cumulative ACK to advance window


• If SeqNum in ACK > LAR, LAR = SeqNum in ACK
• If SeqNum of Buffered frames <= LAR + SWS, send them

LAR Sent, but not yet acknowledged LFS Can send, but not yet sent

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

Already acknowledged SWS Can’t send


Go-Back-N (1)
RWS = 1
• Receiver only accepts/acks frames that arrive in order
• Discards out-of-order frames, no ACK generated

On TimeOut, sender resends all frames that have been


previously sent but unack’ed

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Go-Back-N (2)

Sequence number space:


• Suppose sequence space: 0,1,2,…,MAX_SEQ
• SWS<= MAX_SEQ

Tradeoff made for Go-Back-N:


• Simple strategy for receiver; needs only 1 frame
• Wastes link bandwidth for errors with large windows;
entire window is retransmitted

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Selective Repeat (1)

Receiver accepts frames anywhere in receive window


• Cumulative ack indicates highest in-order frame
• Timer per frame, resend as needed
• NAK (negative ack) causes sender retransmission of
a missing frame before a timeout resends window

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Selective Repeat (2)

For correctness, we require:


• SWS <= (MAX_SEQ + 1)/2

Error case (MAX_SEQ+1=8, w=7) – Correct (MAX_SEQ+1=8, w=4) –


too few sequence numbers enough sequence numbers

Originals Retransmits Originals Retransmits

New receive window overlaps New and old receive window


old – retransmits ambiguous don’t overlap – no ambiguity

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Selective Repeat (3)

Tradeoff made for Selective Repeat:


• More complex than Go-Back-N due to buffering at
receiver
• More efficient use of link bandwidth as only lost frames
are resent (with low error rates)

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Automatic Repeat Request (ARQ)
Collective name for error control mechanisms that use
acknowledgements and timers to achieve reliable data
transmission over an unreliable service.
Types of ARQ:
• Stop-and-Wait
• Go-Back-N
• Selective Repeat

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Duplex Data Transmission
Transfers data in both directions
• Piggybacks acks on reverse data frames for efficiency

Piggybacking: technique of temporarily delaying outgoing


acknowledgements so that they can be hooked onto the
next outgoing data frame
• Better use of available channel bandwidth
• How long to wait?

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011
Review - 3
• Sliding window protocols rely on ”window of frames” to
improve performance
• Go-back-N (RWS=1), selective repeat (RWS>1)
• More complex (range of sequence numbers, types of
ACK, action at sender/receiver
• In addition to reliability, they provide
• In-order delivery
• Flow control
• Milestone: achieve point-to-point reliable and efficient
data transfer (building block)

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011

You might also like