CS 408 Computer Networks: Chapter 14: Data Link Control
CS 408 Computer Networks: Chapter 14: Data Link Control
Computer Networks
transmission
time
Stop and Wait Flow Control
• Source transmits frame
• Destination receives frame and replies with
acknowledgement (ACK)
• Source waits for ACK before sending next frame
• Destination can stop flow by not sending ACK
• Works well for large frames
• Inefficient for smaller frames
Stop and Wait Flow Control
• However, generally large block of data split into
small frames
—Called “Fragmentation”
—Advantages are
• Limited buffer size at receiver
• Errors detected sooner (when whole frame received)
– On error, retransmission of smaller frames is needed
• Prevents one station occupying medium for long periods
• Channel Utilization is higher when
—the transmission time is longer than the propagation time
—frame length is larger than the bit length of the link
—actually last two expressions mean the same
—see the derivations on board
Stop and Wait Link Utilization -
Details are on the board
t0 + T t0 + D
t0 + D t0 + T
t0 +T+D t0 +T+D
t0 +T+2D t0 +T+2D
D> T D< T
2T
D+T
2D+T
( W.T ≥ 2D+T )
Sliding Windows Performance - 2
D+T
W.T
2D+T
• Parity
—single bit added to the end of the data
—Value of parity bit is such that data and parity have
even (even parity) or odd (odd parity) number of
ones
—Even number of bit errors goes undetected
• thus not so useful
Error Detection Process using
Cyclic Redundancy Check
F= F’=
-
Cyclic Redundancy Check (CRC)
• For a data block of k bits, transmitter generates
n-k bit frame check sequence (FCS) and appends
it to the end of the data bits
• Transmits n bits, which is exactly divisible by
some number (generator)
—the length of the generator is n-k+1 and first and last
bits are 1
• Receiver divides the received frame by generator
—If no remainder, assume no error
• Division is binary division (not the same as
integer or real division)
• See board for the math details and example
Cyclic Redundancy Check (CRC)
• Standard CRCs (generators are standard)
—checks all single, double and odd number of errors
—checks all burst errors with length less than or equal
to the length of FCS (n-k)
—checks most of the burst errors of longer length
• for bursts of length n-k+1 (length of generator), probability
of an undetected error is 1/2n-k-1
• for longer bursts, probability of an undetected error is 1/2n-k
Error Control
• Actions to be taken against
—Lost frames
—Damaged frames
• Automatic repeat request (ARQ) mechanism
components
—Error detection
—Positive acknowledgment
—Retransmission after timeout
—Negative acknowledgement and retransmission
Automatic Repeat Request
(ARQ)
• Stop-and-wait ARQ
• Go-back-N ARQ
• Selective-reject (selective retransmission) ARQ
Stop and Wait ARQ
• Source transmits single frame
• Wait for ACK
• If received frame is damaged, discard it
—If transmitter receives no ACK within timeout,
retransmits
• If ACK damaged,transmitter will not recognize it
—Transmitter will retransmit after timeout
—Receiver gets two copies of frame, but disregards
one of them
—Use ACK0 and ACK1
• ACKi means “I am ready to receive frame i”
Stop-and-Wait ARQ –
Example
Stop and Wait - Pros and Cons
• Simple
• Inefficient
Go-Back-N ARQ
• Based on sliding window
• If no error, ACK as usual with next frame
expected
—ACKi means “I am ready to receive frame i” and “I
received all frames between i and my previous ack”
• Sender uses window to control the number of
unacknowledged frames
• If error, reply with rejection (negative ack)
—Discard that frame and all future frames until the
frame in error is received correctly
—Transmitter must go back and retransmit that frame
and all subsequent frames
Go-Back-N ARQ -
Damaged Frame
• Receiver detects error in frame i
• Receiver sends “reject i”
• Transmitter gets “reject i”
• Transmitter retransmits frame i and all
subsequent frames
Go-Back-N ARQ - Lost Frame (1)
• Frame i lost
• Transmitter sends frame i+1
• Receiver gets frame i+1 out of sequence
• Receiver sends “reject i”
• Transmitter goes back to frame i and
retransmits it and all subsequent frames
Go-Back-N ARQ- Lost Frame (2)
• Frame i lost and no additional frame sent
• Receiver gets nothing and returns neither
acknowledgment nor rejection
— This is kind of a deadlock situation that needs to be resolved
• Transmitter times out and sends acknowledgment
frame with P bit set to 1 (this is actually a
command for ack request)
—Receiver interprets this as an ack request command
which it acknowledges with the number of the next
frame it expects (i )
• Transmitter then retransmits frame i
Go-Back-N ARQ- Damaged/Lost
Acknowledgment
• Receiver gets frame i and sends
acknowledgment (i+1) which is lost
• Acknowledgments are cumulative, so next
acknowledgement (i+n) may arrive before
transmitter times out on frame i
==> NO PROBLEM
• If transmitter times out, it sends
acknowledgment request with P bit set, as
before
Go-Back-N ARQ- Damaged
Rejection
• As in lost frame (2)
—sender asks the receiver the last frame received and
continue by retransmitting next frame
Go-Back-N ARQ -
Example (k=3, i.e.
frame numbering is
modulo 8)
Selective Reject
• Also called selective retransmission
• Only rejected frames are retransmitted
• Subsequent frames are accepted by the receiver
and buffered
• Minimizes retransmissions
• Receiver must maintain large enough buffer
• Complex implementation
Selective Reject -
Example (k=3, i.e.
frame numbering is
modulo 8)
Issues
• RR with P=1 is from HDLC standard
—pure protocol just have retransmissions after timeout
• as explained in Tanenbaum
Issues – Window Size
• Given n-bit sequence numbers, what is Max
window size?
—go-back-n ARQ 2n-1
• Why?
• what about receiver’s window size?
– It is 1, why?
—selective-reject(repeat) 2n-1
• Why?