SlideShare une entreprise Scribd logo
1  sur  46
Module 15
Sliding Windows Protocol, and
        Error Control




                       1
•     Textbook sections
    –    LG Section 5.2 ARQ Protocols
•     Topics
    1. Sliding Window
         •   Overview
         •   Terminology
         •   The sliding of sliding window
         •   Considerations
    2.    Error Control
         • Stop-and-wait ARQ
         • Go-back-N ARQ
         • Selective Repeat ARQ




                                             2
1.0 Sliding Windows - Overview
• Sliding window protocol (SWP):
   – A protocol that allows several data units to be in transition before
      receiving an acknowledgement. SWP is used in TCP for error
      control and flow Control
   – Send window
        • Maintain by the sender
        • A set of sequence number
        • Represents a range of permissible sequence numbers for
          transmitted but not-yet-acknowledged frames
        • As the protocol operates, the window slides forward over the
          sequence number space.
   – Receive window:
        • Maintain by the receiver
        • A set of sequence number
        • Represents a range of frames it is permitted to accept
        • As the protocol operates, the window slides forward over the
          sequence number space.
   – Microsoft Windows NT use 8760 as the default window size
                                                          3
1.0 Sliding Windows - Overview

– Typical scenario
   • TCP sender accepts a data stream from the upper layers,
     breaks large streams of data into smaller segments, sequence
     each segment, and places this stream in a send window
   • TCP sender adds this information in the transport layers
     header, and then hands it down to IP to be formed into packets
   • When TCP transmits each segment to IP, the TCP protocol
     sets a retransmission timer, specifying how long it’ll wait for
     an acknowledgement (an ACK) before the segment is
     retransmitted. A copy of each segment remains inside the send
     window until an acknowledgement is received




                                                      4
1.0 Sliding Windows - Overview

– Typical scenario (continue)
   • The sequence number that TCP adds to each segment are used
     to put the segments back together at the receiver.
   • An acknowledge for each segment is sent back to the sender.
   • When the acknowledge is returned from the receiver and
     received by the sender, the send window slides (hence the
     name sliding windows) pass the acknowledged data to the
     remaining data stream waiting to be sent.
   • If the sender does not receive an acknowledgment with the
     time originally set, the segment will be resent.
   • Retransmitting segments takes up precious bandwidth on the
     network.




                                                   5
1.0 Sliding Windows - Overview
– Highlights
   • Each byte of data is assigned a sequence number
   • The sequence number of the first byte of data in a segment is
     transmitted with that segment and is called the segment
     sequence number
   • Segment also carry an acknowledgement number which is the
     sequence number of the next expected data byte of
     transmission in the reverse direction.
   • When the TCP transmits a segment containing data, it puts a
     copy on a retransmission queue and starts a timer.
       – When the acknowledgement for that data is received, the
         segment is deleted from the queue.
       – If the acknowledgement is not received before the timer runs out,
         the segment is retransmitted.
   • The TCP receiver reports a “window” to the TCP sender. This
     window specifies the number of bytes, starting with the
     acknowledge number, that the TCP receiver is currently
     prepared to receive. (Note: This is the value in the window
     size field from the receiver)
                                                          6
1.0 Sliding Windows - Terminology

                    Send Sequence Space

          1             2                 3                 4
   ------------|------------------|------------------|--------------
            SND.UNA            SND.NXT             SND.UNA + SND.WND

SND.UNA: Send unacknowledged
SND.NXT: Send nest
SND.WND: Send window size

1 – old sequence numbers which have been acknowledged
2 – sequence numbers of unacknowledged data
3 – sequence numbers allowed for new data transmission
4 – future sequence numbers which are not yet allowed

The send window is the portion of the sequence space labeled 3.
                                                                       7
1.0 Sliding Windows - Terminology

                    Receive Sequence Space

          1             2                 3
   ------------|------------------|----------------
            RCV.NXT            RCV.NXT + RCV.WND
RCV.NXT: receive next
RCV.WND: receive window size

1 – old sequence numbers which have been acknowledged
2 – sequence numbers allowed for new reception
3 – future sequence numbers which are not yet allowed

The receive window is the portion of the sequence space labeled 2.


                                                           8
1.0 Sliding Windows - The sliding of sliding window



                     Sliding Window




                                            9
1.0 Sliding Windows - The sliding of sliding window
                      Sender Sliding Window

Note:
• ACK controls the right boundary of the send window
• Sending frames controls the left boundary of the send window




                                                       10
1.0 Sliding Windows - The sliding of sliding window
                       Receiver Sliding Window

Note:
• ACK controls the right boundary of the receive window
• Receiving frames controls the left boundary of the receive window




                                                        11
Sliding Window Example




                         12
1.0 Sliding Windows - Considerations
• Considerations
   – Sliding Window Protocol (SWP) mechanisms
      • Acknowledgement (ACK): A response sent by the receiver to
         indicate the successful receipt and acceptance of data.
      • Negative acknowledgement (NAK): A message sent to
         indicate the rejection of received data.
      • Retransmission timer
      • Sender application programs, receiver application programs,
         sequence number, acknowledgement number, window size.
   – The relationship between sequence number space and maximum
     window size




                                                    13
2. Error Control




                   14
2. Error Control
• Purpose
   – A technique used to ensure that a data stream is delivered accurately to
     the user despite errors that occur during transmission
   – Automatic Repeat Request (ARQ) forms the basis for peer-to-peer
     protocols
   – For both hop-by-hop and end-to-end approaches
   – Information flow can be in one direction or both directions
• Assumptions
   – Frames arrive at the receiver in the same order in which they are sent
• Types
   – Stop-and-wait ARQ
   – Go-back-N ARQ
   – Selective Repeat ARQ


                                                        15
2. Error Control
• For each type of ARQ, four scenarios are considered:
   – Normal scenario
   – Abnormal scenarios:
      • Damaged frame
      • Lost frame
      • Lost ACK




                                              16
2. Error Control

             LG Figure 5.8 Basic elements of ARQ

                                 Information                    Error-free
 Packet
                                    frames                        packet
