Automatic Repeat Request (ARQ) 2. Go ack N ARQ Although the Stop ad Wait ARQ is very simple, you ca easily show that it has very the low efficiecy. The low efficiecy comes from the fact that the trasmittig machie trasmits a frame ad waits for ad ACK before it starts trasmittig the ext frame, ad so o. A big part of the time spet i the Stopad Wait ARQ is simply waitig for the iformatio frame or the ACK frame to reach the destiatio machies. A solutio to this problem is the use of the Go ack N ARQ. Ulike the Stop ad Wait ARQ algorithm, the source machie i the Go ack N ARQ algorithm cotiues trasmittig frames oe after the other i the hope that these frames will reach their destiatio ad will get ackowledged i time, ad therefore wasted time i the Stop ad Wait ARQ will be saved i the Go ack N ARQ. This Go ack N ARQ method ca be described as the followig: 1. The source machie starts trasmittig a ew frame. 2. After trasmittig the frame, a timer that expires after the expected time of the arrival of the ACK is started (if the trasmittig machie expects a ACK respose after x secods, a timer with duratio slightly more tha x is set). 3. While the timer of the first trasmitted frame is advacig, the source machie will be sedig frames oe after the other up to N frames (the maximum umber of outstadig frames that have ot bee ackowledged is N) ad settig timers for each trasmitted frame that expire after the expected time of arrival of the ACK for each frame. If the ACK for the first outstadig frame arrives o time, aother frame is trasmitted such that the umber of outstadig frames is always N. If the ACK of a specific frame is lost, corrupted, or delayed such that the timer of the correspodig frame expires, the source machie will retrasmit ALL the frames startig with the oe that did ot gets ACKed. 4. This process cotiues util all frames have bee trasmitted ad ACKed There are several issues that must be cosidered with the Go ack N ARQ method. These iclude the possibility of late or lost frames, ad the possibility of late or lost ACK messages. Let us cosider the followig possible scearios ad see how the Go ack N ARQ algorithm performs i each case. It is clear that ACKs ow eed a sequece umber so we will assume that that a sequece umber is iserted ito the header of the ACKs. 1. Lost (or corrupted) rame or Lost (or corrupted) ACK Cosider the followig sceario: 1
1. Machie A trasmits rame 0 ad sets Timer 0 that expires after expected arrival time of ACK 0. 2. N 1 more frames (from frame 1 to frame N 1) are trasmitted followig rame 0 i the period while Timer 0 is still ruig. A timer for each of these frames is also set. 3. Assume that rame 0 is received ad checked for errors ad o errors were foud. 4. Machie trasmits ACK for rame 0. 5. The ACK for rame 0 is received by Machie A i time (before Timer 0 expires). 6. Machie A trasmits the ext frame (rame N) ad sets a timer for it that expires after the expected arrival of its ACK. 7. Assume that this process cotiued correctly for rame 1 ad rame 2. ut, rame 3 did ot get ACKed because either: (a) the frame was lost, (b) the frame was corrupted by errors, (c) its ACK got lost, or (d) its ACK was corrupted by errors. Remember that there are still N outstadig frames (rame 3 to rame N+2). 8. The Timer 3 evetually expires before a correct ACK is received. 9. Machie A will decide to re trasmit ALL frames startig from rame 3 to rame N+2, ad the process will repeat util rame 3 is ACKed, ad so o. Coclusio: The trasmissio recovers from the lost frame or ACK. rame 3 rame 2 rame 1 rame 0 rame N+2 rame N+1 rame N rame N-1 rame 3 rame 5 rame 4 rame N+2 rame N+1 rame N+3 ACK 0 ACK 1 ACK 2 ACK 3 ACK 4 ACK 5 2
2. Delayed ACK Note: ecause of the use of a sequece umber i the ACKs, a delayed ACK will trigger the retrasmissio of all frames from the oe that had the delayed ACK ad produce a situatio similar to the above. Coclusio: The trasmissio recovers from the delayed frame. Timer 0 Timer 1 Timer 2 ACK 0 is received before Timer 0 Expires. Timer 0 is Reset. rame N is Trasmitted Timer 3 ACK 1 is received before Timer 1 Expires. Timer 1 is Reset. rame N+1 is Trasmitted ACK 2 is received before Timer 2 Expires. Timer 2 is Reset. rame N+1 is Trasmitted ACK 3 is NOT received i time. Timer 3 Expires. rame 3 to rame N+2 are Re-Trasmitted Timer 3 ACK 3 is received after irst Timer 3 expired (Machie A assumes that this is ACK of the RE-Trasmitted rame 3, so it will sed rame N+2 to get N outstadig frames. Timer 4 Timer 5 ACK 3 is received before Timer 3 Expires. Timer 3 is Reset. rame N+2 is Trasmitted ACK 4 is received before Timer 4 Expires. Timer 4 is Reset. rame N+3 is Trasmitted ACK 5 is received before Timer 5 Expires. Timer 5 is Reset. rame N+4 is Trasmitted Machie A rame 3 rame 2 rame 1 rame 0 rame N+2 rame N+1 rame N rame N-1 rame 4 rame 3 rame 5 rame N+2 rame N+1 rame N+3 Machie ACK 0 ACK 1 ACK 2 ACK 3 If ay ACKs for these frames is received before ACK 3, it will be IGNORED ACK 3 ACK 4 ACK 5 Very Importat Notes: 1. The process of sedig multiple frames while you are waitig for the respose for the first oe is called Pipeliig (meaig that you put frames i the pipelie, or i the chael, i the hope that the frames before them will be ACKed properly. 2. The trasmitter i this algorithm uses a sed slidig widow of size N to idicate which frames are outstadig (the oes i the widow) ad which frames have already bee ACKed (the oes 3
from which the widow has moved away). Oce the IRST outstadig frame is ACKed, the widow slides away from it ad a ew frame is trasmitted ad eters to the widow. 3. The receiver i this algorithm uses a 1 frame receive slidig widow (this justifies why if a outof order frame is received, it will ot be accepted ad the receiver will have to wait for the oly oe frame it is expectig at ay particular time). 4. To remove ay possible ambiguity i ACK sequeces, the maximum widow size N must be less tha or equal to the maximum umber that ca be represeted by the umber of bits of the sequece umber i the ACKs (That is, if the sequece umber i the ACK has m bits, the maximum umber that ca be represeted by the sequece umber is 2 m 1, ad the widow m size has to be less tha or equal to that, so the followig coditio N 2 1 must be satisfied) Performace Evaluatio of Go-ack-N ARQ With some work, we ca show that the efficiecy of the Go ack N (GN) ARQ algorithm is give by η GN 0 1 1+ 1 P ( N ) ( 1 P ) = 0 1 = 1 P 1+ 1 1 1 ( ) ( ) ( N ) ( P ) where N = Widow Size (called W S i your book) P = Probability of rame error P = Probability of it error The best performace of the Go ack N is achieved if the frame error (or bit errors) is equal to 0. 4
3. Selective Repeat ARQ The Go ack N ARQ has better efficiecy tha the Stop ad Wait, but still it is ot very efficiet, especially at high probability of frame errors, sice all of the frames that have bee trasmitted after the frame that experieces the error have to be re trasmitted eve if they reached the receiver without errors. The reaso for that is that the receiver i the Go ack N ARQ has a slidig widow of size 1, which meas that the receiver is expectig to receive a specific frame at ay time ad will ot accept out of order frames (frames followig the first outstadig frame) if the first outstadig frame has ot bee received. To icrease the efficiecy of the go ack N ARQ, a ew algorithm is proposed. This is based o re trasmittig ONLY LOST OR ERRONEOUS RAMES (or frames that have ot bee ackowledged). This meas that eve out of order frames that are received correctly are accepted by the receiver while it is waitig for the other outstadig frames. Very Importat Notes: 1. The Selective Repeat ARQ also pipelies N frames i the chael. 2. The trasmitter i this algorithm uses a sed slidig widow of size N to idicate which frames are outstadig (the oes i the widow) ad which frames have already bee ACKed. 3. A frame is re trasmitted oly if (a) the origial frame was lost, (b) the origial frame was received with errors, (c) the ACK was lost, (d) the ACK was received with errors, or (e) the ACK was received late after the correspodig timer has expired. 4. The sed slidig widow advaces forward by k frames ONLY I there ALL k oldest outstadig frames at the begiig of the widow have bee ACKed (or example, if the oldest outstadig frame i the widow has ot bee ACKed, but all other frames after it withi the widow have bee ACKed, the widow will NOT slide util this oldest outstadig frame gets ACKed. I this case, the widow will slide such that the first frame i is becomes the oldest u ACKed outstadig frame). 5. The receiver i this algorithm uses (i may cases) the same size of slidig widow as i the trasmitter. This justifies why the receiver accepts frames eve if some frames ahead of them were ot received. 6. To remove ay possible ambiguity i ACK sequeces, if the sequece umber i the ACK has m bits, the maximum umber that ca be represeted by the sequece umber is 2 m 1, ad size m of both the trasmit ad receive widows must satisfy the followig coditio N 2 /2 1 (which meas that N 2 m ). Performace Evaluatio of Selective-Repeat ARQ The efficiecy of the Selective Repeat (SR) ARQ algorithm is give by 5
η SR 0 = 1 1 ( P ) 0 = 1 1 ( P ) The best performace of the Go ack N is achieved if the frame error (or bit errors) is equal to 0. Which are More Efficiet, Log rames or Short rames? Someoe may ask, which is better to use i terms of efficiecy? A short frame, or a log frame? There is o clear aswer to this questio. Or, let us say that the aswer depeds o the differet parameters of the etwork for which we are plaig to select the size of the frame. There are usually two parameters that will help us aswer this questio for a specific etwork: The probability of bit errors, which is related to probability of frame errors as see above. The loss of trasmissio time due to the trasmissio of overhead bits (header, trailer,.) which themselves do ot carry ay useful iformatio other tha help etwork equipmet i determiig the destiatio of the frame ad i detectig errors i the frame. These two parameters state the followig: A log frame with the same header/trailer size is more efficiet tha a short frame because the ratio of the header/trailer size (which represet wasted bits) to the data size (which represets useful bits) i the log frame becomes small. A short frame will have a lower probability of havig errors tha a log frame (the more bits i the frame, the higher the probability of havig at least oe of these bits i error). Sice a frame with errors i a system that oly detects errors (but does ot correct them) must be retrasmitted, usig loger frames meas a higher probability of eedig to retrasmit frames. So, the aswer to the above questio is that the legth of the frame must always be selected by havig a compromise betwee frame error rates ad ratio of header/trailer to data bits. The coclusios we get are: I a very oisy etwork, shorter frames are more efficiet. I a etwork with very low oise levels, loger frames are more efficiet. 6