Presentation is loading. Please wait.

Presentation is loading. Please wait.

Data Communications and Networking Pipelined reliable data transfer

Similar presentations


Presentation on theme: "Data Communications and Networking Pipelined reliable data transfer"— Presentation transcript:

1 Data Communications and Networking Pipelined reliable data transfer
CMPT 371 Data Communications and Networking Pipelined reliable data transfer

2 Stop and Wait: Utilization: examples (3)
a = ( R × d ) / ( V × L ) U = Tf / Tt = 1 / (1+2a) Case 1: WAN using ATM over optical fiber link d = 1000 km, L = 424 bits, R = Mbps V = 2×108 m/s Gives a ≈ 1850, and U = Janice Regan © Sept

3 Stop and Wait Utilization: examples (4)
a = ( R × d ) / ( V × L ) U = Tf / Tt = 1 / (1+2a) Case 2: LAN d = 0.1 to 10 km, L = 1000 bits, R = 10 Mbps V = 2×108 m/s Gives a = to 0.5, and U = 0.5 to 0.99 Janice Regan © Sept

4 Stop and Wait Utilization: examples (5)
a = ( R × d ) / ( V × L ) U = Tf / Tt = 1 / (1+2a) Case 3: Modem d = km, L = 1000 bits, R = 56,000 V = 2×108 m/s Gives a = 1.4, and U = 0.26 Janice Regan © Sept

5 Stop and Wait: Utilization Factors
Utilization improves when a is smaller a = ( R × d ) / ( V × L ) Therefore, utilization improves when The length of the frame, L, increases The data rate, R, and/or the link length, d, decrease The bit length of the link (Rd/V) is less than the frame length Janice Regan © Sept

6 Stop and Wait: Utilization Factors
Physical factors, optimization of performance limit L, R, and d Available buffer size, and resource sharing will limit L Performance optimization indicates small L (minimize retransmission) Performance optimization indicates largest possible R Link length, d, set by topology of network Janice Regan © Sept

7 Stop and Wait: Utilization Factors
t0+a t0+a t0+1 t0+1+a t0+1+a t0+1+2a t0+1+2a Rd/V ≥ L (a ≥1) Rd/V < L (a<1) Stalling 2003: figure 7.2 Janice Regan © Sept

8 Improving Stop and Wait Flow Control
Stop and Wait Flow Control utilizes the channel inefficiently particularly when the link length is greater than the frame length WHY? Because Stop and Wait Flow Control allows only one frame to be in transit between two given stations Consider a more complicated system of flow control (Sliding Window) which allows N≥1 frames to be in transit. What is the cost of allowing multiple frames to be in transit simultaneously? All frames of data in transit must be buffered at the sending station until after the ACK from the receiving station arrives at the sending station, buffering at the receiving station may or may not be used Increased complexity, frames may arrive out of order or be duplicated More information needed in frame headers Janice Regan © Sept

9 Why multiple Frames? Source Destination Frame 0 Frame 1 Frame 5
Janice Regan © Sept

10 Improving Stop and Wait Flow Control
Stop and Wait Flow Control utilizes the channel inefficiently particularly when the link length is greater than the frame length WHY? Because Stop and Wait Flow Control allows only one frame to be in transit between two given stations Consider a more complicated system of flow control (Sliding Window) which allows N≥1 frames to be in transit. What is the cost of allowing multiple frames to be in transit simultaneously? All frames of data in transit must be buffered at the sending station until after the ACK from the receiving station arrives at the sending station, buffering at the receiving station may or may not be used Increased complexity, frames may arrive out of order or be duplicated More information needed in frame headers Janice Regan © Sept

11 Sliding Window Flow Control
Stallings 2003; Figure 7.3 Janice Regan © Sept

12 Description: following diagrams
The packet with packet number base is shown after the . It is the oldest unacknowledged packet. Packets [0, base-1] have already been sent and acknowledged Packets between and the right hand end of the dark blue window are in the sliding window Packets between base and the darker blue window [base, nextseqnum-1] have been sent but have not been acknowledged Janice Regan © Sept

13 Sliding Window Flow Control
5 6 7 1 2 3 4 F0 5 6 7 1 2 3 4 F1 5 6 7 1 2 3 4 5 6 7 1 2 3 4 ACK1 F2 5 6 7 1 2 3 4 5 6 7 1 2 3 4 ACK2 F3 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 F4 5 6 7 1 2 3 4 ACK4 5 6 7 1 2 3 4 F5 5 6 7 1 2 3 4 ACK5 5 6 7 1 2 3 4 5 6 7 1 2 3 4 ACK6 5 6 7 1 2 3 4 5 6 7 1 2 3 4 Janice Regan © Sept

14 Sliding Window Flow Control
At the receiver After an acknowledgement is sent the window “slides” to the right by m. For the previous example m=1 both ends of the receiver’s sliding window move together (the length of the window does not change) The number of the ACK indicates the next packet the receiver expects (the first packet the receiver must save in its sliding window buffer) ACKs are usually cumulative: By sending ACKn the receiver is saying I have all packets up to packet n-1, the next packet I expect is n. Darker blue shows the remaining unused buffer space Janice Regan © Sept