sequence
                                                                 sequence
            Transmitter                        Receiver

            Station A           Control        Station B
                                frames




CRC                                              CRC             Header
                       Header                         Control frame
      Information
         packet
   Information Frame                                       17
2. Error Control – Stop-and-Wait ARQ
    • Stop-and-Wait ARQ
       – Sender uses: ACK, retransmission timer, and sequence number
       – Scenario 1 (normal and Frame 1 lost)

Steps Events
1     Station A transmit frame 0 and then waits for an ACK frame from the receiver
2     Frame 0 is transmitted without error, so station B transmits an ACK frames.
3     The ACK from station B is also received without error, so station A knows the
      frame 0 has been received correctly.
4     Station A now proceeds to transmit frame 1 and then resets the timer.
5     Frame 1 undergoes errors in transmission. It is possible that station B receives
      frame 1 and detects the errors through the CRC check; it is also possible that frame
      1 was so badly garbled that station is unaware of the transmission. In either case
      station B does not take any action
6     The time-out period expires, and frame 1 is retransmitted

                                                                   18
2. Error Control – Stop-and-Wait ARQ


       LG Figure 5.9 Possible ambiguities when frames are unnumbered

(a) Frame 1 lost                Time-out
                                                                       time
       A       frame          frame           frame          frame
                  0              1               1              2
                        ACK                           ACK
       B

(b) ACK lost                    Time-out
                                                                       time
       A        frame         frame           frame          frame
                   0             1               1              2
                        ACK           ACK             ACK
       B

    In parts (a) and (b) transmitting station A acts the same way, but part
       (b) receiving station B accepts frame 1 twice.
                                                            19
2. Error Control – Stop-and-Wait ARQ

– Scenario 2 (ambiguity due to ACK not received)
   • Figure 5.9 (b)
   • Problem: Loss of an ACK can result in the delivery of duplicated
     packet to station B
   • Solution: Include a sequence number in the header of each
     frame
– Scenario 3 (ambiguity due to premature time-out and loss
  of frame)
   • Figure 5.10
   • Problem: Premature time-outs combined with loss of I-frame can
     result in gaps in the delivered packet sequence
   • Solution: Provide a sequence number in the acknowledgement
     frame that enables the transmitter to determine which frames have
     been received.

                                                    20
2. Error Control – Stop-and-Wait ARQ


      Figure 5.10 Possible ambiguities when ACKs are unnumbered


        time-out
                                                             time
A       frame
           0         frame      frame   frame
                        0          1       2
           ACK
                          ACK
B

    Transmitting station A misinterprets duplicate ACKs




                                                     21
Figure 5.11 System state information in Stop-and-wait ARQ
0   1 0    1 0         1 0      1                           0      1 0    1 0      1 0    1


            Slast                                                          Rnext
                                    Timer

                                                                Slast
              Transmitter                                                  Receiver

                    Station A               Rnext                          Station B



                                    (0,0)           Error-free frame 0                   (0,1)
                                                    arrives at receiver
    Global State:
                                                                                              ACK for
    (Slast, Rnext)                     ACK for                                                frame 0
                                       frame 1                                                arrives at
                                       arrives at                                             transmitter
                                       transmitter      Error-free frame 1
                                                        arrives at receiver
                                    (1,0)                                                (1,1)

                                                                                   22
2. Error Control – Stop-and-Wait ARQ

• Delay-bandwidth product
   – The product of the bit rate and the delay that elapses before an action
     can take place
   – A key performance parameter
   – In stop-and-wait the delay-bandwidth product can be viewed as a
     measure of lost opportunity in terms of transmitted bits.




                                                           23
2. Error Control – Stop-and-Wait ARQ

              Stop and Wait




  EOT: End of Transmission
                                   24
2. Error Control – Stop-and-Wait ARQ

           Damaged Frame
           sequence space consists of 0 and 1



                                  0



                                 1


                                      0

                                                     Error in Frame 0
                                          0
0




                                                25
1.0 Sliding Windows

    Lost Frame



                          0

                      0



                          0
                                   0




                              26
1.0 Sliding Windows


    Lost ACK




                  0



                      0        second




                          27
2. Error Control – Go-Back-N(GBN) ARQ

• Go-Back-N(GBN) ARQ
  – Pipeline
     • A procedure where the processing of a new task is begun before
        the completion of the previous task
     • In the context of ARQ, the sender will have to buffer packets that
        have been transmitted, but not yet acknowledged. Buffering of
        received packets may also be needed at the receiver.
  – Description:
     • In a GBN protocol, the sender is allowed to transmit multiple
        packets (when available) without waiting for an
        acknowledgement, but is constrained to have no more than some
        maximum allowable number, N, of unacknowledged packets in
        the pipeline.




                                                        28
2. Error Control – Go-Back-N(GBN) ARQ

• Examples
  – Example 1
     • Figure 5.13 Basic Go-Back-N ARQ
     • Typical case when N = WS = 4
  – Example 2
     • Figure 5.15 Go-Back-N ARQ
     • Use timer
  – Example 3
     • Figure 5.16 The window size should be less than 2 m
     • The receiver can determine the correct frame if the window
       size is smaller than 2m where m is the number of bits in the
       header which are allotted to the sequence number
       representation


                                                     29
2. Error Control – Go-Back-N(GBN) ARQ

– Example 4
   • Figure 5.17 NAK error recovery
   • The NAK procedure results in having the transmitter go back less
     than WS frames
– Example 5
   • Figure 5.18 System parameter in bidirectional Go-Back-N ARQ
   • Piggybacking: The inclusion of acknowledgement on a data frame.
      When a data frame arrives, instead of immediately sending a
     separate control frame, the receiver restrains itself and wait until
     the network layer passes it the next packet. The acknowledgement
     is attached to the outgoing data frame (using the ACK field in the
     frame header). In effect, the acknowledgement gets a free ride on
     the next outgoing data gram.




                                                      30
