Presentation is loading. Please wait.

Presentation is loading. Please wait.

Data Link Layer Protocols Flow Control in Data Link Layer.

Similar presentations


Presentation on theme: "Data Link Layer Protocols Flow Control in Data Link Layer."— Presentation transcript:

1 Data Link Layer Protocols Flow Control in Data Link Layer

2 Flow Control: Initial Assumptions Simplex Channel Infinite buffer capacity with the receiver Error free transmission Network layer at the senders end is always ready with data No need for flow control

3 Protocol Definitions Continued Some definitions needed in the protocols to follow. These are located in the file protocol.h.

4 Protocol Definitions (ctd.) Some definitions needed in the protocols to follow. These are located in the file protocol.h.

5 Unrestricted Simplex Protocol

6 Some assumptions dropped Infinite capacity in the buffer of the receiver. Need for flow control Stop-n-Wait protocol –Sender sends a frame –And waits for a signal in the form of a dummy frame –No seq no. is required since the line is still error free

7 Simplex Stop-and- Wait Protocol

8 Further assumptions dropped The channel is noisy, frames may be damaged or lost Good scene : data frame reaches intact, ack sent back and received, next frame sent Bad scene : –Data frame damaged or lost..hence no ack – sender times out and resends.. No problems –Data frame reaches intact but Ack lost.. Times out..resends.. Receiver receives duplicate frames..Problem

9 Problem of Duplicate frames Solution : –Keep a sequence number for each frame to distinguish between the new frame and a duplicate frame. 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

10 A Simplex Protocol for a Noisy Channel A positive acknowledgement with retransmission protocol. Continued

11 A Simplex Protocol for a Noisy Channel (ctd.) A positive acknowledgement with retransmission protocol.

12 Further assumption dropped Channel is simplex.. So, Now communication is two way.. I.e. Duplex channel –Interleave data and ack.. So..a kind field is required to specify whether the frame contains data or ack. –Piggyback ack on data frame

13 Sliding Window Protocol(Duplex) At any instant of time, the sender maintains a set of sequence numbers corresponding to frames it is permitted to send – this includes – frames not yet sent –Frames sent but not yet acknowledged.. May have to be sent again This corresponds to the senders window. When a packet comes from the NL..it is appended in the window and when an ack arrives for a frame..it is deleted from the buffer(and from the window)

14 Sliding Window Protocol(Duplex) Similarly, the receiver also maintains a set of sequence numbers corresponding to frames it is permitted to accept. –When a frame arrives, its seq number is checked..if it falls in the window it is accepted else discarded.. Once an ack is sent for a frame it is deleted from the window so that duplicate frames are not accepted. 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.

15 Sliding Window Protocols (2) 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.

16 Sliding Window Protocols A One-Bit Sliding Window Protocol A Protocol Using Go Back N A Protocol Using Selective Repeat

17 A One-Bit Sliding Window Protocol Continued

18 A One-Bit Sliding Window Protocol (ctd.)

19 How does it handle duplicate frames… Say when an Ack is lost …A times out and resends.. Both A and B are wanting to send a packet numbered 0, or one can imagine they have both sent out packets with seq no. 1 and are waiting for its ack.

20 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.

21 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

22 Bad scene : duplicates without transmission error When B sends before receiving a frame from A.

23 A One-Bit Sliding Window Protocol (2) 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.

24 Further assumption dropped So far, implicitly, we have assumed that the time of transmission is negligible. I.e. the time frame takes to reach the receiver and the ack to travel back is negligible.

25 Long propagation delays Consider a 50 kbps satellite channel with a round trip delay of 500 msec (10^-3 sec). To send a frame of size 1000 bits..it takes = 1000/50kbps = 20msec. At t=0, the sender sends the first bit and at t = 20 msec (1000/50,000 sec= 1/50 sec= 1000/50 msec = 20msec), it sends the last bit. At t= 270 msec, the frame completely reaches the receiver. Not before t= 520 msec, the ack arrives back at the receiver ( it will be later than this). This means that the sender was blocked for 500 msec out of 520 msec.

26 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.

27 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.

28 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.

29 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%.

30 Pipelining over noisy channels What if one or more frames is errored. Two options : –Throw away all the subsequent frames and go back and start resending from the damaged frame. This corresponds to size 1 window in the receiver. - Go back N Protocol –Buffer the subsequent frames and wait for the damaged frame to be resent, once that comes handover the frames in proper order to the NL-Selective Repeat Protocol

31 Comparison Trade off between the bandwidth utilization and the buffer space in the receiver.

32 A Protocol Using Go Back N Pipelining and error recovery. Effect on an error when (a) Receivers window size is 1. (b) Receivers window size is large.

33 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, 0…7 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.

34 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, 0…7 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.

35 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.

36 Sliding Window Protocol Using Go Back N Continued

37 Sliding Window Protocol Using Go Back N Continued

38 Sliding Window Protocol Using Go Back N Continued

39 Sliding Window Protocol Using Go Back N

40 Sliding Window Protocol Using Go Back N (2) Simulation of multiple timers in software.

41 A Sliding Window Protocol Using Selective Repeat Continued

42 A Sliding Window Protocol Using Selective Repeat (2)

43 A Sliding Window Protocol Using Selective Repeat (3) Continued

44 A Sliding Window Protocol Using Selective Repeat (4)

45 Issues in Selective Repeat 7 frames 0-6 are sent, Received, ack-ed, and window of the receiver advanced to 7,0-5 All ack lost Sender times out and resends frame 0-6 At receiver, 0-5 accepted, buffered(since next frame it is expecting is 7) as new frames and ack- ed (Ack 6) and 6 discarded and acked as a duplicate Sender advances its window to 7,0-5 Sends packets 7,0-5

46 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: P0…p6, p0…p6, p7, p0(new)…p5(new) Order in which packets are handed over to NL of the receiver: P0…p6,p7,p0…p5(duplicate) and rest are discarded including the new frames

47 Solution Keep the window size 4 That is half the range of permitted sequence numbers.

48 A Sliding Window Protocol Using Selective Repeat (5) (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 acknowledged.

49 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

50 I Acknowledge Help from the following site In preparing this lecture.


Download ppt "Data Link Layer Protocols Flow Control in Data Link Layer."

Similar presentations


Ads by Google