1 / 22

Data link layer (2)

Data link layer (2). Review. Framing. ESC. What happens if ESC ESC FLAG ESC ESC real FLAG How to tell whether a received frame is good or not? Three protocols. The last one deals with slow receiver and noisy channel. Solution is ack (expc) plus sequence number. Stop and Wait (Protocol 3).

bernad
Télécharger la présentation

Data link layer (2)

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. Data link layer (2)

  2. Review • Framing. ESC. What happens if • ESC ESC • FLAG ESC • ESC real FLAG • How to tell whether a received frame is good or not? • Three protocols. The last one deals with slow receiver and noisy channel. Solution is ack (expc) plus sequence number.

  3. Stop and Wait (Protocol 3) • Sender. • Grab data from the network layer. • Send to physical layer with the current sequence number and start timer. • Wait for ack(Expc). If got ack for the frame sent before time out, increment the sequence number, repeat 1. Else, timeout, repeat 2. • Receiver • Get data from the physical layer • If it is with the expected sequence number, give it to the network layer, increment the sequence number. • send ack (Expc). Goto 1.

  4. Review • How it deals with • Lost packet • Lost ACK • Premature timeout

  5. Correctness Part is Done! • Protocol 3 will work without causing errors, meaning that the data link layer will deliver the packets from the network layer to the other side in order. • ARQ. (automatic repeat request)

  6. Optimization • So the next step is the optimization. • At the end of last lecture, considered an example of • 500ms delay. 50kbps. Each frame is 1000 bits. • Very low link efficiency.

  7. Solution • So, increase the window size from 1 to n. • Would want to have a large window size whenever the bandwidth delay product is large. • If bandwidth is large, sending is fast • If delay is large, even a moderate bandwidth will cause a poor efficiency

  8. Question • Given link speed and link delay, how large should the window be to achieve 100% efficiency?

  9. Sender window • The sender has a window from m+1 to m+n means that • the sender has received ack from the receiver for frame up to m, • the sender is allowed to send m+1, m+2, …, m+n. These packets can be outstanding without ack. • Sender has to maintain the sender window (buffering all outstanding frames), maintain timeout for all outstanding frames. • The size of the sender window is determined by the bandwidth and link delay

  10. Receiver window • The receiver also has a window. He has window from x+1, x+2, …, x+y means that • He has correctly received frames up to x • And he only accepts frames from x+1, x+2, …, x+y, any other frames will be discarded. • Receiver window is constrained by the buffer size.

  11. Go-Back-N • Let’s first consider the receiver’s window size is only 1. • This is called Go-Back-N.

  12. Go-Back-N (Protocol 4) Sender. while (1) { If network layer got data, if current window not full yet, read data, send to physical layer with the current sequence number. Start timer. Update sequence number. If got ack for frame m, if m is outside the window, don’t do anything. If m is inside the window, consider all frames in the window with seq. number less than m acked. Forward window. If timeout for frame m, resend all frames in the window with sequence number greater than m. } Receiver while (1) { Get data from the physical layer If it is with the expected sequence number, give it to the network layer, increment the sequence number. send ack (Expc). }

  13. Go-Back-N • Two new things. • Cumulative ACK • Resend every frame after the timeout frame

  14. Go-Back-N

  15. Go-Back-N • What if ACK is lost?

  16. Go-Back-N • Works fine is error is rare. Achieves full capacity. • Else wastes bandwidth.

  17. Selective Repeat (Protocol 5) • Further optimization. The only difference is at the receiver’s side. • Receiver has a window greater than 1. • Don’t discard frames simply because some earlier frames was damaged.

  18. Selective Repeat Sender. while (1) { If network layer got data, if current window not full yet, read data, send to physical layer with the current sequence number. Start timer. Update sequence number. If got ack for frame m, if m is outside the window, don’t do anything. If m is inside the window, consider all frames in the window with seq. number less than m acked. Forward window. If timeout for frame m, resend all frames in the window with sequence number greater than m. } Receiver while (1) { Get frame from the physical layer. If it is within the receiver window and hasn’t been received before, fill in the slot. Forward the beginning of the receiver window. Deliver to the network layer all frames between the beginning of the old receiver window and the new receiver window – 1, inclusive. send ack (Expc = the beginning of the new receiver window). }

  19. Selective Repeat

  20. Piggybacking • Considered only one direction. Bidirection. • Piggybacking • Combining ACK with data • When no data? • Wait some time and ACK anyway. • Internet. PPP.

  21. Number of bits in sequence number • Go-Back-N. If the sequence number is x bits. How large can the window be? • x=2 and window size is 4. • Case 1. • Sender sends 0,1,2,3. • Sender got ACK for 3. Send another 0,1,2,3. • Case 2. • Sender sends 0,1,2,3. • Sender didn’t get any ACK. Time out. Resend the first 0,1,2,3.

  22. Selective repeat:Dilemma • Example: • seq #’s: 0, 1, 2, 3 • window size=3 • receiver sees no difference in two scenarios! • incorrectly passes duplicate data as new in (a) • Q: what relationship between seq # size and window size? • window size = (MAXSEQNO + 1)/2

More Related