Data Link Control and Protocols Chapter 11

Embed Size (px)

Citation preview

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    1/38

    Data Link Control and

    Protocols

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    2/38

    Data communication system always have a

    sending and a Receiving device Flow control A set of procedures that tells the sender how much data

    it can transmit before receiving an acknowledgmentfrom the receiver.

    The flow control must not overwhelm the receiver

    Receiver have slower processing speed than incomingTx Data, and limited memory(buffer) for storing the

    incoming transmission data. Once the buffer filled the sender should be informed to

    halt transmission until it is once again able to receive.

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    3/38

    Data Link Control and Protocols ErrorControl A mechanism for error detection and error correction

    Inform receiver about any lost or damaged receivedframe

    Error correction is the retransmission of specifiedframes

    Error detection + retransmission is called

    Automatic Repeat Request or ARQ.

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    4/38

    DLL is responsible for flow control and

    error control or

    Flow control + error control is collectively

    know as Data link Control

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    5/38

    Flow and error control protocols

    Stop and-Wait ARQ

    Go-Back-N ARQ

    Selective Repeat ARQ

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    6/38

    Stop and-Wait ARQ Keep a copy of last transmitted frame for retransmission

    For identification purpose both DATA & ACK frames arenumbered alternately 0 & 1.

    In case of a damaged frame is detected the receiverdiscard the frame and send no Acknowledgment.

    If the receiver receives an out of order frame, it knowsthat a frame is lost it simply discard the out-of-order

    received frame The sender has a Control Variable S that holds the

    number of the recently send frame (0 or 1).

    The Receiver has a Control Variable R that holds the

    number of the next frame expected (0 or 1).

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    7/38

    Stop and-Wait ARQ The sender starts a timer when its send a frame to

    receive an Acknowledgment with in an allotted time

    period. The receiver sends only positive Acknowledgment for

    frames receive safe and sound.

    The Acknowledgment number always define thenumber of next expected frame.

    If frame 0 is received, ACK1 is sent, if frame 1 isreceived ACK0 is sent.

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    8/38

    Stop and-Wait ARQ

    A B

    Sender Receiver

    Frame 0

    Frame 1

    ACK 1

    ACK 0

    S = 0

    S = 0

    S = 1

    R = 0

    R = 1

    Time Time

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    9/38

    In transmission of a frame we have foursituations

    Normal Operation

    The frame is lost

    The acknowledgment is lost

    The acknowledgment is delayed.

    Stop and-Wait ARQ

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    10/38

    Lost or Damaged Frame

    A B

    Sender Receiver

    Frame 0

    Frame 1

    ACK 1

    ACK 0

    S = 0

    S = 0

    S = 1

    R = 0

    R = 1

    Time Time

    lost

    Frame 1S = 1

    R = 1

    R = 0

    Time out

    Sender send anothercopy of frame whentime expires

    The The receiverremains silent abouta lost frame andkeeps its value of R

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    11/38

    LostAcknowledgment

    A B

    Sender Receiver

    Frame 0

    Frame 1

    ACK 1

    ACK 0

    S = 0

    S = 0

    S = 1

    R = 0

    R = 1

    Time Time

    lostFrame 1

    S = 1

    R = 0Time out

    ACK 0

    Expecting frame 0,frame 1 discarded

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    12/38

    Delayed Acknowledgment

    A B

    Sender Receiver

    Frame 0

    Frame 0ACK 1

    ACK 0

    S = 0

    S = 0

    S = 1

    R = 0

    R = 1

    Time Time

    Frame 1S = 1

    R = 1

    ACK 1

    Frame 1

    Expecting Frame1,

    frame 0 discarded

    Time out

    Time out

    Discarded

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    13/38

    Bi-directional Transmission

    The stop and wait mechanism is unidirectional

    It can be bi-directional if

    Both parties have two separate channels for full duplextransmission or

    Share the same channel for half-duplex Transmission

    Both parties will need S & R Variables to track frame sent

    and expect.

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    14/38

    PiggybackingA method to combine a Data frame with an Acknowledgment. SaveBandwidth

    A B

    Sender Receiver

    Frame 0, ACK0

    Frame 1, ACK 1

    Frame 0, ACK 1

    Frame 1, ACK 0

    S = 0

    S = 0

    S = 1

    R = 0

    R = 1

    Time Time

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    15/38

    GO-BACK-N

    ARQ In Stop-and-Wait ARQ the sender send one frame and

    waiting for the ACK. This is wastage of bandwidth

    For better efficiency, multiple frames should be intransition while waiting for Acknowledgment

    Go-Back-N ARQ send up to WFrames before worryingabout ACK

    like Stop-and-Wait ARQ it keeps the copy of theseFrames until the ACK arrive.

    Some extra features are added to Stop-and-Wait ARQ

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    16/38

    GO-BACK-N

    ARQ Each transmitted frame have a sequence No.

    If the header of the frame allows m bits,

    then sender can transmit 2()sequentially I.e 0-7

    The sequence can be repeated but will be

    considered the next cycle. The sender sets a timer for each frame sent.

    The receiver has no timer

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    17/38

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    18/38

    Sliding WindowThe size of the window at the receiver site in this

    protocol is always 1

    6 7 0 1 2 3 4 5 6 7

    6 7 0 1 2 3 4 5 6 7

    a. Before Sliding

    b. After Sliding

    .

    .

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    19/38

    Sliding Window Control Variables

    The sender has three variables S, SF, and SL

    S holds the sequence number of recently sent frame SF holds the sequence number of the first frame in the window

    SL holds the sequence number of the last frame in the window

    The size of the window is W = SLSF + 1

    The receiver has only one variable , R that holds the sequence

    No of the frame it expects to receive.

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    20/38

    GO-BACK-N

    ARQAcknowledgment The receiver send only positive ACK for the frame

    arrived safe and sound

    If a frame lost or damaged the receiver discard allthe subsequent frame

    In case of no ACK and from receiver the sender goback and resend all frames, beginning with the one

    with the expired timer Receiver can also send one cumulative ACK for

    several frames

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    21/38

    A B

    Sender Receiver

    Frame 0

    Frame 1

    ACK 2

    ACK 3

    Time Time

    Frame 2

    0 1 2 3 0 1 20 1 2 3 0 1 2

    0 1 2 3 0 1 2

    0 1 2 3 0 1 2

    0 1 2 3 0 1 2

    0 1 2 3 0 1 2

    0 1 2 3 0 1 2

    0 1 2 3 0 1 2

    S

    R

    R

    R

    R

    S

    S

    S

    Frame 3

    SF SL

    Normal Operation

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    22/38

    Damaged or Lost Frame

    A B

    Sender Receiver

    Frame 0

    Frame 1

    ACK 2

    ACK 3

    Time Time

    Frame 2

    0 1 2 3 0 1 2

    0 1 2 3 0 1 2

    0 1 2 3 0 1 2

    0 1 2 3 0 1 2

    0 1 2 3 0 1 2

    0 1 2 3 0 1 2

    0 1 2 3 0 1 2

    0 1 2 3 0 1 2

    R

    R

    R

    RS

    Frame 3

    SF SL

    Frame 2

    0 1 2 3 0 1 2

    R

    Frame 3

    Frame 3 discardedResent

    Resent

    0 1 2 3 0 1 2

    0 1 2 3 0 1 2

    S

    S

    S

    S

    S

    Lost

    Time out

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    23/38

    Selective Repeat ARQ GO-BACK-N ARQ is inefficient over noisy link

    Resending of multiple frames for one damaged or lostframe

    Selective Repeat ARQ is a new mechanism and does notuse resending of multiple frame for one damaged orlost frame

    Processing at receiver side is now more complex

    Now the size of window should be at most one-half ofthe value 2^m

    The receiver and sender now have same size windows

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    24/38

    Selective Repeat ARQ The receiver is now looking for a range of sequence

    numbers

    The receiver now have two variables RF and RL

    Now receiver can send a Negative Acknowledgment

    (NAK) for a specific lost or damaged frame to the sender

    Sender also sets a timer for each frame sent

    The size of the sender and receiver window must be atmost one-half of 2^m or 2^m/2.

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    25/38

    A B

    Frame 0

    Frame 1

    ACK 2

    NAK 2

    Time Time

    Frame 3

    0 1 2 3 0 1 2

    0 1 2 3 0 1 2

    0 1 2 3 0 1 2

    0 1 2 3 0 1 2

    0 1 2 3 0 1 2

    0 1 2 3 0 1 2

    S

    Frame 2

    0 1 2 3 0 1 2Frame 2

    0 1 2 3 0 1 2

    Lost

    0 1 2 3 0 1 2

    S

    S

    S

    S

    Resent

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    26/38

    High-level Data Link Control(HDLC)

    An actual protocol designed to support both Half-duplex and full-duplex communication over point-to-

    point and multi link It implement the ARQ mechanism

    HDLC provides the following modes of Transmission

    Normal Response Mode Asynchronous Balanced Mode

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    27/38

    Normal Response Mode-NRM

    A B

    A CB

    Primary

    Point-to-Point

    Command

    Secondary

    Primary

    Response

    Response

    Command

    Response

    Secondary

    Secondary

    Primary

    Unbalanced configuration, one primary and multiple secondary stations

    A primary station can send commands, a Secondary station can only response

    Multi-point

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    28/38

    Asynchronous Balanced ModeThe configurations is balanced

    The link is point-to-point and each station can function as a primary and a secondary

    A B

    Combined

    Point-to-Point

    Command/Response

    Combined

    Command/Response

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    29/38

    High-level Data Link Control(HDLC)

    HDLC defines three types of frames

    Information Frames (I-frame)used to transport user data and control informationrelating to user data (piggybacking)

    Supervisory frames (S-frames)used to transport Control information

    Unnumbered Frames (U-frames)are reserved for system management (for link itself)e.g. connects and disconnects connections betweensenders and receivers.

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    30/38

    High-level Data Link Control(HDLC)

    Flag Address Control Information FCS Flag

    8-bit 1-or 2-byte 2-or 4-byte

    Only in I- and U-frames

    8-bit

    Flag field with a 01111110 pattern identifies both start and end o f aframe and synchronization

    The control field is used for flow and error control

    FCS is for HDLC,s error detection field

    The information field contain the user,s data

    Address field contains a from address if originated by secondarystation (final). it contain a to address if originated by primary station(poll).

    Those networks that do not use primary secondary configuration(Ethernet) use two address fields I.e source and destination addresses

    1-or multi-byte

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    31/38

    HDLC frame type

    Flag Address Control Information FCS Flag

    Flag Address Control FCS Flag

    Flag Address Control Information FCS Flag

    I-Frame

    S-Frame

    U-Frame

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    32/38

    HDLC frame type

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    33/38

    High-level Data Link Control(HDLC)

    Flag Address Control Information FCS Flag

    Poll=2ndry station originate

    Final=primary station originate

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    34/38

    High-level Data Link Control(HDLC)

    Pi b ki ith t & With E

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    35/38

    Piggybacking without & With Error

    I - Frame

    0 1

    FLag

    FCS

    Data

    FLag

    B

    A B

    I - Frame

    0 0

    FLag

    FCS

    Data

    FLag

    AFLag

    FCS

    Data

    FLag

    B

    S - Frame

    3 RR

    FL

    ag

    F

    CS

    FL

    agB

    DATA

    Acknowledgment

    I - Frame

    0 2

    DataAFLag

    FCS

    FLag

    I - Frame

    2 2

    DataAFLag

    FCS

    FLag

    I - Frame

    1 2

    A B

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    36/38

    A B

    DataAFLag

    FCS

    FLag

    S - Frame

    1 REJ

    FLag

    FCS

    FLag

    B

    DATA

    Reject

    I - Frame

    0 2

    DataAFLag

    FCS

    FLag

    I - Frame

    2 2

    DataAFLag

    FCS

    FLag

    I - Frame

    1 2Error

    S - Frame

    3 RR

    FL

    ag

    F

    CS

    FL

    agB

    Acknowledgment

    DATA

    DataAFLa

    g

    FC

    S

    FLa

    g

    I - Frame

    1 2

    DataAFLag

    FCS

    FLag

    I - Frame

    2 2

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    37/38

    Ethernet Frame

  • 7/29/2019 Data Link Control and Protocols Chapter 11

    38/38

    Thanks a lot