- Slides: 44
11. 1 Flow and Error Control Flow Control (Flödesstyrning) Error Control (Felhantering) • • Båda dessa funktioner hanteras av vissa datalänkprotokoll (lager 2), i LLC-sublagret, t. ex. vid trådlös kommunikation eller vid modem. End-to-end flödesstyrning och felkontroll hanteras av transportprotokollet TCP (lager 4).
Flow control Necessary when data is being sent faster than it can be processed by receiver to avoid that the receiver’s buffer is overwhelmed.
Felhantering med hjälp av felrättande koder FEC = Forward Error Correction. Baseras på felrättande istället för felupptäckande koder. Kräver ingen backkanal. Två typer: 1. Faltningskoder (convolutional codes). Ex: Vid Faltningskod med kodtakt (code rate) 1/3 infogas två redundanta bitar mellan varje bit i nyttomeddelandet. Dessa felrättande bitar beräknas kontinuerligt för varje inkommande bit i nyttomeddelandet. 2. Blockkoder (block codes) Ex: I digital-TV-systemet används en s. k. Read Salomon-kod med beteckningen RS(204, 188, 8). Det innebär att nyttoinformationen delas upp i 188 byte stora block. För varje block beräknas en felrättande kod, som läggs till blocket så att blocket blir 204 byte. Redundanden är alltså 204 – 188 = 16 byte. Koden klarar 8 felaktiga byte.
Felhantering med hjälp av felupptäckande koder Alternativ 1: Bortkastning av felaktiga paket. Alternativ 2: ARQ = Automatic Repeat re. Quest = automatisk omsändning av paket vid bitfel, eller om paketet inte når fram. I fortsättning kommer vi med begreppet ”error control” eller ”felkontroll” att avse ARQ.
Protocols to be presented q Idle RQ = Stop-and-wait ARQ q Sliding Window Flow Control q Go-back-N ARQ q Selective Repeat ARQ Sliding Window Protocols
The Idle RQ (Repeat Request) Protocol The simplest protocol for error and flow control How the protocol operates: m Source may not send a new frame until the receiver acknowledges previous one. m The receiver sends only positive acknowledgements (ACK) to notify the sender that the frame was received. m If the frame 0 was received, the ACK 1 is sent. In that way the sender is notified that the receiver is expecting frame 1. m The ID of the frame is called a sequence number. m 1 bit sequence numbers is sufficient. Sequence: 0 1 0. .
Figure 6. 23 Idle RQ error control scheme: (a) error free;
(b) corrupted I-frame;
Figure 6. 24 Idle RQ link utilization.
(c) corrupted ACK-frame.
11. 1 Normal operation ACK n = Acknowledgement. Expecting frame number n
11. 2 Stop-and-Wait ARQ, lost frame
Lost or Damaged Frame q The sender starts a timer when it sends each frame q If the ACK is not received before the timer expires, the sender resends the same frame again
11. 3 Stop-and-Wait ARQ, lost ACK frame
Lost or damaged ACK q Lost ACK causes duplicate frames q A duplicate frame is recognized by the sequence number and is discarded q The receiver sends the same ACK again
11. 4 Stop-and-Wait ARQ, delayed ACK
Note: Numbered acknowledgments are needed if an acknowledgment is delayed and the next frame is lost.
Piggybacking q Usually the communication is in both ways – this means that the sender is a receiver and the receiver is the sender, too. (both send and receive data) q To save on the processing and bandwidth the short ACKs messages are not sent as separate frames. Instead, they may be included in the frames with data. q This technique is called piggybacking
Example 6. 8: Idle RQ
Figure 6. 25 Effect of propagation delay as a function of data transmission rate; parts correspond to Example 6. 8.
Example 6. 9
11. 5 Piggybacking
Efficiency of Stop-and-Wait q Very inefficient, having in mind that most of the time the sender is idle q Example: 40 km copper cable, 10 Mbps rate, 1000 bit frame, m Signal in copper propagates at 2 x 108 m/sec m Transmission time is 1000/10000000 (Takes 0. 1 msec to transmit frame) m Propagation time is 40000/ 2 x 108 (0. 2 msec delay to begin arriving at the receiver) m Total time is 0. 3 msec. to get to the receiver m ACK transmission time is approximately 0 (assuming the ACK is very short (length 0) m 0. 2 msec is the time for the ACK to arrive at the sender q Total time is 0. 5 msec before the sender can transmit again q 0. 5 ms for 0. 1 msec frame or efficiency is 20%
Sliding-Window flow control q Several frames can be sent without acknowledgement being received q N is the window size – the maximum number of frames that can be sent and not being acknowledged. q The receiver must be able to buffer N frames. q Sequence numbers are used to identify each frame. They are carried in the header. q The number of different sequence numbers must be at least N+1. q If the field for sequence numbers allows m bits, the number of different sequence number is 2 m and the sequence numbers range from 0 to 2 m-1. In that case the maximum window size is N = 2 m-1.
11. 6 Sender sliding window The sender window is the set of frames that may be transmitted before an ACK. It slides when the sender has received an ACK and sent next frame.
11. 7 Receiver sliding window The receiver window is the set of frames that may be accepted before the buffer is full. While the buffer is full, the receiver sends no ACK. The window of a stuffed receiver slides when the receiver has ”consumed” a frame and thus sent an ACK.
Stop-and-Wait vs. Sliding Window size N=3. Sender Receiver Fram e 0 ACK 0 Fram e 1 ACK 1 Fram e 0 ACK 0. . . Sequence numbers are 1 bit long (0 or 1) Transmission + propagation Transmiss time for the ion time packet for the packet Transmission + propagation time for the ACK Time Sender Frame consumption delay Receiver Fram e 0 Fram e Fram 1. . 1 e 2 AC. K 2 ACK 3 ACK propagation time Frame consumption delay . . . Sequence numbers from 0 to 2 m-1. m-bit field for the seq. num.
Sender and Receiver Prospective The window size is 7
Sliding Window Flow Control 0 1 2 3 4 5 6 7 0 4 5 6 7 0 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 0 1 2 3 4 5 6 7 0 F 1 ACK 1 0 1 2 3 4 5 6 7 0 F 2 ACK 2 F 3 0 1 2 3 4 5 6 7 0 ACK 3 F 4 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 ACK 4 F 5 ACK 6 N=6
ARQ with Sliding Window Problems arise when some of the frames are discarded (errors or lost frames). Two strategies are developed to deal with this problem: q Go-back-N strategy m The reciever simply discards all frames after the damaged frame without sending acknowledgement. q Selective repeat strategy m The receiver keeps all the frames after the damaged frame. It sends negative acknowledgement (NACK) for the damaged frame. When the sender finaly notice that something is wrong it retransmits the bad frame. The two strategies are trade-offs between bandwidth and data-link buffer space.
Go-Back-N Strategy q If a frame is lost, the lost frame and all the frames sent after it are sent again. q Sending window of size N, receiving window of size 1. q The sender has to buffer N frames q Bandwidth is wasted.
11. 9 Go-Back-N ARQ, normal operation
11. 10 Go-Back-N ARQ, lost frame
11. 11 Go-Back-N ARQ: sender window size
Selective Repeat Strategy q Only retransmit the frames that are in error q Both sending and receiving window are of size N
11. 13 Selective Repeat ARQ, lost frame
11. 14 Selective Repeat ARQ, sender window size
Bandwidth – Delay Product q The product of the bit rate (bandwidth expressed as bits per seconds) and the propagation time gives the number of bits that can be on the channel and thus can give orientation about the window size q When propagation time is high (for example in satellite channels), the window size need to be larger
Example 1 In a Stop-and-Wait ARQ system, the bandwidth of the line is 1 Mbps, and 1 bit takes 20 ms to make a round trip. What is the bandwidth-delay product? If the system data frames are 1000 bits in length, what is the utilization percentage of the link? Solution The bandwidth-delay product is 1 106 20 10 -3 = 20, 000 bits The system can send 20, 000 bits during the time it takes for the data to go from the sender to the receiver and then back again. However, the system sends only 1000 bits. We can say that the link utilization is only 1000/20, 000, or 5%. For this reason, for a link with high bandwidth or long delay, use of Stop-and-Wait ARQ wastes the capacity of the link.
Example 2 What is the utilization percentage of the link in Example 1 if the link uses Go. Back-N ARQ with a 15 -frame sequence? Solution The bandwidth-delay product is still 20, 000. The system can send up to 15 frames or 15, 000 bits during a round trip. This means the utilization is 15, 000/20, 000, or 75 percent. Of course, if there are damaged frames, the utilization percentage is much less because frames have to be resent.