1 / 23

COSC 3213: Computer Networks I Instructor: Dr. Amir Asif Department of Computer Science

COSC 3213: Computer Networks I Instructor: Dr. Amir Asif Department of Computer Science York University Section M Topics: Flow Control and ARQ Protocols Stop-and-Wait ARQ Go-Back N ARQ Selective Repeat ARQ Garcia: Section 5.2. Automatic Repeat Request (ARQ).

toki
Download Presentation

COSC 3213: Computer Networks I Instructor: Dr. Amir Asif Department of Computer Science

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. COSC 3213: Computer Networks I Instructor: Dr. Amir Asif Department of Computer Science York University Section M Topics: • Flow Control and ARQ Protocols • Stop-and-Wait ARQ • Go-Back N ARQ • Selective Repeat ARQ Garcia: Section 5.2

  2. Automatic Repeat Request (ARQ) • ARQ combines error detection and retransmission to ensure accurate data delivery despite transmission errors and PDU losses. • Basic goals of ARQ include: • Error free, sequence-ordered delivery of PDU. • No duplication of PDU. • Flow control when one of the host is slower. • Basic elements of the ARQ protocol includes: • Error-detecting code with high probability of error detection. • Positive Acknowledgment (ACK) to indicate correct reception of a PDU. • Negative Acknowledgment (NAK) to indicate error in a PDU or loss of a PDU. • Timeout mechanism to cover scenarios where PDU is lost. • Recall that the error detection is performed by the data-link and transport layers. In our explanation, we will refer to the implementation of the ARQ protocol in the data-link layer. The same procedure can be used at the transport layer. • We will analyze three different ARQ protocols: • Stop-and-Wait ARQ • Go-Back N ARQ • Selective Repeat ARQ

  3. Transmitter A Receiver B Info frame Error-free packet Packet Data-link Data-link Network Network Control frame Control frame: ACKs Header CRC 1. The network layer passes the packet to be transmitted to the data-link layer. 2. The data-link layer encapsulates the packet into an information frame adding: (i) a header containing the sequence number of the frame and (ii) a trailer containing the CRC code. 3. The physical layer is responsible for the delivery of the frame 4. The physical layer passes the info frame to data-link. 5. The data-link extracts the sequence number from the header and the CRC code from the trailer. 6. If no error is detected, the info packet is passed to the network layer and an ACK frame is transmitted to the transmitter Information frame Header Packet CRC Basic Elements of ARQ

  4. Scenario I: Information Frame 1 gets lost. Time-out Time Transmitter A Frame 0 Frame 1 Frame 1 Frame 2 ACK ACK Receiver B Stop and Wait ARQ (1) Transmitter A transmits an information frame 0 to the receiver and starts a timer. Transmitter A stops and waits for the ACK frame from Receiver B. If an ACK frame is received from Receiver B before the timer expires, Transmitter A starts transmission of the next information frame. If the timer expires without receiving an ACK frame is received, Transmitter A retransmits the information frame 0.

  5. Scenario III: Correct Operation for Scenario II Time-out Time Transmitter A Frame 0 Frame 1 Frame 1 Frame 2 ACK ACK ACK Receiver B Loss of ACK frame leads to duplication of Frame 1 at Receiver B. To avoid duplication in cases where ACK frames are lost, we add a sequence number Slast(indicating the current information fame number) to the header of the information frame. Despite duplicate reception of Frame 1, Receiver B recognizes that same frame is received twiceand ignores the second copy of Frame 1. Scenario II: ACK of Frame 1 gets lost Time-out Time Transmitter A Frame 0 Frame 1 Frame 1 Frame 2 ACK ACK ACK Receiver B Stop and Wait ARQ (2)

  6. Scenario IV: Timer expires prematurely Time-out Time Transmitter A Frame 0 Frame 0 Frame 1 Frame 2 ACK ACK Receiver B Transmitter assumes that Frame 1 is received correctly and proceeds with transmission of Frame 2. To avoid loss of frames because of premature time-outs, we add a sequence number Rnext(indicating the frame number of the next information frame) to the ACK frames. Stop and Wait ARQ (3) Scenario V: Correct Operation for Scenario IV Time-out Time Transmitter A Frame 0 Frame 0 Frame 1 Frame 1 ACK 1 ACK 1 Receiver B Despite duplicate reception of Frame 0, Receiver B ignores the second copy of Frame 0. Transmitter A retransmits Frame 1 since it does not receive ACK 2.

  7. Stop and Wait ARQ (4): Protocol Description • Initialization: • Transmitter in Ready mode. • Set transmitter-send-sequence number Slast = 0 and receiver-sequence-number Rnext = 0. • Transmitter: • Ready Mode: Transmitter A prepares the requested information frame Slastwith the sequence number (Slast ) in the header, the packet data, and the CRC error detection code. Transmitter A then enters the wait mode and waits for acknowledgment ACK Rnext with Rnext = (Slast + 1) mod 2. • Wait Mode: During the wait stage, Transmitter A does not accept packets from the upper layer. If an acknowledgement is not received or if it is incorrectly received , Transmitter A stays in the wait mode till the timer expires out. If the timer times-out, Slast information frame is retransmitted with the same sequence number (Slast). If correct acknowledgement ACK Rnextis received, then Slast is set to Rnext and the transmitter returns to ready mode and the start of step 1. • Receiver: • Receiver B is always in the ready mode. When a frame arrives, the frame is checked for errors. • If no error is detected and the received frame number is the expected number Slast = Rnext, then the information frame is passed on to the higher layer, Rnext is updated to (Rnext + 1) mod 2, and ACK Rnext sent. • If the received information frame has errors, the frame is discarded with no action taken. • If the received information frame has no errors but incorrect sequence number, ACK Rnext is sent.

  8. State (0,0): Transmitter ready to transmit frame 0. 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Rnext Slast Timer State (0,1): Frame 0 transmitted but not acknowledged 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Rnext Slast Timer State (1,1): Transmitter gets ACK for Frame 0 before timer expires 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Rnext Slast Timer Stop and Wait ARQ (5): Window Operation Successful operation: Frame 0 correctly received and acknowledged

  9. State (0,0): Transmitter ready to transmit frame 0. 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Rnext Slast Timer State (0,0): Timer expires 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Rnext Slast Timer Stop and Wait ARQ (5): Window Operation State (0,1): Frame 0 transmitted but not acknowledged 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Unsuccessful operation: Frame 0 not received Rnext Slast Timer

  10. State Diagram Unsuccessful operation: Frame 0 incorrectly received Global State: (Slast, Rnext) (0,0) (0,1) Error-free frame 0 arrives at receiver ACK for frame 0 arrives at transmitter ACK for frame 1 arrives at transmitter Error-free frame 1 arrives at receiver (1,0) (1,1) Unsuccessful operation: Frame 1 incorrectly received Stop and Wait ARQ (7): State Diagram

  11. First ACK bit enters channel First frame bit enters channel Last ACK bit enters channel Last frame bit enters channel Transmitter A Information Frame (nf bits) ACK Frame (na bits) Receiver B tprocProcessingdelay at Tx tpropPropagation delay tfTransmissiondelay tprocProcessingdelay at Rx tack tpropPropagationdelay t0= total time to transmit 1 frame Case 1: No transmission errors occurTime of transmission: Number of information bits transmitted: Effective transmission rate : Transmission Efficiency: Effect of Frame overhead Effect of ACK overhead Effect of Delay-BW prod Stop and Wait ARQ (8): Performance

  12. First ACK bit enters channel First frame bit enters channel Last ACK bit enters channel Last frame bit enters channel Transmitter A Information Frame (nf bits) ACK Frame (na bits) Receiver B tprocProcessingdelay at Tx tpropPropagation delay tfTransmissiondelay tprocProcessingdelay at Rx tack tpropPropagationdelay t0= total time to transmit 1 frame Case 2: Transmission errors occur with probability PfThe transmission efficiency is reduced by a factor of (1 – Pf) to Transmission Efficiency: Activity 1: Assume that the information frames are 1250 bytes long with 25 bytes of overhead. The ACK frames are assumed to be 25 bytes long. Calculate the transmission efficiency of the Stop and Wait ARQ in a 1 Mbps transmission system assuming: (a) no transmission errors; and (b) transmission errors with a bit error rate of 10-6 and 10-4. Assume that the reaction time 2(tprop+ tproc) = 100ms. Stop and Wait ARQ (9): Performance

  13. 4 frames are outstanding; so go back 4 Go-Back-4: fr 0 fr 1 fr 2 fr 3 fr 4 fr 5 fr 6 fr 3 fr 4 fr 5 fr 6 fr 7 fr 8 fr 9 Time A B out of sequence frames ACK1 ACK2 ACK4 ACK5 ACK3 ACK7 ACK6 ACK9 ACK8 Go-Back-N ARQ (1) Stop-and-Wait ARQ is highly inefficient especially at high bit error rates. Go-back-N ARQ improves Stop-and-Wait ARQ by not waiting and allowing multiple information frames to be transmitted without acknowledgment. Frames 0 to (Ws- 1) are transmitted without any acknowledgement. If ACK for frame 0 arrives before window is exhausted, transmitter continues to transmit. If ACK for frame 0 is not received, transmitted goes back by N = Wsframes and begin retransmitting.

  14. Stop-and-Wait ARQ: Time-out expires fr 1 fr 0 fr 0 Time A B Receiver is looking for Rnext=0 Go-Back-N ARQ: Four frames are outstanding; so go back 4 fr 0 fr 1 fr 2 fr 3 fr 0 fr 1 fr 2 fr 3 fr 4 fr 5 fr 6 Time A B ACK1 ACK5 ACK2 ACK6 ACK4 ACK3 Receiver is looking for Rnext=0 Out-of-sequence frames Stop-and-Wait vs. Go-Back N ARQ ACK1

  15. Transmitter Receiver Receive Window: Send Window: ... Frames transmitted and ACKed Slast Srecent Slast+Ws-1 Frames received Rnext Receiver will only accept a frame that is error-free and that has sequence number Rnext When such frame arrives Rnext is incremented by one, so the receive window slides forward by one Buffers: Slast oldest un-ACKed frame Timer Slast+1 Timer ... most recent transmission ... Timer Srecent max Seq # allowed Slast+Ws-1 Go-Back N ARQ (3) Go-Back N ARQ fails if the total number of frames to be transmitted are less than the window size Ws and one of the frames get lost. Retransmissions will not be triggered since the window size at the transmitter is not exceeded. To resolve the problem, we associate a timer with each transmitted frame. Go-back-N is triggered as soon as one of the timers expires.

  16. Go-Back-N ARQ (4): Protocol Description • Initialization:Assume window size = Ws • Transmitter: in Ready mode with Slast = Srecent = 0. Receiver: Rnext = 0. • Transmitter: • Ready Mode: • Transmitter A prepares frame Srecentwith the sequence number (Srecent ) in the header, the packet data, and the CRC error detection code. A timer for the sent frame is started and Srecent = (Srecent + 1) modulo Ws. • If Srecent = (Slast + Ws- 1) modulo Ws, Transmitter A enters the wait mode. • If Srecent≠ (Slast + Ws- 1) modulo Ws, Transmitter A goes to the ready mode. • Wait Mode: • If before timer expires, correct acknowledgement ACK Rnextis received with Rnext between Slast and Srecent, then Slast is set to Rnext , and the transmitter returns to the ready mode (step 1). • If timer of Slast expires, Srecent is reset to Slast and the transmitter returns to the ready mode (step 1) • Receiver: • Receiver B is always in the ready mode. When a frame arrives, the frame is checked for errors. • If no error is detected and the received frame number Slast equals Rnext, then the information frame is passed on to the higher layer. Rnext is updated to (Rnext + 1) mod Ws, and ACK Rnext sent. • If the received information frame has errors, the frame is discarded with no action taken. • If the received information frame has no errors but incorrect sequence number, ACK Rnext is sent.

  17. Transmitter goes back 4 M = 22 = 4, Go-Back-4: fr 0 fr 2 fr 3 fr 1 fr 1 fr 2 fr 3 Time fr 0 A B ACK1 ACK 0 ACK2 ACK3 Receiver has Rnext= 0, but it does not know whether its ACK for frame 0 was received, so it does not know whether this is the old frame 0 or a new frame 0 M = 22 = 4, Go-Back-3: Transmitter goes back 3 fr 0 fr 1 fr 0 fr 3 fr 2 fr 3 fr 1 Time A ACK2 ACK3 ACK3 ACK3 ACK0 ACK1 B Receiver has Rnext= 3 , so it rejects the old frame 0 Go-Back N ARQ (5): Maximum Window Size For m = log2(M) bits sequence no. field in the header, maximum window size is: (N < 2m – 1). Frames are still labeled from 0 to 2m – 1.

  18. Go-Back N ARQ (6): Calculation of Time-out The time-out value of the information frame should exceed the duration required to receive a frame acknowledgement once an information frame is transmitted. Value of Time-out: Tout Tprop Tf Tf Tprop Tproc Info frame ACK frame

  19. Go-Back N ARQ (7): Performance Issues If there were no time-out because of lost or erroneous information or ACK frames, the time to transmit an information frame in steady state will approach Tf , the transmission time. Suppose that the probability of losing a frame due to error or packet losses = Pf , then the following table for successful transmission of the information frame can be constructed Activity 2: Show that the average no. of attempts for successful delivery of an information frame is with the average time required to transmit an information frame in Go-back-N ARQ is and the efficiency og Go-back-N ARQ is

  20. Go-Back N ARQ (8): Performance Issues Activity 3: Repeat Activity 1 for Go-back-NARQ. Assume that the information frames are 1250 bytes long with 25 bytes of overhead. The ACK frames are assumed to be 25 bytes long. Calculate the transmission efficiency of the Go-back-N ARQ in a 1 Mbps transmission system with reaction time of 100ms assuming a bit error rate of 10-6 and 10-4. Assume that the window size Ws is larger than the delay bandwidth product defined as the product of the reaction time with transmission rate.

  21. fr 0 fr 1 fr 2 fr 3 fr 4 fr 5 fr 6 fr 2 fr 7 fr 8 fr 9 fr 10 fr 11 fr 12 Time A B ACK2 NAK2 ACK2 ACK2 ACK7 ACK8 ACK9 ACK10 ACK11 ACK12 ACK1 ACK2 Selective Repeat ARQ • Go-back-N ARQ is inefficient because of the need to transmit all frames subsequent to an error frame. • An alternative to Go-back-N ARQ is the selective repeat ARQ. • Selective repeat ARQ has three differences from Go-back ARQ. • Receiver window size is increased so that out of order error-free frames can be accepted • Retransmission mechanism is modified so that individual frames can be retransmitted • In addition to ACK command, the receiver can also send a NACK command corresponding to the frame not received in a sequence of frames

  22. Receiver Transmitter Receive Window Send Window ... Frames transmitted and ACKed Frames received Rnext Rnext + Wr-1 Slast Srecent Slast+ Ws-1 Buffers Buffers Slast Rnext+ 1 Timer Slast+ 1 Rnext+ 2 Timer ... ... Srecent Timer max Seq # accepted Rnext+ Wr- 1 ... Slast+ Ws - 1 Selective Repeat ARQ (2)

  23. Selective Repeat ARQ (3) Activity 4: Repeat Activity 1 for Selective Repeat ARQ. Assume that the information frames are 1250 bytes long with 25 bytes of overhead. The ACK frames are assumed to be 25 bytes long. Calculate the transmission efficiency of the Selective Repeat ARQ in a 1 Mbps transmission system with reaction time of 100ms assuming a bit error rate of 10-6 and 10-4. Comparison on Efficiency based on Activities 1, 3, and 4:

More Related