data link layer and error control week4

Upload: anbusaba

Post on 04-Apr-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 Data Link Layer and Error Control Week4

    1/25

    The Data Link Layer

  • 7/30/2019 Data Link Layer and Error Control Week4

    2/25

    Data Link Layer Design Issues

    Services Provided to the Network Layer Framing

    Error Control

    Flow Control

  • 7/30/2019 Data Link Layer and Error Control Week4

    3/25

    Functions of the Data Link Layer

    Provide service interface to the network layer

    Dealing with transmission errors

    Regulating data flow Slow receivers not swamped by fast senders

  • 7/30/2019 Data Link Layer and Error Control Week4

    4/25

    Functions of the Data Link Layer (2)

    Relationship between packets and frames.

  • 7/30/2019 Data Link Layer and Error Control Week4

    5/25

    Services Provided to Network Layer

    (a) Virtual communication.

    (b) Actual communication.

  • 7/30/2019 Data Link Layer and Error Control Week4

    6/25

    Services Provided to Network Layer (2)

    Placement of the data link protocol.

  • 7/30/2019 Data Link Layer and Error Control Week4

    7/25

    Framing

    A character stream. (a) Without errors. (b)

    With one error.

  • 7/30/2019 Data Link Layer and Error Control Week4

    8/25

    Framing (2)

    (a) A frame delimited by flag bytes.(b) Four examples of byte sequences before and after stuffing.

  • 7/30/2019 Data Link Layer and Error Control Week4

    9/25

    Framing (3)

    Bit stuffing(a) The original data.

    (b) The data as they appear on the line.

    (c)The data as they are stored in receivers memory afterdestuffing.

  • 7/30/2019 Data Link Layer and Error Control Week4

    10/25

    Error Control

    Error-Correcting Codes

    Error-Detecting Codes

    Check for error at the receiver

    Error: Request a retransmission

    No error: Either continue or send an ACK

  • 7/30/2019 Data Link Layer and Error Control Week4

    11/25

    Error control codes

    Adding redundancy to overcome errors

    m message bits

    r check bits

    2m messages

    2n possible codewords

  • 7/30/2019 Data Link Layer and Error Control Week4

    12/25

    Hamming distance

    100000100000101101011010111101

    The two codewords have a

    Hamming distance of two (differ intwo bits)Hamming distance of the code:

    Minimum Hamming distancebetween any two codewords

  • 7/30/2019 Data Link Layer and Error Control Week4

    13/25

    Error detection/correction capacity

    Detect d errors: distance d+1 code

    Correct d errors: distance 2d+1 code

    Parity bit: Simple error detecting bit

    Added so that # of 1 bits is odd/even.

    d=1

  • 7/30/2019 Data Link Layer and Error Control Week4

    14/25

    Error-Correcting Codes

    Use of a Hamming code to correct burst errors.

  • 7/30/2019 Data Link Layer and Error Control Week4

    15/25

    Error detecting codes

    Parity codes

    Odd parity (tek elik)

    0/1 added to make the sum of 1s equal to an odd

    number

    Even parity (ift elik)

    0/1 added to make the sum of 1s equal to an even

    number

  • 7/30/2019 Data Link Layer and Error Control Week4

    16/25

    Error detecting codes Cyclic

    Redundancy Check (CRC )

    Polynomial codes

    Polynomial arithmetic is modulo 2.

    110100111257

    xxxx

    101110001

    11010110

    110100111

    456

    2467

    257

    xxx

    xxxxx

    xxxx

  • 7/30/2019 Data Link Layer and Error Control Week4

    17/25

    Error-Detecting

    Codes

    Calculation of the polynomial

    code checksum.

  • 7/30/2019 Data Link Layer and Error Control Week4

    18/25

    Cyclic Redundancy Check

    (evrimli Fazlalk Snamas)

    M(x): message polynomial

    G(x): generator polynomial available at

    transmitter and receiver of degree r

    Transmitter operation:

    R(x): remainder

    T(x): transmitted

    Channel effects

    Receiver: check

    ...)( r

    x

    )(

    )()(

    xG

    xMxxR

    r

    )()()( xRxMxxTr

    )()()()( xExTxVxTchannel

    0)(

    )( ?

    xG

    xV

  • 7/30/2019 Data Link Layer and Error Control Week4

    19/25

    Cyclic Redundancy Check

    (evrimli Fazlalk Snamas)

    Note that by definition

    Can catch errors if

    Design G(x) to catch single bit errors:

    catch double bit errors:

    catch odd number of errors:

    catch burst errors of

    length r:

    0)(

    )( xGxT

    0)(when0)(

    )( xE

    xG

    xE

    .........)( ji

    xxxG

    0)(

    1

    xG

    xk

    )(~)1()( xGxxG

    rkx

    xx

    xG

    xEr

    ki

    if0)1...(

    )1...(

    )(

    )(1

  • 7/30/2019 Data Link Layer and Error Control Week4

    20/25

    Elementary data link layer protocols

    An Unrestricted Simplex Protocol Sender sends frames as long as they come from the

    network layer

    A Simplex Stop-and-Wait Protocol After sending each frame sender holds until an

    acknowledgement arrives back from the receiver

    A Simplex Protocol for a Noisy Channel If an ack is not sent by receiver sender times out and

    retransmits In case the ack gets lost to prevent duplicate frames at

    the receiver the frame contains a seq. no.

  • 7/30/2019 Data Link Layer and Error Control Week4

    21/25

    Sliding Window Protocols

    A One-Bit Sliding Window Protocol

    A Protocol Using Go Back N

    A Protocol Using Selective Repeat

  • 7/30/2019 Data Link Layer and Error Control Week4

    22/25

    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.

  • 7/30/2019 Data Link Layer and Error Control Week4

    23/25

    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.

  • 7/30/2019 Data Link Layer and Error Control Week4

    24/25

    A One-Bit Sliding Window Protocol (2)

    Two scenarios for protocol 4. (a) Normal case. (b)Abnormal case. The notation is (seq, ack, packetnumber). An asterisk indicates where a network layer

    accepts a packet.

  • 7/30/2019 Data Link Layer and Error Control Week4

    25/25

    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