Data-link-pt

Download Report

Transcript Data-link-pt

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 Characteristics
Chapter 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-topoint protocols are in wide use
 We have mentioned HDLC used in point to
point circuits
 A popular protocol is officially call the Point-toPoint 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
3
4
2
3
1
3
1
2
2
1
1
A
B
2
1
• 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
1
5
4
3
1
2
2
A
B
ACK1
ACK2
2
1
• 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
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
Tx
U
Tx  2* p
Tx = time to transmit a frame
p = one way propagation delay
Tx = 8000/1,500,000 = 5.3 ms
U = 5.3/(5.3 + 2*20 = .117
p = 4,000,000/200,000,000 = 20 ms
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 07. 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
14
13
1
12
2
11
3
10
9
8
7
10
12
11
4
2
3
5
1
6
9
8
7
10
11
3
1
2
4
5
9
8
7
6
10
2
1
3
4
8
9
7
6
5
1
2
3
7
8
6
5
4
9
1
2
6
7
5
4
3
8
1
5
6
4
3
2
7
A
B
ACK1 ACK1
ACK2
ACK2
ACK1
ACK3
ACK3
ACK2
ACK1
ACK4
ACK4 ACK2
ACK5
ACK1
ACK2
ACK3
ACK5
ACK3
ACK4
ACK6
ACK1
5
4
2
1
5
6
6
3
4
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
14
13
1
12
2
11
3
10
9
8
7
10
12
11
4
2
3
5
1
6
9
8
7
10
11
3
1
2
4
5
9
8
7
6
10
2
1
3
4
8
9
7
6
5
1
2
3
7
8
6
5
4
9
1
2
6
7
5
4
3
8
1
5
6
4
3
2
7
A
B
ACK1 ACK1
ACK2
ACK2
ACK1
ACK3
ACK3
ACK2
ACK1
ACK4
ACK4 ACK2
ACK5
ACK1
ACK2
ACK3
ACK5
ACK3
ACK4
ACK6
ACK1
5
4
2
1
5
6
6
3
4
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
*
U 
Tx
Tx  2 * p
• This is the time to send one frame and get an
ACK
• If we could send N frames during this time
*
U  N *(
Tx
)
Tx  2* p
• Assuming of course this does not exceed 1
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
0123456
0123456
7012345
Frames 0-6 are sent and received
Receiver adjusts receive window
Suppose all ACKS are lost
Frames 0 – 6 are resent
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
2n
2
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
Sliding Window Utilization
• If there are no errors
*
U  N *(
Tx
)
Tx  2* p
where N = window size
• Let q = probability a frame or ACK in error
Selective Repeat
U=1–q
*
U
for N*Tx
(1  q)* N * Tx
Tx  2 p
≥ Tx + 2p
Sliding Window Utilization
Go Back N or Automatic Repeat Request (ARQ)
*
(1  q)* N * Tx
U
Tx  2 p
*
(1  q) N * Tx
U
(1  q  Nq)(Tx  2 p)
N*Tx ≥ Tx + 2p
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
HDLC Frame
0111110 Address Control
data
FCS
Control
0
SEQ
SEQ, ACK = 3 bits or 7 bits
ACK
0111110
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