2. Error Control – Go-Back-N(GBN) ARQ

          LG Figure 5.13 Basic Go-Back-N ARQ


    Go-Back-4:                  4 frames are outstanding; so go back 4

     fr   fr   fr   fr   fr   fr    fr     fr    fr   fr      fr       fr       fr       fr           time
     0    1    2    3    4    5     6      3     4    5       6        7        8        9
A



B
                A    A    A        Out-of-sequence frames A        A        A        A        A   A
                C    C    C                               C        C        C        C        C   C
                K    K    K                               K        K        K        K        K   K
                1    2    3   error                       4        5        6        7        8   9




                                                                                         31
2. Error Control – Go-Back-N(GBN) ARQ

                       LG Figure 5.15 Go-Back-N ARQ
                    Transmitter                             Receiver


                   Send Window
                           ...                                  Receive Window

  Frames
transmitted S
             last        Srecent     Slast+Ws-1
and ACKed
                                                           frames
                     Buffers                                           Rnext
                                                          received
          Timer       Slast
           Timer     Slast+1                         The receiver will only accept
                       ...                           a frame that is error-free and
                                                     that has sequence number Rnext
           Timer
                     Srecent

                        ...

                    Slast+Ws-1
                                                                 32
LG Figure 5.16 The window size should be less then 2 m
           M =22 = 4, Go-Back - 4:        Transmitter goes back 4

      fr      fr       fr       fr         fr        fr         fr         fr              time
      0       1        2        3          0         1          2          3


  A



                            A        A
  B                A
                   C        C        C
                                           A
                                           C              Receiver has Rnext=0, but it does not
                            K        K
                   K
                            2        3
                                           K              know whether its ACK for frame 0
                   1                       4
                                                          was received, so it does not know
                                                          whether this is the old frame 0 or a
                                                          new frame 0
M=22=4, Go-Back-3:              Transmitter goes back 3

      fr      fr       fr       fr         fr        fr                                    time
      0       1        2        0          1         2


  A



                            A        A
  B                A
                   C        C        C
                   K        K        K            Receiver has Rnext=3 , so it rejects the old
                   1        2        3            frame 0
                                                                                33
2. Error Control – Go-Back-N(GBN) ARQ
                 LG Figure 5.17 NAK error recovery

                                                Transmitter goes back to frame 1

    Go-Back-7:

     fr   fr   fr   fr      fr    fr       fr       fr   fr   fr       fr       fr       fr       fr        time
     0    1    2    3       4     5        1        2    3    4        5        6        7        0
A




B
                A            N         Out-of-sequence   A         A        A        A        A        A
                C            A             frames        C         C        C        C        C        C
                K            K                           K         K        K        K        K        K
                1            1                           2         3        4        5        6        7


                    error



                                                                                                       34
LG Figure 5.18 System parameters in bidirectional Go-Back-N ARQ
           Station A                                                              Station B
                                                          SArecent RA next
           Transmitter                                                            Receiver

               Receiver                                                          Transmitter
                                       SBrecent RB next
                                                                             ACKs are piggybacked in headers

           “A” Receive Window                                                     “B” Receive Window



                    RA next                                                                RB next
          “A” Send Window                                                           “B” Send Window
                   ...                                                                        ...

                SA last         SA last+WA s-1                                            SB last          SB last+WB s-1
                    Buffers                                                                   Buffers
        Timer         SA last                                                     Timer         SB last
        Timer       SA last+1                                                     Timer       SBlast+1
                       ...                                                                      ...
         Timer       SArecent                                                      Timer
                                                                                               SBrecent
                      ...                                                                        ...
       Timer      SA last+WA s-1                                                 Timer      35 +W
                                                                                            S  B
                                                                                                    last
                                                                                                           B
                                                                                                               -1
                                                                                                               s
2. Error Control – Go-Back-N(GBN) ARQ
    Damaged Data Frame




                                36
2. Error Control – Go-Back-N(GBN) ARQ

Lost Data Frame




                         37
2. Error Control – Go-Back-N(GBN) ARQ


           Lost ACK




                                38
2. Error Control – Selective Repeat ARQ

• Selective Repeat ARQ
   – Two new features
      • The receiver windows is made larger than one frame so that the
        receiver can accept frames that are out of order but error free
      • The retransmission mechanism is modified so that only individual
        frames are retransmitted
   – Algorithm




                                                       39
2. Error Control – Selective Repeat ARQ

                              Transmitter’s events and actions

Event                Action
Data received from   When data is received from above, the transmitter checks the next available
upper layer          sequence number for the packet. If the sequence number is within the
                     transmitter’s send window, the data is packetized and sent. Otherwise it is either
                     buffered or returned to the upper layer for later transmission.
Ack received         If an ACK is received, the transmitter marks that packet as having been received.
                     If the packet’s sequence number is equal to Slast,the send window is moved to the
                     unacknowledged packet with the smallest sequence number. If the window moves
                     and there are un-transmitted packets with sequence numbers that now fall within
                     the send window, these packets are transmitted.

Timeout or NAK       • When the transmitter receives a NAK frame, it retransmits the specific frame.
received             • When a packet’s logical timer timed-out, it will be retransmitted




                                                                            40
2. Error Control – Selective Repeat ARQ

                                   Receiver’s Events and Actions

Event                   Action
Packet with             • ACK packet is returned to the transmitter
sequence number in      • If the packet was not previously received, it is buffered
receive window is
                        • If this packet has a sequence number equal to Rnext, then this packet and any
correctly received
                        previously buffered and consecutively numbered packets are delivered to the
                        upper layer.
                        • The receive window is then moved forward by the number of packets delivered
                        to the upper layer.
                        • If an out-of –sequence frame is observed at the receiver, A NAK can be sent
                        with sequence number Rnex

Packet with             An ACK must be generated, even though this is a packet that the receiver has
sequence number         previously acknowledged.
between Rnex –1 and
Rnex –WR is correctly
received

Otherwise               Ignore the packet
                                                                             41
2. Error Control – Selective Repeat ARQ

