Data Link Layer• We have now discussed the prevalent shared
channel technologies Ethernet/IEEE 802.3 Wireless LANs (802.11)
• We have now covered chapters 1-11• We had previously discussed telephony digital
technologies – chapter 12• We now move to look at Wide Area Networks
(WAN) technologies• Chapter 13 deals forwarding frames in a WAN.
We will skip for now• Chapter 14 deals with what is called connection
oriented networking in the WAN. Skip for now
Network CharacteristicsChapter 15
• Network ownership Private Networks Public Networks Virtual Private Networks
• Service Paradigm Connection Oriented Service Connectionless Service Most LAN architectures are connectionless Most WAN architectures are connection oriented Addressing considerations
Network Characteristics
• Network Performance Delay
• Propagation delay• Delay through devices (repeaters, bridges)• Access delays• Queuing delays
Throughput• Bandwidth• Effective throughput• Delay and congestion – affect throughput• Delay – throughput product
– The number of bits that will ‘fit’ on a channel or network
Jitter• Variance in delay
Point-to-Point Communications
• Chapter 16 discusses protocol layering Previously discussed
• ISO model of seven layers
• At data link layer, a number of point-to-point protocols are in wide use We have mentioned HDLC used in point to
point circuits A popular protocol is officially call the Point-to-
Point Protocol or PPP.
Point-to-Point Communications
• Consider two stations connected by some direct channel.
• One station has a number of frames to send
• The second station is ready to receive frames
6
5
4
1
3
2
A B4 3 2 12 13 2 11
• What if receiver cannot receive as fast as sender can send?
• What if the receiver is not ready to receive?
• What could we do to effect flow control?
• Suppose we require receiver to acknowledge a frame before sending another?
6
5
4
1
3
2
A B1
• This controls the flow• This works fine, if frames are never lost or damaged• Suppose we add some checking, like CRC?• Receiver could detect error and not send ACK• After some period of time (timer) sender could resend• Alternative: receiver could send a NAK to cause sender to resend
ACK1
1
2 2
ACK2
Simple Protocol
• Suppose frame sent and received correctly• ACK frame sent by receiver but never arrives• Transmitter resends frame• Now we have a duplicate frame• Clearly, we must protect against a frame being lost
or damaged• We must protect against response frame being lost
or damaged (ACK,NAK)• Must prevent duplicate frames
Simple Protocol
• Clearly, a timer must be involved at the transmitter
• Receiver must be able to distinguish a new frame from a retransmitted one
• One approach might be to include a sequence number in each frame
• If receiver gets duplicate sequence number it could simply throw one away.
• Does the resulting protocol work?• If yes, how large should the sequence number
field be?
Stop and Wait Protocol
• There is only one unacknowledged frame at a time
• Need only two sequence numbers: 0 and 1• Send frame
Set timer Wait for ACK or timeout
• Sender places sequence number in frame• Receiver places sequence number in ACK• Transmitter never sends new frame until
acknowledgement
Stop and Wait Protocol
• In a full duplex environment both sides may be sending frames.
• It makes sense to carry an ACK for a received frame in a frame being sent
seq ack Data
Stop and Wait Efficiency
• Consider a T1 circuit , 1.5 Mbps• Suppose circuit is coast to coast, 4000 km• Assume a 1000 byte frame• Assume size of ACK frame negligible• We can calculate efficiency
2*
TxU
Tx p
Tx = time to transmit a framep = one way propagation delay
Tx = 8000/1,500,000 = 5.3 ms
p = 4,000,000/200,000,000 = 20 ms
U = 5.3/(5.3 + 2*20 = .117
U = 11.7 per cent
Sliding Window Protocol
• To improve utilization, we must send more than one frame before receiving an ACK
• Suppose we use a 3 bit sequence number• Frame numbers would range from 0-7• How many frames could we send before
receiving an acknowledgement?• We could not send all frames numbered 0-
7. Why not?• We could send frames numbered 0, 1, .., 6
and wait for an ACK before proceeding
Sliding Window Protocol
• In general, we have n bits for sequence number
• Sequence runs 0, 1, 2, …., 2n-1• Stop and Wait protocol is simply the case
of n=1• Sender maintains buffers of frames sent
but not acknowledged• This is the sending window (N frames)• Receiver tracks sequence number(s) it is
able to receive
Sliding Window Protocol
• If sliding window is large enough, an ACK would arrive before the last frame in the window is sent
• In this case, we could be sending continuously
• This is called pipelining
• Given N, the window size, what is the utilization of this protocol?
• For the moment, assume no errors
6
5
4
1
3
2
A B4 3 2 12 13 2 115 4 3 2 16 5 4 3 2 110 9 8 7 6 511 10 9 8 7 69 8 7 6 5 48 7 6 5 4 37 6 5 4 3 2
1
11
10
9
8
7
12
13
14
2
3
412 11 10 9 8 7
5
6ACK1ACK1 ACK2 ACK3 ACK4 ACK5 ACK6ACK1 ACK2ACK1 ACK2 ACK3ACK1 ACK2 ACK3 ACK4ACK1 ACK2 ACK3 ACK4 ACK5
In this case 6 frames fit on the channel
The delay-product is 6 * bits/frame
It takes 12 unacked frames to keep the channel at 100 per cent utilization
6
5
4
1
3
2
A B4 3 2 12 13 2 115 4 3 2 16 5 4 3 2 110 9 8 7 6 511 10 9 8 7 69 8 7 6 5 48 7 6 5 4 37 6 5 4 3 2
1
11
10
9
8
7
12
13
14
2
3
412 11 10 9 8 7
5
6ACK1ACK1 ACK2 ACK3 ACK4 ACK5 ACK6ACK1 ACK2ACK1 ACK2 ACK3ACK1 ACK2 ACK3 ACK4ACK1 ACK2 ACK3 ACK4 ACK5
In this case 6 frames fit on the channel
The delay-product is 6 * bits/frame
It takes 12 unacked frames to keep the channel at 100 percent utilization
Sliding Window Utilization
• We have seen that for Stop and Wait
• This is the time to send one frame and get an ACK
• If we could send N frames during this time
• Assuming of course this does not exceed 1
2*
TxU
Tx p
*( )2*
TxU
T pxN
*
*
Errors with Sliding Windows
• Suppose a frame is lost or damaged in transmission
• Frames following damaged frame continue to arrive
• Suppose se send f0, f1, f2. f3, f4, f5, f6• Receiver must pass frames to next layer in
order• What strategies could we use to address
this situation?• Couple approaches
Handling Errors – Strategy 1
• Ignore all frames following damaged one• Do not acknowledge damaged frame or
any following ones• In due time, transmitter will time out for
damaged frame and all those following• Sender sends all frames starting with
damaged one• This is called Go Back N• Also called Automatic Repeat Request
(ARQ)
Handling Errors –Strategy 1
In this case the receiver only accepts frames in order
The receiver has a receive window of size 1
Handling Errors –Strategy 1
• Remember, sending window cannot be full range of sequence numbers
• Suppose you had sequence numbers 0, 1, 2, .., 7 (8 numbers)
• Send frames 0-7• All received correctly• All ACKs lost!• Transmitter sends 0-7 (again)• Receiver assumes second set• Therefore, cannot have 8 outstanding frames
Handling Errors –Strategy 2
• Let receiver have a larger receive window
• Let receiver accept and buffer all frames in window
• Receiver does not acknowledge good frames unless all previous frames are good
• Transmitter only resends damaged frames or frames that time out
• In previous example, f0, f1, f2. f3, f4, f5, f6
• Receiver ACKS f1, buffers f3, f4, f5, f6,
Handling Errors –Strategy 2
This strategy is called Selective Repeat
If we have sequence numbers 0, 1, 2, …, 7, what is the sending window in this case?
Selective Repeat
• Accept frames out of order – buffer them if they fit in receive window
• Suppose we have sequence numbers 0-7
sending window receive window
0 1 2 3 4 5 6 0 1 2 3 4 5 6
Frames 0-6 are sent and received
Receiver adjusts receive window
Suppose all ACKS are lost
Frames 0 – 6 are resent
7 0 1 2 3 4 5
Selective Repeat
• Sending window cannot be simply 1 less than the number of sequence numbers
• In fact, if we have sequence
0, 1, 2, ….., 2n-1 window cannot be larger than
or half the range of numbers • If n = 4, range of sequence numbers 0, 1, .. 15• Window size (N) cannot exceed 8 frames
2
2
n
Sliding Window Utilization• If there are no errors
*
where N = window size
• Let q = probability a frame or ACK in error
Selective Repeat
*
*( )2*
TxU
T pxN
(1 )* *
2
N TxU
T p
q
x
U = 1 – q for N*Tx ≥ Tx + 2p
Sliding Window Utilization
Go Back N or Automatic Repeat Request (ARQ)
(1 )* *
2
N TxU
T p
q
x
N*Tx ≥ Tx + 2p
(1 ) *
(1 )( 2 )
q
q q
N TxU
N pTx
*
*
Sliding Window Examples
• HDLC – High Level Data Link Control
• LAPB – Link Access Protocol
• PPP - Point to Point Protocol
• These are all bit oriented protocols
• All use variations of sliding window protocols
Sliding Window Summary• Transmitter send N frames before having to
receive acknowledgement• N is the window size• Transmitter sets a timer for each frame• Transmitter resends each frame that times out
Go Back N (ARQ) Selective Repeat
• Acknowledging a frame implies all previous frame acknowledged
• Variation: Instead of acknowledging a received frame, specify the next frame expected