15 Sliding Window Flow Control
At the source When an ACK is received the window “slides” to the right by m. In the previous example m=1 Both ends of the source’s sliding window move together (the length of the window does not change) Packets are sent one after the other until the end of the sliding window is reached When ACKn is received the source knows that the first packet it needs to save in its sliding window buffer is packet n. Darker blue shows the remaining unused buffer space Janice Regan © Sept

16 Sliding Window Utilization 1
The total time to send a frame of data and receive the resulting ACK is Tt = tFRAME + tACK + ( 2 × tPROP ) + tPROCF + tQF+ tPROCA +tQA The total time spent transmitting data frames for a window of length W frames is Tf = W× tFRAME The link utilization, U, of the channel in the absence of errors and losses is U = Tf / Tt If errors and losses make retransmissions necessary, and the average number of transmissions per frame is Nrsw then U = Tf / ( Nrsw × Tt ) Janice Regan © Sept

17 Sliding Window Utilization: 2
Assume protocol has the following properties Processing and queuing time is negligible (tPROCF ≈ 0, tPROCA ≈ 0, tQF ≈ 0 , tQA ≈ 0) The acknowledgment frame is small compared to the data frame (tFRAME >> tACK or tFRAME + tACK ≈ tFRAME ) No errors or losses The maximum link utilization, U, is Where a = tPROP / tFRAME = ( R × d ) / ( V × L ) Janice Regan © Sept

18 Sliding Window ARQ Utilization: 1
All frames of data in transit must be buffered at the sending station until after the ACK from the receiving station arrives at the sending station. Frames are numbered modulo M Source entity (sender) transmits frames from its sliding window until its send buffer is exhausted. A timeout timer is set when each frame begins transmitting. Destination entity (receiver) receives a frame and Sends and ACK then advances its sliding window if it has one Sends a NACK Janice Regan © Sept

19 Sliding Window ARQ Utilization: 2
Source entity receives ACK or NACK and stops timer for received frame. If an ACK is received the source entity may advance its sliding window If a NACK is received the NACKed frame is retransmitted. Frames following the NACKed frame may also be retransmitted. If a timeout timer expires the frame with an expired timer is retransmitted. Frames following that frame may also be retransmitted. Janice Regan © Sept

20 Continuous ARQs: Go Back N
Not all implementations or protocols with flow control based on sliding windows use or allow NACKs, your textbook shows an example, Go Back N without NACKs. When a packet transmission timer expires, the expired frame and all previously transmitted frames following the expired frame will be retransmitted. One timer is used, it is set when the first packet enters the pipeline and reset each time an ACK is received (only if more packets are presently in the pipeline) In all cases the destination entity does not buffer frames. If a frame is received out of order the frame is discarded. Janice Regan © Sept

21 Go Back N ARQ: Lost Frame (timeout)
5 6 7 1 2 3 4 F0 5 6 7 1 2 3 4 F1 * 5 6 7 1 2 3 4 ACK1 F2 5 6 7 1 2 3 4 F3 Discard packet 5 6 7 1 2 3 4 Timeout expired F4 ACK1 Discard packet 5 6 7 1 2 3 4 ACK1 F5 Discard packet 5 6 7 1 2 3 4 ACK1 F1 Discard packet 5 6 7 1 2 3 4 ACK1 F2 ACK2 5 6 7 1 2 3 4 Janice Regan © Sept

22 Go Back N ARQ: Lost ACK * Janice Regan © Sept 2007-2013 F1 F0 F1 ACK1
5 6 7 1 2 3 4 F1 F0 5 6 7 1 2 3 4 F1 5 6 7 1 2 3 4 ACK1 F2 5 6 7 1 2 3 4 ACK2 F3 5 6 7 1 2 3 4 F4 * 5 6 7 1 2 3 4 ACK4 F5 5 6 7 1 2 3 4 ACK5 F6 5 6 7 1 2 3 4 ACK6 F7 ACK7 5 6 7 1 2 3 4 Janice Regan © Sept

23 Choosing window size To choose the optimal window size need to look at the utilization First need limits on the window size Smallest 1 frame (becomes stop and wait) Largest determined by the largest integer N that can fit into the sequence number field in the packet header. For N available packet can have window as large as N-1 If window is of length N there may be ambiguity as to whether the packet is a retransmission of packet M from the previous cycle or a new packet M for this cycle Janice Regan © Sept

24 Why is N-1 the limit? (1) Consider a window size > N-1. For example consider N=4, with a window size of 4. The first four packets are sent and received, the ACKs of the four packets are lost The source times out because no ACKs are received and retransmits the first 4 packets. The receiver expects the second four packets, 0, 1, 2, 3 It receives packet 0, it will think it is the expected packet 0 1 2 3 1 2 3 1 2 3 0? 1 2 3 Janice Regan © Sept