• Selective Repeat ARQ
       • Retransmission mechanism
            – Timer: When the timer expires, only the corresponding frame
              is retransmitted.
            – NAK: Whenever an out-of-sequence frame is observed at the
              receiver, a NAK frame is sent with sequence number Rnext.
              When the transmission receives such a NAK frame, it
              retransmits the specific frame, Rnext.
          – Figure 5.21 Error recovery in Selective Repeat ARQ
    – Maximum send window size
       • WS = WR = 2m-1 = (2m)/2 = half the sequence number space
        • Example: Figure 5.22 Maximum window size in Selective Repeat
          ARQ



                                                        42
LG Figure 5.20 Selective Repeat ARQ
                    Transmitter                                      Receiver
                                                                          Receive Window
                Send Window
                        ...

  Frames
transmitted S                                              Frames
             last           Srecent          Slast+Ws-1
and ACKed                                                 received    Rnext       Rnext +Wr-1

                              Buffers                                   Buffers

                    Timer         Slast                                         Rnext+1
                    Timer       Slast+1                                        Rnext+2
                                      ...
                                                                                 ...
                    Timer
                                Srecent
                                                                              Rnext+Wr-1
                                       ...

                              Slast+Ws-1
                                                                         43
2. Error Control – Selective Repeat ARQ

         LG Figure 5.21 Error recovery in Selective Repeat ARQ

    fr   fr   fr    fr   fr   fr       fr   fr   fr   fr       fr       fr   fr       fr           time
    0    1    2     3    4    5        6    2    7    8        9        10   11       12
A




B
               A     A             N    A   A    A         A        A    A        A        A   A
               C     C             A    C   C    C         C        C    C        C        C   C
               K     K             K    K   K    K         K        K    K        K        K   K
               1     2             2    2   2    2         7        8    9        1        1   1
                         error                                                    0        1   2




                                                                                      44
1.0 Sliding Windows

    Selective Reject




                       45
LG Figure 5.22 Maximum window size in Selective Repeat ARQ
M=22=4, Selective Repeat: Send Window = Receive Window = 3

                                                        Frame 0 resent
          fr            fr            fr           fr                                   time
          0             1             2            0


      A



                             A             A        A
      B                      C             C        C
                             K             K        K

                                                          Receive Window {3,0,1}
                             1             2        3



Send Window = Receive Window = 2

                                                            Frame 0 resent
                   fr            fr                fr                                          time
                   0             1                 0


               A



                                               A
               B                  A
                                  C            C          frame 0 rejected
                                  K
                                  1
                                               K
                                               2                                   46
                                                            Receive Window {2,3}

Contenu connexe

Tendances

HDLC(High level Data Link Control)
HDLC(High level Data Link Control)HDLC(High level Data Link Control)
HDLC(High level Data Link Control)sonangrai
 
VTU 6TH SEM CSE COMPUTER NETWORKS 2 SOLVED PAPERS OF JUNE-2013 JUNE-14 & JUNE...
VTU 6TH SEM CSE COMPUTER NETWORKS 2 SOLVED PAPERS OF JUNE-2013 JUNE-14 & JUNE...VTU 6TH SEM CSE COMPUTER NETWORKS 2 SOLVED PAPERS OF JUNE-2013 JUNE-14 & JUNE...
VTU 6TH SEM CSE COMPUTER NETWORKS 2 SOLVED PAPERS OF JUNE-2013 JUNE-14 & JUNE...vtunotesbysree
 
Teletraffic engineering handbook
Teletraffic engineering handbookTeletraffic engineering handbook
Teletraffic engineering handbookDeepak Singh
 
Flow & Error Control
Flow & Error ControlFlow & Error Control
Flow & Error Controltameemyousaf
 
Frequency Hopping Spread Spectrum (FHSS) System
Frequency Hopping Spread Spectrum (FHSS) System Frequency Hopping Spread Spectrum (FHSS) System
Frequency Hopping Spread Spectrum (FHSS) System Ahmed Alfadhel
 
Characterization of the Wireless Channel
Characterization of the Wireless ChannelCharacterization of the Wireless Channel
Characterization of the Wireless ChannelSuraj Katwal
 
Packet radio protocol
Packet radio protocolPacket radio protocol
Packet radio protocolPriya Kaushal
 
Basic simulation lab manual1
Basic simulation lab manual1Basic simulation lab manual1
Basic simulation lab manual1Janardhana Raju M
 
Data Communication & Computer network: Channel capacity
Data Communication & Computer network: Channel capacityData Communication & Computer network: Channel capacity
Data Communication & Computer network: Channel capacityDr Rajiv Srivastava
 

Tendances (20)

HDLC(High level Data Link Control)
HDLC(High level Data Link Control)HDLC(High level Data Link Control)
HDLC(High level Data Link Control)
 
Error control
Error controlError control
Error control
 
Flow control main
Flow control mainFlow control main
Flow control main
 
Media Access Control
Media Access ControlMedia Access Control
Media Access Control
 
convex hull
convex hullconvex hull
convex hull
 
VTU 6TH SEM CSE COMPUTER NETWORKS 2 SOLVED PAPERS OF JUNE-2013 JUNE-14 & JUNE...
VTU 6TH SEM CSE COMPUTER NETWORKS 2 SOLVED PAPERS OF JUNE-2013 JUNE-14 & JUNE...VTU 6TH SEM CSE COMPUTER NETWORKS 2 SOLVED PAPERS OF JUNE-2013 JUNE-14 & JUNE...
VTU 6TH SEM CSE COMPUTER NETWORKS 2 SOLVED PAPERS OF JUNE-2013 JUNE-14 & JUNE...
 
Teletraffic engineering handbook
Teletraffic engineering handbookTeletraffic engineering handbook
Teletraffic engineering handbook
 
Flow & Error Control
Flow & Error ControlFlow & Error Control
Flow & Error Control
 
Frequency Hopping Spread Spectrum (FHSS) System
Frequency Hopping Spread Spectrum (FHSS) System Frequency Hopping Spread Spectrum (FHSS) System
Frequency Hopping Spread Spectrum (FHSS) System
 
