l2-data link control

Upload: jennifer-clinton

Post on 06-Apr-2018

226 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/3/2019 L2-Data Link Control

    1/33

    CS2105: Introduction to Computer Networks

    Anand BhojanCOM2-02-46, School of [email protected]: 651-67351

    Anand BhojanCOM2-02-46, School of Computingbanand@

    comp.nus.edu.sgph: 651-67351

    L2: Principles of Reliable Data

    Transfer (Data Link Control)

    FramingFlow and Error Control Concepts

    Stop-and-Wait ARQ Protocol

    Go-Back-N Protocol

    Selective-Repeat Protocol

  • 8/3/2019 L2-Data Link Control

    2/33

    Data Link Layer

    47

    Data Transfer between two directly connected nodes. (Hop-to-Hop communication, Point-to-point communication)

    Data link layer divided into two functionality-oriented sublayers

    application

    transport

    network

    link

    physical

    CS2105/2011-12 Sem 2/AaBee

    Data Link Control

    Multiple Access Resolution

    Data Link Layer

  • 8/3/2019 L2-Data Link Control

    3/33

    Data Link Layer - Framing

    48

    Bits must be framedinto discernible blocks ofinformation.

    Message/Data is broken up into recoverablechunks that can easily be checked for corruption.

    Frames have Source and Destination addresses Separates/identifies frames from different sources

    at the destination.

    CS2105/2011-12 Sem 2/AaBee

  • 8/3/2019 L2-Data Link Control

    4/33

    Data Link Control Protocols - Simple Protocol

    Assumes noiseless channel and infinite buffer

    Note:- Shown as Link layer Protocol. It is also applicable for Transport Layer.

    49 CS2105/2011-12 Sem 2/AaBee

  • 8/3/2019 L2-Data Link Control

    5/33

    Flow control - concept

    What happens if the channel is noiseless but thereceiver has finite buffer?

    Receiver processes data at its own speed. Sender cannot overwhelm the receiver with large amount of data.

    Flow Control is required! How?

    51 CS2105/2011-12 Sem 2/AaBee

  • 8/3/2019 L2-Data Link Control

    6/33

    Stop-and-Wait Protocol

    What happens if the channel is noiseless but thereceiver has finite buffer?

    Flow control refers

    to a set of

    procedures used torestrict the

    amount of data

    that a sender can

    send before waiting

    for an

    acknowledgment(ACK).

    Flow Control is required

    52 CS2105/2011-12 Sem 2/AaBee

  • 8/3/2019 L2-Data Link Control

    7/33

    Error Control - concept

    Channel is noisy (errors, losses anddelay) with finite buffer.

    Error Control is required! How?

    53 CS2105/2011-12 Sem 2/AaBee

  • 8/3/2019 L2-Data Link Control

    8/33

    Most Common Error Control - concept

    Generally frames have some error detectionmechanism (will be discussed in next Lecture)

    If received frame is in error, receiver requests forretransmission Automatic Repeat Request (ARQ)

    54 CS2105/2011-12 Sem 2/AaBee

  • 8/3/2019 L2-Data Link Control

    9/33

    Stop and Wait ARQ - Design

    Case 1: Lost or Corrupt Frame. How to find and retransmit?

    55 CS2105/2011-12 Sem 2/AaBee

  • 8/3/2019 L2-Data Link Control

    10/33

    Stop and Wait ARQ - Design

    Case 2: Lost or Corrupt ACK.

    Side effect?

    56 CS2105/2011-12 Sem 2/AaBee

  • 8/3/2019 L2-Data Link Control

    11/33

    Stop and Wait ARQ - Design

    Case 3: Delayed Frame/ACK

    Duplicate ACK

    57 CS2105/2011-12 Sem 2/AaBee

  • 8/3/2019 L2-Data Link Control

    12/33

    Stop and Wait ARQSender maintainsa

    timerfor each

    transmittedframe

    maintains acopy of eachtransmittedframe and

    retransmitswhen required

    numbers theframes

    Numbers theACKs (nextexpectedframenumber)

    Summary

    58 CS2105/2011-12 Sem 2/AaBee

  • 8/3/2019 L2-Data Link Control

    13/33

    Performance of Stop and Wait ARQ

    Stop-and-wait ARQ works, but performance stinks

    example: 1 Gbps link, 15 ms end-to-end Prop Delayfrom east coast to west coast of US (RTT=30 ms;approx speed of light), 1KB packet:

    Ttransmit

    = 8kb/pkt

    10**9 b/sec = 8 microsec

    U sender: utilization of sender or utilization of the channel(time sender busy sending / total time)

    L (packet length in bits)

    R (transmission rate, bps) =

    1 Gbps link is underutilized59 CS2105/2011-12 Sem 2/AaBee

  • 8/3/2019 L2-Data Link Control

    14/33

    first packet bit transmitted, t = 0

    sender receiver

    RTT

    last packet bit transmitted, t = L / R

    first packet bit arrives

    last packet bit arrives, send ACK

    ACK arrives, send nextpacket, t = RTT + L / R

    Performance of Stop and Wait ARQ

    As BDP increases we need to transmit more bits or

    frames (before waiting for ACK) to improve the utilisation

    Effect of increasing Distance (or RTT)? Effect of increasing digital BW? == BDP

    60 CS2105/2011-12 Sem 2/AaBee

  • 8/3/2019 L2-Data Link Control

    15/33

    Pipelined protocols

    Pipelining: sender allows multiple, in-flight, yet-

    to-be-acknowledged pkts

    range of sequence numbers must be increasedbuffering at sender and/or receiver

    Two generic forms of pipelined protocols:go-

    Back-N, selective repeat

    61 CS2105/2011-12 Sem 2/AaBee

  • 8/3/2019 L2-Data Link Control

    16/33

    Analogy:

    62

    Current: An Analogy: Talking on a

    Cell Phone.

    Bob says a sentencesand waits for ACK(uh huh) before

    saying next sentence.

    Pipe-lined: An Analogy: Talking on a

    Cell Phone.

    Bob is allowed to say Nsentences and waits forACK (uh huh) before

    saying next sentence.

    Questions: How much is N?

    Can N be infinite? Cumulative ACK

    CS2105/2011-12 Sem 2/AaBee

  • 8/3/2019 L2-Data Link Control

    17/33

    Go-back-N ARQ (GBN)

    How many in-flight packets? N Packets (sliding window of sizeN on sequence numbers) --- [Flow Control]

    Out-of-order packets are discarded. Because of this, Receivewindow size of GBN is 1 and acknowledgement in GBN is

    cumulative. Packet losses uses timer; retransmit on timeout

    63 CS2105/2011-12 Sem 2/AaBee

  • 8/3/2019 L2-Data Link Control

    18/33

    Some examples follows

    64 CS2105/2011-12 Sem 2/AaBee

  • 8/3/2019 L2-Data Link Control

    19/33

    Send 1 PacketEg 1:

    65 CS2105/2011-12 Sem 2/AaBee

  • 8/3/2019 L2-Data Link Control

    20/33

    Receive ACK 4Eg 2:

    66 CS2105/2011-12 Sem 2/AaBee

  • 8/3/2019 L2-Data Link Control

    21/33

    Receive ACK 6Eg 3: Cumulative ACK

    67 CS2105/2011-12 Sem 2/AaBee

  • 8/3/2019 L2-Data Link Control

    22/33

    Full WindowEg 4:

    68 CS2105/2011-12 Sem 2/AaBee

  • 8/3/2019 L2-Data Link Control

    23/33

    Empty WindowEg 5:

    69 CS2105/2011-12 Sem 2/AaBee

  • 8/3/2019 L2-Data Link Control

    24/33

    Go-back-N ARQ

    Why it is called Go-back-N? When a timer expires all frames starting from the frame in error are

    retransmitted.

    Example:Frame 3

    Frame 4Frame 5

    Frame 6

    Frame 3

    Frame 4

    Frame 5

    Frame 6

    Timer ExpiredGo back and retransmit all

    frames starting from frame 3!

    Sender Receiver

    Stop-and-Wait ARQ is a special case

    of Go-Back-N ARQ in which the size

    of the send window is 1.

    70 CS2105/2011-12 Sem 2/AaBee

  • 8/3/2019 L2-Data Link Control

    25/33

    GBN eg1: Lost ACKs

    71 CS2105/2011-12 Sem 2/AaBee

  • 8/3/2019 L2-Data Link Control

    26/33

    The size of the receive window

    is always 1 in Go-back-N

    GBN eg2: Lost Frame

    72 CS2105/2011-12 Sem 2/AaBee

  • 8/3/2019 L2-Data Link Control

    27/33

    Go-back-N ARQ window SIZE If the size of sequence number field is m bits,

    then we can transmit a maximum of2m

    -1 frames. Example: 2 bit sequence number

    73 CS2105/2011-12 Sem 2/AaBee

  • 8/3/2019 L2-Data Link Control

    28/33

    Selective-Repeat ARQ (SR)

    GBN leads to unnecessary retransmission since outof order packets are discarded.

    SR sender retransmits only the lost (or invalid; error)packets. (Improvement over GBN).

    Requirements at receiver side Receiver should buffer out of order packets. Receiver needs a

    receiver-window of size of size equal to send window.

    74 CS2105/2011-12 Sem 2/AaBee

  • 8/3/2019 L2-Data Link Control

    29/33

    Selective-Repeat ARQ (SR)

    75 CS2105/2011-12 Sem 2/AaBee

  • 8/3/2019 L2-Data Link Control

    30/33

    SR eg1: Lost Frame

    Instead NAK one can use Duplicate ACK to tell the expected frame to the sender

    What happens if NAK 1 is lost?

    76 CS2105/2011-12 Sem 2/AaBee

  • 8/3/2019 L2-Data Link Control

    31/33

    Selective Repeat ARQ

    In Selective Repeat ARQ, the size of the sender andreceiver window must beat most one-half of 2

    m

    .

    77 CS2105/2011-12 Sem 2/AaBee

  • 8/3/2019 L2-Data Link Control

    32/33

    Piggybacking

    Communication is generallyfull-duplex

    acknowledgement can bepiggybacked on data in

    the opposite direction.

    Sender Receiver

    Frame0

    Frame0

    Frame 1, ACK 2

    Frame2,ACK2

    ACK1

    Frame1ACK1

    78 CS2105/2011-12 Sem 2/AaBee

  • 8/3/2019 L2-Data Link Control

    33/33

    Summary

    Flow control and Error controlSimple Protocol (No flow and error control)Stop and Wait (for flow control)Stop and Wait ARQ (adds error control to SW)Pipelined Protocols (improves efficiency of SW-ARQ)GBN : receive window size = 1SR : receiver window = send window size

    READ THE TEXT BOOK.

    (Slides alone are not enough)

    79 CS2105/2011-12 Sem 2/AaBee