• Chapter 3: The Data Link Layer

advertisement
• Chapter 3: The Data Link Layer
– to achieve reliable, efficient communication
between two physically connected machines.
– Design issues:
•
•
•
•
services interface to the network layer
how to group bits into frames (framing)
how to deal with errors (error control).
how to deal with speed mismatch (flow control).
• Framing (break the bit stream into frames)
– Why framing?
– How to do framing?
–
–
–
–
Character count
Starting and ending characters with character stuffing
starting and ending flags with bit stuffing
physical level code violation.
– Error Control
– Flow Control
Data link layer protocols:
P0 - Nothing
• Sender
– get a packet from the
network layer
– Add frame header,
send the frame to the
physical layer.
• Receiver
– get a frame from the
physical layer
– strip the header
– pass the packet to the
network layer.
P1: Stop and wait (flow control)
Assumption: no lost packets
• Sender
– get a packet from the
network layer
– Add frame header,
send the frame to the
physical layer.
– Wait for ACK
• Receiver
– get a frame from the
physical layer
– strip the header
– pass the packet to the
network layer.
– Send ACK.
P2 (PAR): stop and wait +
timeout + sequence number (flow
control + error control )
• Sender
– get a packet from the
network layer
– Add frame header
(seq), send the frame to
the physical layer.
– Wait for ACK till
timeout
– If timeout, resend the
packet, back to waiting
• Receiver
– get a frame from the
physical layer
– strip the header
– if (seq = expected)
• pass to the network
layer.
• Send ACK
– Else
• send ACK
• Compute the data rate that can be achieved by the
PAR protocol on a 20kbps duplex link with the
following assumptions:
– Data frame size = 1000 bits
– Acknowledgement frame size = 32 bits
– One-way propagation delay =5 ms
• What about when the the link data rate is 1Mbps?
• Protocol 3+: Sliding window protocol.
– What is bad about protocol 2 (PAR)?
– How to improve?
• Allowing pipelining, more outstanding frames.
• Maintaining a window of outstanding frames at the
sender (sender window)
– All packets that are sent but not ACKed.
• Maintaining the sender window:
– increase the upper bound when a new packet arrives.
– Increase the lower bound when an ACK of the lower
bound frame arrives.
– Protocol 3.1: Go back n sliding window.
• Allow the sender to have multiple (N > 1)
outstanding frames.
• Sender winder = N (>1)
• receiver winder = 1.
• Sender: maintain the sender window (buffering all
outstanding frames), maintain timeout for all
outstanding frames.
• Receiver: same as protocol 2.
• What happens when an transmission error occurs?
– GO BACK N to resend.
– How can we further improve the performance
of the Go back n sliding window protocol?
• When no errors, go back n can achieve the best
communication performance (fully exploit the
pipeline communication).
• When an error occurs, the go back n protocol needs
to resend everything.
– How can we do better than that?
– The receiver maintains a window of packets
that has been accepted by not acked.
– Maintaining the receiver window:
– discard frames outside the window.
– When receiving the frame whose sequence number =
lower bound, ACK and advance the window (the ACK
sequence number may jump)
– Can use NAK to speedup retransmission.
– Protocol 3.2: Selected repeat sliding window.
– Allow the sender to have multiple (N > 1) outstanding
frames.
– Allow the receiver to receive multiple (M>1) frames.
– Sender winder = N (>1)
– receiver winder = M (> 1).
– Sender: maintain the sender window (buffering all
outstanding frames), maintain timeout for all outstanding
frames.
– Receiver: maintain the receiver window (buffer out of
order packets for in order delivery), properly send ACK.
• What happens when an transmission error occurs?
– No need to resend everything.
– Example: Let one way delay equal to the time
for sending 1 packets. Timeout time = round
trip time + time for 1 packets. Let the sender
sends 10 packets and the third packet gets lost.
• Using go-back-N with sender window size = 8.
• Using selected repeated with sender window size
and receiver window size = 8 but without NAK
• Using selected repeated with NAK.
– How should you set the minimum sender
window size?
– Piggybacking
• Used in duplex channel
• Combined data and ACK message
• When no data?
– Wait some time and ACK anyway.
Download