15 predicate
15 predicate15 predicate
15 predicate
 
Characterization of the Wireless Channel
Characterization of the Wireless ChannelCharacterization of the Wireless Channel
Characterization of the Wireless Channel
 
Baustein 07 grundlagen-html-css-php
Baustein 07 grundlagen-html-css-phpBaustein 07 grundlagen-html-css-php
Baustein 07 grundlagen-html-css-php
 
Floating point Numbers
Floating point NumbersFloating point Numbers
Floating point Numbers
 
Data Link Layer| Error Detection
Data Link Layer| Error DetectionData Link Layer| Error Detection
Data Link Layer| Error Detection
 
Network layer tanenbaum
Network layer tanenbaumNetwork layer tanenbaum
Network layer tanenbaum
 
go back n protocol
go back n protocolgo back n protocol
go back n protocol
 
Packet radio protocol
Packet radio protocolPacket radio protocol
Packet radio protocol
 
GO BACK N PROTOCOL
GO BACK N PROTOCOLGO BACK N PROTOCOL
GO BACK N PROTOCOL
 
Basic simulation lab manual1
Basic simulation lab manual1Basic simulation lab manual1
Basic simulation lab manual1
 
Data Communication & Computer network: Channel capacity
Data Communication & Computer network: Channel capacityData Communication & Computer network: Channel capacity
Data Communication & Computer network: Channel capacity
 

Similaire à Module15: Sliding Windows Protocol and Error Control

session -7 - Sliding Window Protocol 1- N oisy Channels.ppt
session -7 - Sliding Window Protocol 1- N oisy Channels.pptsession -7 - Sliding Window Protocol 1- N oisy Channels.ppt
session -7 - Sliding Window Protocol 1- N oisy Channels.pptnanisrikar276711
 
Datalink control(framing,protocols)
Datalink control(framing,protocols)Datalink control(framing,protocols)
Datalink control(framing,protocols)Hira Awan
 
New framing-protocols
New framing-protocolsNew framing-protocols
New framing-protocolsNitesh Singh
 
Computer network slides for easy prepration
Computer network slides for easy preprationComputer network slides for easy prepration
Computer network slides for easy preprationmqasimsheikh5
 
Flow control & error control
Flow control & error controlFlow control & error control
Flow control & error controlManishTadhiyal
 
Data Link Control.ppt
Data Link Control.pptData Link Control.ppt
Data Link Control.pptTeshome48
 
Data link layer elementry protocols
Data link layer elementry protocolsData link layer elementry protocols
Data link layer elementry protocolssabitha sairam
 
Sliding window protocol(ARQ technique)
Sliding window protocol(ARQ technique)Sliding window protocol(ARQ technique)
Sliding window protocol(ARQ technique)shilpa patel
 
Different protocols for data communication networks
Different protocols for data communication networks Different protocols for data communication networks
Different protocols for data communication networks Nt Arvind
 
8th lec flow and error control
8th lec   flow and error control8th lec   flow and error control
8th lec flow and error controlInocentshuja Ahmad
 
Data Link Control Protocols
Data Link Control ProtocolsData Link Control Protocols
Data Link Control ProtocolsTechiNerd
 
Unit IV_Flow.pptx
Unit IV_Flow.pptxUnit IV_Flow.pptx
Unit IV_Flow.pptxTejasRao8
 
09 Data Link LayerFlow Control.ppt
09 Data Link LayerFlow Control.ppt09 Data Link LayerFlow Control.ppt
09 Data Link LayerFlow Control.pptShaliniKumariGupta1
 
tcpflowcontrolanurag-150513130509-lva1-app6892 (1).pptx
tcpflowcontrolanurag-150513130509-lva1-app6892 (1).pptxtcpflowcontrolanurag-150513130509-lva1-app6892 (1).pptx
tcpflowcontrolanurag-150513130509-lva1-app6892 (1).pptxGOKULKANNANMMECLECTC
 
14 data link control
14 data link control14 data link control
14 data link controlarvindsarja
 

Similaire à Module15: Sliding Windows Protocol and Error Control (20)

session -7 - Sliding Window Protocol 1- N oisy Channels.ppt
session -7 - Sliding Window Protocol 1- N oisy Channels.pptsession -7 - Sliding Window Protocol 1- N oisy Channels.ppt
session -7 - Sliding Window Protocol 1- N oisy Channels.ppt
 
Datalink control(framing,protocols)
Datalink control(framing,protocols)Datalink control(framing,protocols)
Datalink control(framing,protocols)
 
New framing-protocols
New framing-protocolsNew framing-protocols
New framing-protocols
 
Computer network slides for easy prepration
Computer network slides for easy preprationComputer network slides for easy prepration
Computer network slides for easy prepration
 
Sliding window protocol
Sliding window protocolSliding window protocol
Sliding window protocol
 
Flow control & error control
Flow control & error controlFlow control & error control
Flow control & error control
 
Data Link Control.ppt
Data Link Control.pptData Link Control.ppt
Data Link Control.ppt
 
Data link layer elementry protocols
Data link layer elementry protocolsData link layer elementry protocols
Data link layer elementry protocols
 
Sliding window protocol(ARQ technique)
Sliding window protocol(ARQ technique)Sliding window protocol(ARQ technique)
Sliding window protocol(ARQ technique)
 
Different protocols for data communication networks
Different protocols for data communication networks Different protocols for data communication networks
Different protocols for data communication networks
 
8th lec flow and error control
8th lec   flow and error control8th lec   flow and error control
8th lec flow and error control
 
document.pdf
document.pdfdocument.pdf
document.pdf
 
07 data linkcontrol
07 data linkcontrol07 data linkcontrol
07 data linkcontrol
 
Data Link Control Protocols
Data Link Control ProtocolsData Link Control Protocols
Data Link Control Protocols
 
Unit IV_Flow.pptx
Unit IV_Flow.pptxUnit IV_Flow.pptx
Unit IV_Flow.pptx
 
