Beruflich Dokumente
Kultur Dokumente
Protocol Definitions
Continued
Some definitions needed in the protocols to follow. These are located in the file protocol.h.
Some definitions needed in the protocols to follow. These are located in the file protocol.h.
How large should be the sequence number? Or What should be minimum number of bits required for the sequence number?
The only ambiguity at the receiver is between two successive frames.. Say m and m+1 and never between m-1 and m +1 .. Its only after the ack for m-1 reaches back intact mth frame is sent.. And once mth frame reaches intact at the receivers end .. Story of m-1th frame is over .. However depending upon whether ack of mth frame reaches back intact or not either mth or m+1 th frame is sent .. hence only 1 bit is sufficient
Sliding window gives the DLL the flexibility to accept the frames in any order but they must be handed over to the NL in order.
A sliding window of size 1, with a 3-bit sequence number. (a) Initially. (b) After the first frame has been sent. (c) After the first frame has been received. (d) After the first acknowledgement has been received.
Sliding Window Protocols A One-Bit Sliding Window Protocol A Protocol Using Go Back N A Protocol Using Selective Repeat
Continued
A sends A0, seq = 0, ack = 1, B sends B0, seq=0, ack = 1, but B0 is lost. B gets the packet A0 but ack is not the one required .. It resends B0 with the ack of A0 I.e. A0, seq = 0 and ack =0, (This is a duplicate of the ack that was lost) also it increments the FE .I.e FE becomes 1. Duplicates of A0,0,1 are rejected since their seq number (0) dont match the FE(1). However B sends the duplicate of the above again. If this is also lost.. A duplicates and then B duplicates and so on.
Eventually one of the duplicates of B reaches A ..I.e. the ack required by A (remember both are waiting for ack of packet 0 in the beginning) and A sends another packet .. A1 with seq =1 and ack =0 that for B0 it just received. This was a good scene : problem was only due to noisy channel .. Ack were being lost
Two scenarios for protocol 4. (a) Normal case. (b) Abnormal case. The notation is (seq, ack, packet number). An asterisk indicates where a network layer accepts a packet.
Contd..
That means
Long propagation delays High bandwidth And, short frame length Is bad in terms of channel efficiency. A large window size is needed at the senders end whenever the bandwidth * round trip delay is large.
Pipelining
Imagine in the above example, if the sender could send more frames without waiting for the ack for the first one, the channel could have been utilized more efficiently. This technique is called pipelining.
Pipelining
Imagine the scenario, when the sender always has something to send until the ack for the first frame arrives .. Best scenario, right?
Clearly this is not Stop-n Wait.
Pipelining contd
Let Channel capacity is b bits/sec Frame size l bits, Round trip propagation time is R The time required to transmit a single frame is l/b. So, in stop n wait, the line is busy for l/b time and idle for R time, thus the line utilization is
= l/b divided by l/b + R = l/(l + bR). If l < bR, the efficiency will be less than 50%.
Comparison
Trade off between the bandwidth utilization and the buffer space in the receiver.
Pipelining and error recovery. Effect on an error when (a) Receivers window size is 1. (b) Receivers window size is large.
Issues
For a maxseq = 7, Number of outstanding frames can only be 7 and not 8. To see why, let us consider what happens when 8 frames are allowed to be outstanding .. That is the scene is Sender has sent out 8 frames The piggybacked ack for frame 7 finally comes to the sender. Now suppose the sender has 8 outstanding frames, 07 Now sender sends next frame 0, if it is lost, if B has a frame to send, B will send the piggybacked ack for 7.
Next, the sender sends the next frame 1 without waiting for the ack for 0, now suppose this is also lost, again B has a frame to send,then B will again send ack for 7. And so on .. Sender sends all the outstanding frames, 07 Suppose all of them are lost, the receiver will still send the ack of the last frame received I.e. 7. Now sender has no way of knowing, whether all the frames were lost or since it has received ack for 7..all the frames reached intact.
Solution
The problem is solved by keeping at most 7 instead of 8 outstanding frames, say
0-6 in the first batch, and 7,0-5 in the second
If all the frames in the second batch are lost, sender may keep on receiving ack for frame 6 which is not in senders window and hence it will know that frames were lost.
Continued
Continued
Continued
Continued
Continued
Continued
7 is accepted and passed onto the NL 0 and others are rejected as duplicate and the previous buffered frames are passed on to the NL - wrong packets!!!! Order in which packets are sent: P0p6, p0p6, p7, p0(new)p5(new) Order in which packets are handed over to NL of the receiver: P0p6,p7,p0p5(duplicate) and rest are discarded including the new frames
Solution
Keep the window size 4 That is half the range of permitted sequence numbers.
(a) Initial situation with a window size seven. (b) After seven frames sent and received, but not acknowledged. (c) Initial situation with a window size of four. (d) After four frames sent and received, but not
Programming Assignments
Make Groups of two and, Implement
Sliding window protocol with CRC on a duplex channel Go Back N protocol with Hamming Code on a duplex channel
Implementation of the channel must be clearly defined. There must be two copies of the same program running simultaneously, ( For example, on time sharing basis on the same machine, say in two different windows.) if required some synchronization may be added between the two processes. Alternatively, threads could be used. Will tell you more about the points on which your programs will be evaluated. Few are:
Acks incorporated or not, piggybacked or not, channel is truly duplex or not etc
I Acknowledge
Help from the following site
http://www.cs.vu.nl/~ast/