25 Why is N-1 the limit? (2) Consider a window size = N-1. For example consider N=4, with a window size of 3. The first three packets are sent and received, the ACKs of the three packets are lost The source times out because no ACKs are received and retransmits the first 3 packets. The receiver expects the second three packets, 3, 0, 1 (it already sent the ACKS) It receives packet 0, packet 0 is out of order and will be dropped 1 2 3 1 2 3 1 2 0? 1 2 Janice Regan © Sept

26 Go Back N Utilization: 1 If errors and losses make retransmissions necessary then U = Tf / ( Nrsw × Tt ) If no timers expire, Nrsw,, is the average number of transmissions per frame, Na. Otherwise Nrsw is a function f(Na) Let Pf be the probability that a given frame contains errors. The probability that it will take i attempts to transmit the frame is Each error requires that K frames be retransmitted The average number of retransmissions Na (original transmission and i-1 retransmissions of K frames) Janice Regan © Sept

27 What is K? Round trip travel time means Tt / TFRAME frames will be transmitted before the ACK for the first frame is received. For a window length W ≥ Tt / TFRAME :.K≈Tt / TFRAME (=2a+1) For a window length W <Tt / TFRAME :. K≈W . Source Frame 8 Frame 7 Frame 6 Frame 5 Frame 5 Destination ACK 1 ACK 2 ACK 3 ACK 4 W = 8 a>4 K≈9 Source Destination Frame 2 Frame 1 W = 2 K≈2 Janice Regan © Sept

28 Go Back N ARQ Utilization: 2
Now substitute our estimates of K To give Janice Regan © Sept

29 Go Back N ARQ Utilization: 3
Assume that Processing time is negligible, transmission time for Frames is » than for ACKs no ACKs or NACKs are lost or damaged, and that the timeout timer never expires Then If the assumption is relaxed then the longer time for retransmission (timeout duration) must be included in the analysis. A separate probability for retransmission frames due to lost ACKs and NACKs may also be introduced Janice Regan © Sept

30 Selective Repeat ARQs:
When the source entity receives a NACK, only the NACKed frame will be retransmitted. When a timer expires, only the expired frame will be retransmitted. The destination entity buffers segments and maintains its own sliding window. The destination entity resequences frames that arrive out of order Janice Regan © Sept

31 Selective Repeat ARQ: timeout (text)
5 6 7 1 2 3 4 F0 5 6 7 1 2 3 4 F1 * T imeout 5 6 7 1 2 3 4 5 6 7 1 2 3 4 ACK0 F2 5 6 7 1 2 3 4 F3 5 6 7 1 2 3 4 5 6 7 1 2 3 4 ACK2 F4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 ACK3 F5 5 6 7 1 2 3 4 5 6 7 1 2 3 4 ACK4 F1 5 6 7 1 2 3 4 5 6 7 1 2 3 4 ACK5 F6 5 6 7 1 2 3 4 5 6 7 1 2 3 4 ACK1 5 6 7 1 2 3 4 5 6 7 1 2 3 4 Janice Regan © Sept

32 Choosing window size To choose the optimal window size need to look at the utilization First need limits on the window size Smallest 1 frame (becomes stop and wait) Largest determined by the largest integer N that can fit into the sequence number field in the packet header. For N available sequence numbers can have window as large as N/2 If window is of length N there may be ambiguity as to whether the packet is a retransmission of packet M from the previous cycle or a new packet M for this cycle Janice Regan © Sept

33 Why is N/2 the limit? (1) Consider a window size > N/2. For example consider N=4, with a window size of 3. The first three packets are sent and received, the ACKs of the three packets are lost The source times out because no ACKs are received and retransmits the first 3 packets. The receiver expects the second three packets, 3, 0, 1 (it already sent the ACKS) It receives packet 0, can’t tell if packet 3 missing or retransmitting packet 0 1 2 3 1 2 3 1 2 0? 1 2 Janice Regan © Sept

34 Why is N/2 the limit? (2) Consider a window size > N/2. For example consider N=4, with a window size of 2. The first two packets are sent and received, the ACKs of the two packets are lost The source times out because no ACKs are received and retransmits the first 2 packets. The receiver expects the second two packets, 2, 3 (it already sent the ACKS for 0 and 1) It receives packet 0, must be a retransmission! 1 2 3 1 2 3 1 0? 1 Janice Regan © Sept

35 Selective Repeat Utilization: 1
If errors and losses make retransmissions necessary, then for sliding window flow control U = Tf / ( Nrsw × Tt ) If no timers expire, Nrsw,, is the average number of transmissions per frame, Na. Otherwise Nrsw is a function f(Na) Let Pf be the probability that a given frame contains errors. The probability that it will take i attempts to transmit the frame is Each error requires that 1 frame be retransmitted The average number of retransmissions Na (original transmission and i-1 retransmissions) Janice Regan © Sept

36 Selective Repeat Utilization: 2
Assume that no ACKs or NACKs are lost or damaged, and that the timeout timer never expires Then Nr is the average number of transmissions per frame and the channel utilization is Also assuming that Processing time is negligible The acknowledgment frame is small compared to the data frame . U = (1-Pf)Tf / Tt Janice Regan © Sept


Download ppt "Data Communications and Networking Pipelined reliable data transfer"

Similar presentations


Ads by Google