09 Data Link LayerFlow Control.ppt
09 Data Link LayerFlow Control.ppt09 Data Link LayerFlow Control.ppt
09 Data Link LayerFlow Control.ppt
 
PROTOCOL ICT.pptx
PROTOCOL ICT.pptxPROTOCOL ICT.pptx
PROTOCOL ICT.pptx
 
tcpflowcontrolanurag-150513130509-lva1-app6892 (1).pptx
tcpflowcontrolanurag-150513130509-lva1-app6892 (1).pptxtcpflowcontrolanurag-150513130509-lva1-app6892 (1).pptx
tcpflowcontrolanurag-150513130509-lva1-app6892 (1).pptx
 
14 data link control
14 data link control14 data link control
14 data link control
 
Flowctrl
FlowctrlFlowctrl
Flowctrl
 

Module15: Sliding Windows Protocol and Error Control

  • 1. Module 15 Sliding Windows Protocol, and Error Control 1
  • 2. Textbook sections – LG Section 5.2 ARQ Protocols • Topics 1. Sliding Window • Overview • Terminology • The sliding of sliding window • Considerations 2. Error Control • Stop-and-wait ARQ • Go-back-N ARQ • Selective Repeat ARQ 2
  • 3. 1.0 Sliding Windows - Overview • Sliding window protocol (SWP): – A protocol that allows several data units to be in transition before receiving an acknowledgement. SWP is used in TCP for error control and flow Control – Send window • Maintain by the sender • A set of sequence number • Represents a range of permissible sequence numbers for transmitted but not-yet-acknowledged frames • As the protocol operates, the window slides forward over the sequence number space. – Receive window: • Maintain by the receiver • A set of sequence number • Represents a range of frames it is permitted to accept • As the protocol operates, the window slides forward over the sequence number space. – Microsoft Windows NT use 8760 as the default window size 3
  • 4. 1.0 Sliding Windows - Overview – Typical scenario • TCP sender accepts a data stream from the upper layers, breaks large streams of data into smaller segments, sequence each segment, and places this stream in a send window • TCP sender adds this information in the transport layers header, and then hands it down to IP to be formed into packets • When TCP transmits each segment to IP, the TCP protocol sets a retransmission timer, specifying how long it’ll wait for an acknowledgement (an ACK) before the segment is retransmitted. A copy of each segment remains inside the send window until an acknowledgement is received 4
  • 5. 1.0 Sliding Windows - Overview – Typical scenario (continue) • The sequence number that TCP adds to each segment are used to put the segments back together at the receiver. • An acknowledge for each segment is sent back to the sender. • When the acknowledge is returned from the receiver and received by the sender, the send window slides (hence the name sliding windows) pass the acknowledged data to the remaining data stream waiting to be sent. • If the sender does not receive an acknowledgment with the time originally set, the segment will be resent. • Retransmitting segments takes up precious bandwidth on the network. 5
  • 6. 1.0 Sliding Windows - Overview – Highlights • Each byte of data is assigned a sequence number • The sequence number of the first byte of data in a segment is transmitted with that segment and is called the segment sequence number • Segment also carry an acknowledgement number which is the sequence number of the next expected data byte of transmission in the reverse direction. • When the TCP transmits a segment containing data, it puts a copy on a retransmission queue and starts a timer. – When the acknowledgement for that data is received, the segment is deleted from the queue. – If the acknowledgement is not received before the timer runs out, the segment is retransmitted. • The TCP receiver reports a “window” to the TCP sender. This window specifies the number of bytes, starting with the acknowledge number, that the TCP receiver is currently prepared to receive. (Note: This is the value in the window size field from the receiver) 6
  • 7. 1.0 Sliding Windows - Terminology Send Sequence Space 1 2 3 4 ------------|------------------|------------------|-------------- SND.UNA SND.NXT SND.UNA + SND.WND SND.UNA: Send unacknowledged SND.NXT: Send nest SND.WND: Send window size 1 – old sequence numbers which have been acknowledged 2 – sequence numbers of unacknowledged data 3 – sequence numbers allowed for new data transmission 4 – future sequence numbers which are not yet allowed The send window is the portion of the sequence space labeled 3. 7
  • 8. 1.0 Sliding Windows - Terminology Receive Sequence Space 1 2 3 ------------|------------------|---------------- RCV.NXT RCV.NXT + RCV.WND RCV.NXT: receive next RCV.WND: receive window size 1 – old sequence numbers which have been acknowledged 2 – sequence numbers allowed for new reception 3 – future sequence numbers which are not yet allowed The receive window is the portion of the sequence space labeled 2. 8
  • 9. 1.0 Sliding Windows - The sliding of sliding window Sliding Window 9
  • 10. 1.0 Sliding Windows - The sliding of sliding window Sender Sliding Window Note: • ACK controls the right boundary of the send window • Sending frames controls the left boundary of the send window 10
  • 11. 1.0 Sliding Windows - The sliding of sliding window Receiver Sliding Window Note: • ACK controls the right boundary of the receive window • Receiving frames controls the left boundary of the receive window 11
  • 13. 1.0 Sliding Windows - Considerations • Considerations – Sliding Window Protocol (SWP) mechanisms • Acknowledgement (ACK): A response sent by the receiver to indicate the successful receipt and acceptance of data. • Negative acknowledgement (NAK): A message sent to indicate the rejection of received data. • Retransmission timer • Sender application programs, receiver application programs, sequence number, acknowledgement number, window size. – The relationship between sequence number space and maximum window size 13
  • 15. 2. Error Control • Purpose – A technique used to ensure that a data stream is delivered accurately to the user despite errors that occur during transmission – Automatic Repeat Request (ARQ) forms the basis for peer-to-peer protocols – For both hop-by-hop and end-to-end approaches – Information flow can be in one direction or both directions • Assumptions – Frames arrive at the receiver in the same order in which they are sent • Types – Stop-and-wait ARQ – Go-back-N ARQ – Selective Repeat ARQ 15
  • 16. 2. Error Control • For each type of ARQ, four scenarios are considered: – Normal scenario – Abnormal scenarios: • Damaged frame • Lost frame • Lost ACK 16
  • 17. 2. Error Control LG Figure 5.8 Basic elements of ARQ Information Error-free Packet frames packet sequence sequence Transmitter Receiver Station A Control Station B frames CRC CRC Header Header Control frame Information packet Information Frame 17
  • 18. 2. Error Control – Stop-and-Wait ARQ • Stop-and-Wait ARQ – Sender uses: ACK, retransmission timer, and sequence number – Scenario 1 (normal and Frame 1 lost) Steps Events 1 Station A transmit frame 0 and then waits for an ACK frame from the receiver 2 Frame 0 is transmitted without error, so station B transmits an ACK frames. 3 The ACK from station B is also received without error, so station A knows the frame 0 has been received correctly. 4 Station A now proceeds to transmit frame 1 and then resets the timer. 5 Frame 1 undergoes errors in transmission. It is possible that station B receives frame 1 and detects the errors through the CRC check; it is also possible that frame 1 was so badly garbled that station is unaware of the transmission. In either case station B does not take any action 6 The time-out period expires, and frame 1 is retransmitted 18
  • 19. 2. Error Control – Stop-and-Wait ARQ LG Figure 5.9 Possible ambiguities when frames are unnumbered (a) Frame 1 lost Time-out time A frame frame frame frame 0 1 1 2 ACK ACK B (b) ACK lost Time-out time A frame frame frame frame 0 1 1 2 ACK ACK ACK B In parts (a) and (b) transmitting station A acts the same way, but part (b) receiving station B accepts frame 1 twice. 19
  • 20. 2. Error Control – Stop-and-Wait ARQ – Scenario 2 (ambiguity due to ACK not received) • Figure 5.9 (b) • Problem: Loss of an ACK can result in the delivery of duplicated packet to station B • Solution: Include a sequence number in the header of each frame – Scenario 3 (ambiguity due to premature time-out and loss of frame) • Figure 5.10 • Problem: Premature time-outs combined with loss of I-frame can result in gaps in the delivered packet sequence • Solution: Provide a sequence number in the acknowledgement frame that enables the transmitter to determine which frames have been received. 20
  • 21. 2. Error Control – Stop-and-Wait ARQ Figure 5.10 Possible ambiguities when ACKs are unnumbered time-out time A frame 0 frame frame frame 0 1 2 ACK ACK B Transmitting station A misinterprets duplicate ACKs 21
  • 22. Figure 5.11 System state information in Stop-and-wait ARQ 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 Slast Rnext Timer Slast Transmitter Receiver Station A Rnext Station B (0,0) Error-free frame 0 (0,1) arrives at receiver Global State: ACK for (Slast, Rnext) ACK for frame 0 frame 1 arrives at arrives at transmitter transmitter Error-free frame 1 arrives at receiver (1,0) (1,1) 22
  • 23. 2. Error Control – Stop-and-Wait ARQ • Delay-bandwidth product – The product of the bit rate and the delay that elapses before an action can take place – A key performance parameter – In stop-and-wait the delay-bandwidth product can be viewed as a measure of lost opportunity in terms of transmitted bits. 23
  • 24. 2. Error Control – Stop-and-Wait ARQ Stop and Wait EOT: End of Transmission 24
  • 25. 2. Error Control – Stop-and-Wait ARQ Damaged Frame sequence space consists of 0 and 1 0 1 0 Error in Frame 0 0 0 25
  • 26. 1.0 Sliding Windows Lost Frame 0 0 0 0 26
  • 27. 1.0 Sliding Windows Lost ACK 0 0 second 27
  • 28. 2. Error Control – Go-Back-N(GBN) ARQ • Go-Back-N(GBN) ARQ – Pipeline • A procedure where the processing of a new task is begun before the completion of the previous task • In the context of ARQ, the sender will have to buffer packets that have been transmitted, but not yet acknowledged. Buffering of received packets may also be needed at the receiver. – Description: • In a GBN protocol, the sender is allowed to transmit multiple packets (when available) without waiting for an acknowledgement, but is constrained to have no more than some maximum allowable number, N, of unacknowledged packets in the pipeline. 28
  • 29. 2. Error Control – Go-Back-N(GBN) ARQ • Examples – Example 1 • Figure 5.13 Basic Go-Back-N ARQ • Typical case when N = WS = 4 – Example 2 • Figure 5.15 Go-Back-N ARQ • Use timer – Example 3 • Figure 5.16 The window size should be less than 2 m • The receiver can determine the correct frame if the window size is smaller than 2m where m is the number of bits in the header which are allotted to the sequence number representation 29
  • 30. 2. Error Control – Go-Back-N(GBN) ARQ – Example 4 • Figure 5.17 NAK error recovery • The NAK procedure results in having the transmitter go back less than WS frames – Example 5 • Figure 5.18 System parameter in bidirectional Go-Back-N ARQ • Piggybacking: The inclusion of acknowledgement on a data frame. When a data frame arrives, instead of immediately sending a separate control frame, the receiver restrains itself and wait until the network layer passes it the next packet. The acknowledgement is attached to the outgoing data frame (using the ACK field in the frame header). In effect, the acknowledgement gets a free ride on the next outgoing data gram. 30
  • 31. 2. Error Control – Go-Back-N(GBN) ARQ LG Figure 5.13 Basic Go-Back-N ARQ Go-Back-4: 4 frames are outstanding; so go back 4 fr fr fr fr fr fr fr fr fr fr fr fr fr fr time 0 1 2 3 4 5 6 3 4 5 6 7 8 9 A B A A A Out-of-sequence frames A A A A A A C C C C C C C C C K K K K K K K K K 1 2 3 error 4 5 6 7 8 9 31
  • 32. 2. Error Control – Go-Back-N(GBN) ARQ LG Figure 5.15 Go-Back-N ARQ Transmitter Receiver Send Window ... Receive Window Frames transmitted S last Srecent Slast+Ws-1 and ACKed frames Buffers Rnext received Timer Slast Timer Slast+1 The receiver will only accept ... a frame that is error-free and that has sequence number Rnext Timer Srecent ... Slast+Ws-1 32
  • 33. LG Figure 5.16 The window size should be less then 2 m M =22 = 4, Go-Back - 4: Transmitter goes back 4 fr fr fr fr fr fr fr fr time 0 1 2 3 0 1 2 3 A A A B A C C C A C Receiver has Rnext=0, but it does not K K K 2 3 K know whether its ACK for frame 0 1 4 was received, so it does not know whether this is the old frame 0 or a new frame 0 M=22=4, Go-Back-3: Transmitter goes back 3 fr fr fr fr fr fr time 0 1 2 0 1 2 A A A B A C C C K K K Receiver has Rnext=3 , so it rejects the old 1 2 3 frame 0 33
  • 34. 2. Error Control – Go-Back-N(GBN) ARQ LG Figure 5.17 NAK error recovery Transmitter goes back to frame 1 Go-Back-7: fr fr fr fr fr fr fr fr fr fr fr fr fr fr time 0 1 2 3 4 5 1 2 3 4 5 6 7 0 A B A N Out-of-sequence A A A A A A C A frames C C C C C C K K K K K K K K 1 1 2 3 4 5 6 7 error 34
  • 35. LG Figure 5.18 System parameters in bidirectional Go-Back-N ARQ Station A Station B SArecent RA next Transmitter Receiver Receiver Transmitter SBrecent RB next ACKs are piggybacked in headers “A” Receive Window “B” Receive Window RA next RB next “A” Send Window “B” Send Window ... ... SA last SA last+WA s-1 SB last SB last+WB s-1 Buffers Buffers Timer SA last Timer SB last Timer SA last+1 Timer SBlast+1 ... ... Timer SArecent Timer SBrecent ... ... Timer SA last+WA s-1 Timer 35 +W S B last B -1 s
  • 36. 2. Error Control – Go-Back-N(GBN) ARQ Damaged Data Frame 36
  • 37. 2. Error Control – Go-Back-N(GBN) ARQ Lost Data Frame 37
  • 38. 2. Error Control – Go-Back-N(GBN) ARQ Lost ACK 38
  • 39. 2. Error Control – Selective Repeat ARQ • Selective Repeat ARQ – Two new features • The receiver windows is made larger than one frame so that the receiver can accept frames that are out of order but error free • The retransmission mechanism is modified so that only individual frames are retransmitted – Algorithm 39
  • 40. 2. Error Control – Selective Repeat ARQ Transmitter’s events and actions Event Action Data received from When data is received from above, the transmitter checks the next available upper layer sequence number for the packet. If the sequence number is within the transmitter’s send window, the data is packetized and sent. Otherwise it is either buffered or returned to the upper layer for later transmission. Ack received If an ACK is received, the transmitter marks that packet as having been received. If the packet’s sequence number is equal to Slast,the send window is moved to the unacknowledged packet with the smallest sequence number. If the window moves and there are un-transmitted packets with sequence numbers that now fall within the send window, these packets are transmitted. Timeout or NAK • When the transmitter receives a NAK frame, it retransmits the specific frame. received • When a packet’s logical timer timed-out, it will be retransmitted 40
  • 41. 2. Error Control – Selective Repeat ARQ Receiver’s Events and Actions Event Action Packet with • ACK packet is returned to the transmitter sequence number in • If the packet was not previously received, it is buffered receive window is • If this packet has a sequence number equal to Rnext, then this packet and any correctly received previously buffered and consecutively numbered packets are delivered to the upper layer. • The receive window is then moved forward by the number of packets delivered to the upper layer. • If an out-of –sequence frame is observed at the receiver, A NAK can be sent with sequence number Rnex Packet with An ACK must be generated, even though this is a packet that the receiver has sequence number previously acknowledged. between Rnex –1 and Rnex –WR is correctly received Otherwise Ignore the packet 41
  • 42. 2. Error Control – Selective Repeat ARQ • Selective Repeat ARQ • Retransmission mechanism – Timer: When the timer expires, only the corresponding frame is retransmitted. – NAK: Whenever an out-of-sequence frame is observed at the receiver, a NAK frame is sent with sequence number Rnext. When the transmission receives such a NAK frame, it retransmits the specific frame, Rnext. – Figure 5.21 Error recovery in Selective Repeat ARQ – Maximum send window size • WS = WR = 2m-1 = (2m)/2 = half the sequence number space • Example: Figure 5.22 Maximum window size in Selective Repeat ARQ 42
  • 43. LG Figure 5.20 Selective Repeat ARQ Transmitter Receiver Receive Window Send Window ... Frames transmitted S Frames last Srecent Slast+Ws-1 and ACKed received Rnext Rnext +Wr-1 Buffers Buffers Timer Slast Rnext+1 Timer Slast+1 Rnext+2 ... ... Timer Srecent Rnext+Wr-1 ... Slast+Ws-1 43
  • 44. 2. Error Control – Selective Repeat ARQ LG Figure 5.21 Error recovery in Selective Repeat ARQ fr fr fr fr fr fr fr fr fr fr fr fr fr fr time 0 1 2 3 4 5 6 2 7 8 9 10 11 12 A B A A N A A A A A A A A A C C A C C C C C C C C C K K K K K K K K K K K K 1 2 2 2 2 2 7 8 9 1 1 1 error 0 1 2 44
  • 45. 1.0 Sliding Windows Selective Reject 45
  • 46. LG Figure 5.22 Maximum window size in Selective Repeat ARQ M=22=4, Selective Repeat: Send Window = Receive Window = 3 Frame 0 resent fr fr fr fr time 0 1 2 0 A A A A B C C C K K K Receive Window {3,0,1} 1 2 3 Send Window = Receive Window = 2 Frame 0 resent fr fr fr time 0 1 0 A A B A C C frame 0 rejected K 1 K 2 46 Receive Window {2,3}