arq-error correction-lec12

Upload: waseem-sajjad

Post on 08-Apr-2018

234 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/7/2019 ARQ-Error correction-Lec12

    1/40

    1

    Error Control Through ARQError Control Through ARQ

    Error Control

  • 8/7/2019 ARQ-Error correction-Lec12

    2/40

    2

    Error control in the data link layer isError control in the data link layer is

    based on automatic repeat request,based on automatic repeat request,(ARQ) which is the retransmission of(ARQ) which is the retransmission of

    data.data.

    NoteNote::

  • 8/7/2019 ARQ-Error correction-Lec12

    3/40

    3

    Error Control mechanisms

    Stop and wait ARQ

    Go Back N ARQ

    Selective repeat ARQ

  • 8/7/2019 ARQ-Error correction-Lec12

    4/40

    4

    Stop and Wait ARQ Features

    Sender keeps copy of the last frametransmitted until it receivesacknowledgment.

    For identification, both data and ACKframes are numbered 1 and 0 alternately.Data 0 frame is acknowledged by ACK 1frame, Data 1 by ACK 0

    Damaged or lost frame receiver sends noacknowledgment. Simply discards it. Italso discards out of order frames.

  • 8/7/2019 ARQ-Error correction-Lec12

    5/40

    5

    Continued Sender has control variable S that holds

    the number of recently sent frame either 0or 1.

    Receiver has control variable R that holds

    the number of next frame expected either0 or 1.

    The sender starts a timer when it sends aframe, this is the time it waits for

    acknowledgement frame. Receiver sends only positive

    acknowledgements for frames received

    safe and sound. else wise it stays silent.

  • 8/7/2019 ARQ-Error correction-Lec12

    6/40

    6

    Stop-and-Wait ARQ

  • 8/7/2019 ARQ-Error correction-Lec12

    7/40

    7

    StopStop--andand--Wait ARQWait ARQ

    Operation

    In the transmission of a frame, we can havefour situations.

    Normal operation

    The frame is lost The acknowledgment is lost

    The acknowledgement is delayed

  • 8/7/2019 ARQ-Error correction-Lec12

    8/40

    8

    Normal operation

    Senderwaitsbeforesendingnextframe

    Timer

    is setagain

  • 8/7/2019 ARQ-Error correction-Lec12

    9/40

    9

    Stop-and-Wait ARQ, lost or damaged frame

    Receiverretainsvalueof R

    Retransmission

  • 8/7/2019 ARQ-Error correction-Lec12

    10/40

    10

    Stop-and-Wait ARQ

    One frame received and handled at a time

    If frame is damaged, receiver discards it andsends no acknowledgment

    Sender uses timer to determine whether or not toretransmit

    Sender must keep a copy of transmitted frame untilacknowledgment is received

    If acknowledgment is damaged, sender willknow it because of numbering

  • 8/7/2019 ARQ-Error correction-Lec12

    11/40

    11

    11.3 Stop-and-Wait ARQ, lost ACK frame

  • 8/7/2019 ARQ-Error correction-Lec12

    12/40

    12

    Stop-and-Wait ARQ: Example

  • 8/7/2019 ARQ-Error correction-Lec12

    13/40

    13

    In StopIn Stop--andand--Wait ARQ, numberingWait ARQ, numbering

    frames prevents the retaining offrames prevents the retaining ofduplicate frames.duplicate frames.

    NoteNote::

  • 8/7/2019 ARQ-Error correction-Lec12

    14/40

    14

    11.4 Stop-and-Wait ARQ, delayed ACK

    SupposeFrame lost

    If there wereNo numberingSender wouldHave thoughtThis as ACK of

    Frame 1.

  • 8/7/2019 ARQ-Error correction-Lec12

    15/40

    15

    Numbered acknowledgments areNumbered acknowledgments are

    needed if an acknowledgment isneeded if an acknowledgment isdelayed and the next frame is lost.delayed and the next frame is lost.

    NoteNote::

  • 8/7/2019 ARQ-Error correction-Lec12

    16/40

    16

    Go-Back-N ARQ

    In stop and wait ARQ, at any point in timefor sender, there is only one frame, theoutstanding frame, that is sent and

    waiting to be acknowledged. Not a good use of transmission medium.

    Multiple frames should be in transitionwhile waiting for acknowledgement.

    More than one outstanding frames. Thiswill improve the efficiency of system.

  • 8/7/2019 ARQ-Error correction-Lec12

    17/40

    17

    GoGo--BackBack--N ARQ ConceptsN ARQ Concepts

    Sequence Number

    Sender and ReceiverSliding Window

    Control Variables and Timers

    Acknowledgment

    Resending Frames

    Operation

  • 8/7/2019 ARQ-Error correction-Lec12

    18/40

    18

    Sequence Numbers

    Frames from sender are numberedsequentially.

    Sequence number of each frame is

    included in header. If header allows m bits for sequence

    number then sequence number range

    would be from 0 to 2m

    -1. If m=3 sequence numbers are

    0,1,2,3,4,5,6,7,0,1,2,3,.

  • 8/7/2019 ARQ-Error correction-Lec12

    19/40

    19

    Sender Sliding Window

    At sender side, to hold outstanding framesuntil they are acknowledged, we useconcept of window.

    Outstanding frames are enclosed inwindow.

    Size of window is fixed in this protocol.

    Size of window is at most 2m

    -1. The frames on left are already sent and

    acknowledged ones. These can be purged.

  • 8/7/2019 ARQ-Error correction-Lec12

    20/40

    20

    Sender sliding window

    Already sent and

    acknowledged frames

    Frames sent, waiting foracknowledgment

    Waiting,Cannot sent until

    Window slides onThem.

  • 8/7/2019 ARQ-Error correction-Lec12

    21/40

    21

    Receiver sliding window

    Receiver sliding window is always 1 in this protocol.

    Receiver is looking for specific frames to arrive at specific order.

    Frame arriving out of order are discarded and needs to be resent.

  • 8/7/2019 ARQ-Error correction-Lec12

    22/40

    22

    Control variables

    Sender has 3 control variables,1. S holds sequence number of recently sent frame

    2. SFholds sequence number first frame in the window3. SL holds sequence number last frame in the window

    Size of window = SL- S

    F+1

    Receiver has only one variable R holds sequence numberof frame it expects to receive.

  • 8/7/2019 ARQ-Error correction-Lec12

    23/40

    23

    Acknowledgment

    Receiver sends positive acknowledgment ifa frame has arrived safe and in order.

    If a frame is damaged or out of order,

    receiver stay silent and will discard allsubsequent frames, until it gets the one itwants.

    This causes sender to go back and

    resends all frames. Now receiver sends one cumulative ACK

    for several frames.

  • 8/7/2019 ARQ-Error correction-Lec12

    24/40

    24

    Resending Frame

    When frame is damaged sender goesback and sends a set if frames startingfrom damaged one up to the last one

    sent. Suppose sender has already send frame 5

    but time for frame 2 expires.Frame 2 not acknowledged. Sendersends 2,3,4,5 again.

    Thats why we call it Go-Back-N ARQ

  • 8/7/2019 ARQ-Error correction-Lec12

    25/40

    25

    Go-Back-N ARQ, normal operation

  • 8/7/2019 ARQ-Error correction-Lec12

    26/40

    26

    Go-Back-N ARQ, lost frame

  • 8/7/2019 ARQ-Error correction-Lec12

    27/40

    27

    Damaged or lost Acknowledgement

    1. If the next acknowledgement occurs beforeexpiration of any timer no need ofretransmission Acknowledgments arecumulative.

    ACK 3 means ACK1, ACK2, ACK3(So if ACK1 & 2 are lost, ACK4 can cover them).

    2. IF next ACK comes after the timeout, the frameand all the frame after that are resent.

    Note: Receiver never resends an ACK.

  • 8/7/2019 ARQ-Error correction-Lec12

    28/40

    28

    In GoIn Go--BackBack--NARQ, the size of theNARQ, the size of the

    sender window must be less thansender window must be less than 22m;m;the size of the receiver window isthe size of the receiver window is

    alwaysalways 11..

    NoteNote::

  • 8/7/2019 ARQ-Error correction-Lec12

    29/40

    29

    SelectiveSelective--Repeat ARQRepeat ARQ

    Sender and Receiver Windows

    Operation

    Sender WindowSize

  • 8/7/2019 ARQ-Error correction-Lec12

    30/40

    30

    Selective Repeat ARQ, sender and receiver windows

  • 8/7/2019 ARQ-Error correction-Lec12

    31/40

    31

    Selective Repeat ARQ S

    ender window size

    Receive window size

  • 8/7/2019 ARQ-Error correction-Lec12

    32/40

    32

    In Selective Repeat ARQ, the size ofIn Selective Repeat ARQ, the size of

    the sender and receiver window mustthe sender and receiver window mustbe at most onebe at most one--half ofhalf of 22mm..

    NoteNote::

  • 8/7/2019 ARQ-Error correction-Lec12

    33/40

    33

    Selective-reject ARQ

    Most efficient error controlprotocol

    If a frame is received in

    error, the receiver askstransmitter to resendONLY the frame that wasin error

    Subsequent framesfollowing the Nth frameare not retransmitted

  • 8/7/2019 ARQ-Error correction-Lec12

    34/40

    34

    Selective Repeat ARQ, lost frame

  • 8/7/2019 ARQ-Error correction-Lec12

    35/40

    35

    Selective Repeat ARQ

  • 8/7/2019 ARQ-Error correction-Lec12

    36/40

    36

    Selective Repeat ARQ, sender window size

  • 8/7/2019 ARQ-Error correction-Lec12

    37/40

    37

    Selective Repeat ARQ: Example

  • 8/7/2019 ARQ-Error correction-Lec12

    38/40

    38

    Bandwidth Delay Product

    Measure of efficiency of an ARQ system

    Bandwidth delay product is measure ofthe number of bits we can send out of our

    system while waiting for news fromreceiver.

    Bandwidth delay product = bandwidth (in

    bits per second) X round trip delay (inseconds)

  • 8/7/2019 ARQ-Error correction-Lec12

    39/40

    39

    ExampleExample 11

    In a Stop-and-Wait ARQ system, the bandwidth of the line is 1 Mbps, and 1 bit

    takes 20 ms to make a round trip. What is the bandwidth-delay product? If the

    system data frames are 1000 bits in length, what is the utilization percentage of

    the link?

    SolutionSolutionThe bandwidth-delay product is

    1v 106 v 20v 10-3 =20,000 bits

    The system can send 20,000 bits during the time it takes for the data to go

    from the sender to the receiver and then back again. However, the system

    sends only 1000 bits. We can say that the link utilization is only 1000/20,000,

    or 5%. For this reason, for a link withhigh bandwidth or long delay, use of

    Stop-and-Wait ARQ wastes the capacity of the link.

  • 8/7/2019 ARQ-Error correction-Lec12

    40/40

    40

    ExampleExample 22

    What is the utilization percentage of the link in Example 1 if the link uses Go-

    Back-N ARQ with a 15-frame sequence?

    SolutionSolution

    The bandwidth-delay product is still 20,000. The system can send up to 15

    frames or 15,000 bits during a round trip. This means the utilization is

    15,

    000/20,000

    , or 75 percent. O

    f course, if th

    ere are damaged frames, th

    eutilization percentage is much less because frames have to be resent.