Data Link Layer - PowerPoint PPT Presentation

About This Presentation
Title:

Data Link Layer

Description:

... the sender has no way of knowing whether this speed is too high or too low. ... the frame with sequence number m, please send me frame with sequence number m 1. ... – PowerPoint PPT presentation

Number of Views:69
Avg rating:3.0/5.0
Slides: 29
Provided by: zhen6
Learn more at: http://www.cs.fsu.edu
Category:
Tags: data | layer | link | metoo | screws

less

Transcript and Presenter's Notes

Title: Data Link Layer


1
Data Link Layer
2
Data link layer
  • The communication between two adjacent machines.
  • Basic property
  • If bit A is sent before bit B, bit A will be
    received earlier than bit B
  • Fundamental constraints
  • Errors
  • Computers have different capabilities
  • Delay is not zero

3
Data link layer
  • What the data link layer does is to encapsulate
    the packets from the network layer into frames
    and send out these frames.
  • So we will discuss how to deliver these frames.

4
Framing
  • How does the receiver know where is the start and
    where is the end of a frame?
  • Counter. Tell the receiver how many bytes there
    are in this frame. Problems?
  • The counter part could be corrupted and you are
    done.

5
Flag Bytes
  • Add special bytes to the beginning and the end of
    the frame.
  • Problems?
  • What if the data contains the flag bytes?
  • Add ESC byte to each flag or ESC in the data.
    Stuffing.
  • Any time you see an ESC, the next byte is either
    ESC or FLAG naturally occurred in the data.

6
Using Bits
  • More flexibility gained by sending bits. Using
    01111110 as the flag bits.
  • If the data contains this pattern, add a 0 after
    the fifth 1.

7
Error detection
  • So the frames are sent. At the receiver side, how
    do you know that you received the frame
    correctly?
  • Using the error control code discussed last time.
  • Calculate the syndrome, if it is 0, then assume
    no error, if it is not zero, then some error.
  • Could this scheme give you the wrong judgment
    sometime? Can it be 100 accurate?

8
Data link layer protocols
  • Assume that the physical layer, the data link
    layer, and the network layer are three processes
    and communicate with each other.
  • Assume that the sender always has enough data to
    send.
  • Assume that the machines dont crash.
  • Assume that the data flows only one direction
    (simplex).

9
Protocol 1.
  • Your protocol really depends on the world you are
    living in.
  • If (1) the link never screws up your bits, and
    (2) the receivers network layer process reads
    the bits infinitely fast, what should be your
    protocol?

10
Protocol 1
  • Sender.
  • Grab data from the network layer.
  • Send to physical layer. Goto 1.
  • Receiver
  • Get data from the physical layer
  • Give it to the network layer. Goto 1.

11
Protocol 2
  • Now remove assumption (2). The receivers
    network layer process is not infinitely fast. How
    to design the protocol?

12
Protocol 2
  • The receiver must provide some kind of
    acknowledgements. If the receiver never tells the
    sender anything, the sender has no way of knowing
    whether this speed is too high or too low.
  • The simplest form of ack is the receiver sends
    back an ack every time he receives a frame.
  • The sender waits for this ack to start sending
    the next frame.
  • Called stop and wait.

13
Protocol 2
  • Sender.
  • Grab data from the network layer.
  • Send to physical layer
  • Wait for ack. Goto 1.
  • Receiver
  • Get data from the physical layer
  • Give it to the network layer
  • Send ack. Goto 1.

14
Protocol 3
  • Now, lets remove assumption (1). There is now
    noise in the channel and frames could be
    corrupted. Both the data frame and the ack
    frame.
  • How to design your protocol? What are the
    considerations?

15
Protocol 3
  • So we can add a timer. If the sender does not
    receive the ack before the timer expires, he
    knows something is wrong and resend this frame.
  • How long should the timer be set?
  • Problems?

16
Protocol 3
  • A sent B frame F.
  • B received the frame. Sent ack to A. Ack got
    lost.
  • A time out. Resend F.
  • B received F. AGAIN!

17
Sequence Number
  • Every frame has a sequence number.
  • Sender says I am sending the frame with sequence
    number m.
  • Receiver acks saying that I have successfully
    received the frame with sequence number m, please
    send me frame with sequence number m1.
  • This will solve the duplication problem. Why?

18
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 before time out
    for the frame with the current sequence number,
    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.

19
Protocol 3
  • Question 1. After sender sends frame m, will he
    receive Expc for lower than m?

20
Protocol 3
  • Answer. No. Because when sender sent frame m, he
    must have received Expc from the receiver of m.
    Receiver keeps the sequence number and wont
    decrease it.

21
Protocol 3
  • Question 2. After sending out an Expc of m1,
    what are the possible frames the receiver can
    receive?

22
Protocol 3
  • Answer. The only possible frames he could
    receive is m or m1.
  • In what case he receives m? In what case he
    receives m1? Why cant he receive m-1 (Because
    when sender sends m, he knows that m-1 is
    received correctly.)? Why cant he receive m2
    (because sender wont send m2 before the
    receiver sends Expc m2)?

23
Protocol 3
  • Question 3. How many bits should the sequence
    number have?

24
Protocol 3
  • Answer. 1 bit.

25
Sliding window
  • Think the frames the sender has to send as a
    continuous stream. The window contains the
    current frame being sent and is not acked yet.
    Every ack (Expc) moves the window forward one
    frame.

26
Correctness Part is Done!
  • So our Protocol 3 will work without causing
    errors. ARQ. (automatic repeat request)
  • So the next step is the optimization.
  • Any one sees the problem?

27
Large link delays
  • 500ms delay. 50kbps. Each frame is 1000 bits.
  • What is the link efficiency?

28
Solution
  • So, increase the window size from 1 to n.
  • Would want to do this whenever the bandwidth
    delay product is large.
  • Go-back N
  • Selective-repeat
Write a Comment
User Comments (0)
About PowerShow.com