Your SlideShare is downloading. ×
0
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Jaimin   chp-3 - data-link layer- 2011 batch
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Jaimin chp-3 - data-link layer- 2011 batch

1,990

Published on

GTU-MCA-SEM IV - Fundamentals of Networking

GTU-MCA-SEM IV - Fundamentals of Networking

Published in: Education
1 Comment
3 Likes
Statistics
Notes
No Downloads
Views
Total Views
1,990
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
0
Comments
1
Likes
3
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Chapter 3 The Data Link Layer
  • 2. Data Link Layer Design Issues
    • Services Provided to the Network Layer
    • Framing
    • Error Control
    • Flow Control
  • 3. 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
  • 4. Services Provided to Network Layer (2)
    • Placement of the data link protocol.
  • 5. Types of services provided to the Network Layer
    • Unacknowledged Connectionless service
    • Acknowledged Connectionless service
    • Acknowledged Connection-Oriented service
  • 6. (1) Unacknowledged Connectionless service
    • Losses are taken care of at higher layers
    • Used on reliable medium like coax cables or optical fiber, where the error rate is low.
    • Appropriate for voice, where delay is worse than bad data.
  • 7. (2) Acknowledged Connectionless service
    • Useful on unreliable medium like wireless.
    • Acknowledgements add delays.
    • Adding Ack in the DLL rather than in the Network Layer is just an optimization and not a requirement. Leaving it for the Network Layer is inefficient as a large message (packet) has to be resent in that case in contrast to small frames here.
    • On reliable channels, like fiber, the overhead associated with the ack is not justified.
  • 8. (3) Acknowledged Connection-oriented service
    • Most reliable,
    • Guaranteed service –
      • Each frame sent is indeed received
      • Each frame is received exactly once
      • Frames are received in order
    • Special care has to be taken to ensure this in connectionless services
  • 9. Data Link Layer Design Issues
    •  Services Provided to the Network Layer
      • The network layer wants to be able to send packets to its neighbors without worrying about the details of getting it there in one piece.
    •  Framing
      • Group the physical layer bit stream into units called frames . Frames are nothing more than "packets" or "messages". By convention, we use the term "frames" when discussing DLL.
    •  Error Control
      • Sender checksums the frame and transmits checksum together with data. Receiver re-computes the checksum and compares it with the received value.
    •  Flow Control
      • Prevent a fast sender from overwhelming a slower receiver .
  • 10. Services Provided to Network Layer (1)
    • Network layer and DLL should work independent
    Virtual communication. Actual communication.
  • 11. Services Provided to Network Layer (2)
    • Delivery Mechanisms
      • Un-acknowledge connectionless
        • Receiver does not return acknowledgments to the sender,
        •  Sender has no way of knowing if a frame has been successfully delivered.
        • Applications:
          • 1. When errors are so infrequent that there is little to be gained by the data link layer performing the recovery (Higher layers can recover from errors with little loss in performance).
          • Example: LAN
          • 2. For real-time applications requiring "better never than late". Old data may be worse than no data.
          • Example: Sound stream
  • 12. Services Provided to Network Layer (3)
    • Delivery Mechanisms
      •  Acknowledge connectionless
        • Receiver returns an acknowledgment frame to the sender indicating that a data frame was properly received.
        • Each frame is assigned a unique sequence number , which the receiver returns in an acknowledgment frame to indicate which frame the ACK refers to.
          • Sender must retransmit unacknowledged (e.g., lost or damaged) frames.
  • 13. Services Provided to Network Layer (4)
    • Delivery Mechanisms
      •  Acknowledge connection-oriented : Reliable Delivery
        • Frames are delivered to the receiver reliably and in the same order as generated by the sender.
        • Connection state keeps track of sending order and which frames require retransmission. For example, receiver state includes which frames have been received, which ones have not, etc.
  • 14. Different methods of Framing
    • DLL translates the physical layer's raw bit stream into discrete units (messages) called frames .
    • How can frame be transmitted so the receiver can detect frame boundaries? That is, how can the receiver recognize the start and end of a frame?
        •  Character Count
        •  Flag byte with Byte Stuffing
        •  Starting and ending flag with bite stuffing
        •  Encoding Violations
  • 15. Framing - Character Count
    •  Character Count
      • First field in the frame's header = the length of the frame.
      • Disadvantage:
        • Receiver loses synchronization when bits become garbled. If the bits in the count become corrupted during transmission, the receiver will think that the frame contains fewer (or more) bits than it actually does.
     Without errors  With one error
  • 16. Framing - Character Count
    • A character stream. (a) Without errors. (b) With one error.
  • 17. Problem with Framing with CC
    • What if the count is garbled
    • Even if with checksum, the receiver knows that the frame is bad there is no way to tell where the next frame starts.
    • Asking for retransmission doesn’t help either because the start of the retransmitted frame is not known
    • No longer used
  • 18. Coding: Character Count
  • 19.  
  • 20. Framing - Byte Stuffing
  • 21. Framing - Byte Stuffing
    • (a) A frame delimited by flag bytes.
    • (b) Four examples of byte sequences before and after stuffing.
  • 22. Framing - Byte Stuffing - Continue
    •  Flag byte with Byte Stuffing
      • Use reserved bit patterns (Flag byte) to indicate the start and end of a frame.
      • Problem: What happens if the reserved delimiter happens to appear in the frame itself?
      • Solution: Use byte stuffing (Character stuffing): insert a special escape byte (ESC) just before accidental flag byte in data.  Another problem: if an ESC byte occurs in data
      •  Solution: ESC stuff with another ESC byte
      • Major problem: Dependent on 8-bite character
      • What about Unicode Scheme which uses 16 & 32 bits
  • 23. Framing with byte stuffing
    • Problem :
      • fixed character size : assumes character size to be 8 bits
      • can’t handle heterogeneous(system with different architecture) environment.
  • 24. Coding: Byte Stuffing
  • 25.  
  • 26.  
  • 27. Framing - Bit Stuffing
  • 28. Framing - Bit Stuffing
    • Bit stuffing
    • (a) The original data.
    • (b) The data as they appear on the line.
    • (c) The data as they are stored in receiver’s memory after destuffing.
  • 29. Coding: Bit Stuffing
  • 30.  
  • 31.  
  • 32. Framing - Encoding Violations
  • 33. Framing
    • Encoding Violations
      • Send a signal that doesn't conform to any legal bit representation.
        • Ex. In Manchester encoding, for instance, 1-bits are represented by a high-low sequence, and 0-bits by low-high sequences. The start/end of a frame could be represented by the signal low-low or high-high.
      • The advantage of encoding violations is that no extra bandwidth is required as in bit or character stuffing. The IEEE 802.4 standard uses this approach.
    • Some systems use a combination of these techniques. IEEE 802.3, for instance, has both a length field and special frame start and frame end patterns.
  • 34. Error Control
    • Must insure that all frames are eventually delivered (possibly in order) to a destination.
    • Three components are required to do this:
      •  Acknowledgments:  
        • Receiver returns a special acknowledgment ( ACK ) frame to the sender indicating the correct receipt of a frame.
        • In some systems, the receiver also returns a negative acknowledgment (NACK) for incorrectly-received frames.
      •  Timers:
        •   What happens if an ACK or NACK becomes lost?
        • Retransmission timers are used to resend frames that don't produce an ACK.
      • Sequence Numbers:
        • Retransmissions introduce the possibility of duplicate frames.
        • To suppress duplicates, add sequence numbers to each frame, so that a receiver can distinguish between new frames and repeats of old frames.
  • 35. Error detection and error correction
    • In data communication, line noise is a fact of life (e.g., signal attenuation)
    • There are two types of attacks against errors:
      •  Error Detecting Codes: Include enough redundancy bits to detect errors and use ACKs and retransmissions to recover from the errors.
      •  Error Correcting Codes: Include enough redundancy to detect and correct errors.
    • Detecting and correcting errors requires redundancy (sending additional information along with the data).
    m bits n = ( m + r ) bit codeword r bits redundancy Messages (frames) data
  • 36.
    • Types of error
    • Detection
    • Correction
    Error Detection and Correction
  • 37. 1 Types of Errors
    • Single bit error – only one bit is changed from 1 to 0 or from 0 to 1.
    • Burst error – two or more bits in the data unit have changed.
  • 38. 2 Detection
    • Error detection uses the concepts of redundancy, which means adding extra bits detecting errors at the destination.
  • 39. (normally implemented in link layer) (used primarily by upper layers) 3 common error detection techniques Parity Check Cyclic Redundancy Check (CRC) Checksum (most basic)
  • 40. Parity check: 2 method
    • VRC Vertical Redundancy Check
    • LRC Longitudanal Redundancy Check
    • Redundancy ????
  • 41. Parity : 2 type
    • Odd parity
    • Even parity
  • 42. Parity Check
    • Simplest technique.
    • A redundant bit (parity bit), is appended to every data unit.
    • Even parity - the total number of 1's in the data plus parity bit must be an even number.
  • 43. Data #1's in data P Total # 1's (data and P) 0110110 4 (Even) 0 4 (Even) 0011111 5 (Odd) 1 6 (Even) 0000000 0 (Even) 0 0 (Even) 1010100 3 (Odd) 1 4 (Even) 1111111 7 (Odd) 1 8 (Even) Even Parity Generator
  • 44.  
  • 45. What is VRC and LRC? VRC is Character Parity LRC is Block Parity
  • 46.  
  • 47.
      • Two dimensional parity codes
        • Detect and correct single error
          • Ex. Error in D 22 results changing H 2 and V 2
        • None-single errors in a row or column can’t coorect
    Horizontal parity Vertical parity H 1 D 1m … . D 12 D 11 H 2 D 2m … . D 22 D 21 .. .. … .. H n D nm … . D n2 D n1 V m+1 V m … V 2 V 1
  • 48.
    • Vertical Redundancy Check (VRC)
  • 49. Example 1 Even Parity Suppose the sender wants to send the word world . In ASCII the five characters are coded as 1110111 1101111 1110010 1101100 1100100 The following shows the actual bits sent 1110111 0 1101111 0 1110010 0 1101100 0 1100100 1
  • 50. Example 2 Even Parity Now suppose the word world in Example 1 is received by the receiver without being corrupted in transmission. 11101110 11011110 11100100 11011000 11001001 The receiver counts the 1s in each character and comes up with even numbers (6, 6, 4, 4, 4). The data are accepted.
  • 51. Example 3 Even Parity Now suppose the word world in Example 1 is corrupted during transmission. 11111110 11011110 11101100 11011000 11001001 The receiver counts the 1s in each character and comes up with even and odd numbers (7, 6, 5, 4, 4). The receiver knows that the data are corrupted, discards them, and asks for retransmission.
  • 52. VRC Performance
    • VRC can detect all single-bit errors. It can also detect burst errors as long as the total number of bits changed is odd (1,3,5…etc)
    • How bout if the total number of bit changed is even ??? Yea.. There is problem !!!
    • In short VRC can detect all single-bit errors. It can detect burst errors only if the total number of errors in each data unit is odd.
  • 53. VRC Coding
  • 54. Sender Site: Main File Which define VRC procedure Page - 1
  • 55. Receiver Site: Main File Which define VRC procedure Page - 1
  • 56. L ONGITUDINAL R EDUNDANCY C HECK (LRC) IN longitudinal redundancy check LRC, a block of bits is divided into rows and a redundant row of bits is added to the whole block
  • 57.
    • Original data
    • 11100111 11011101 00111001 10101001
    • 1 1 1 0 0 1 1 1
    • 1 1 0 1 1 1 0 1
    • 0 0 1 1 1 0 0 1
    • 1 0 1 0 1 0 0 1
    • -----------------
    • 1 0 1 0 1 0 1 0  LRC
    • 11100111 11011101 00111001 10101001 10101010
    • The above is the original data plus LRC
  • 58. e.g. problem in LRC
    • Suppose the following block is sent
    • 10101001 00111001 11011101 11100111 10101010
    • (LRC)
    • However, it is hit by a burst noise of length eight and some bits are corrupted.
    • 1010 0 0 1 1 1 0 00 1001 11011101 11100111 10101010
    • (LRC)
    • When the receiver checks the LRC, some of the bits do not follow the even-parity rule and the whole block is discarded (the nonmatching bits are shown in blue)
    • 1010 0 0 1 1 1 0 00 1001 11011101 11100111 1 0 101 0 1 0
    • (LRC)
  • 59. Performance of LRC
    • LRC increases the likelihood of detecting burst errors. As we showed in the previous e.g. an LRC of n bits can easily detect a burst error of n bits.
    • A burst error of more than n bits is also detected by LRC with a very high probability.
    • -note for Jabatan Tanah daerah Temerloh – Mr. Hakim (2004 –co)
  • 60. Coding: LRC
  • 61. Sender Site: Main File Which define LRC procedure Page -1
  • 62. Sender Site: Main File Which define LRC procedure Page -2
  • 63. Receiver Site: Main File Which define LRC procedure Page -1
  • 64. Receiver Site: Main File Which define LRC procedure Page -2
  • 65. Checksum
  • 66. Checksum
    • The error detection used by the higher-layer protocols.
    • Check generator – in the sending node
    • Checksum checker – at receiving node
    Ethernet frame
  • 67. Checksum generator
    • In the sender, the checksum generator subdivides the data unit into equal segments of n bits (usually 16).
    • These segments are added together using one’s complement arithmetic in such a way that the total is also n bits long.
    • The total(sum) is then complemented and appended to the end of the original data unit as redundancy bits, called checksum field.
    • The extended data unit is transmitted across the network.
    • So if the sum of the data segment is T, the checksum will be -T
  • 68. Data unit and checksum
  • 69. Checksum checker
    • The receiver subdivides the data unit as above and adds all segments together and complements the result.
    • If the extended data unit is intact, the total value found by adding the data segments and the checksum field shud be zero.
    • If the result is not zero, the packet contains an error and the receiver rejects it.
  • 70. The sender follows these steps:
    • The unit is divided into k sections, each of n bits
    • All sections are added together using one’s complement to get the sum.
    • The sum is complemented and becomes the checksum.
    • The checksum is sent with the data.
  • 71. The receiver follows these steps
    • The unit is divided into k sections, each of n bits.
    • All sections are added together using one’s complement to get the sum.
    • The sum is complemented.
    • If the result is zero, the data are accepted. Otherwise, they are rejected.
  • 72. Example 6 Suppose the following block of 16 bits is to be sent using a checksum of 8 bits. 10101001 00111001 The numbers are added using one’s complement 10101001 00111001 ------------ Sum 11100010 Checksum 00011101 The pattern sent is 10101001 00111001 00011101
  • 73. Example 7 Now suppose the receiver receives the pattern sent in Example 6 and there is no error. 10101001 00111001 00011101 When the receiver adds the three sections, it will get all 1s, which, after complementing, is all 0s and shows that there is no error. 10101001 00111001 00011101 ------------ Sum 11111111 Complement 00000000 means that the pattern is OK.
  • 74. Example 8 Now suppose there is a burst error of length 5 that affects 4 bits. Original data 10101001 00111001 00011101 Corrupted data 10101 111 11 111001 00011101 When the receiver adds the three sections, it gets 10101111 11111001 00011101 Partial Sum 1 11000101 Carry 1 Sum 11000110 Complement 00111001 the pattern is corrupted.
  • 75.  
  • 76.  
  • 77. Coding: Checksum
  • 78. Sender Site: Main File Which define Checksum procedure Page - 1
  • 79. Receiver Site: Main File Which define Checksum procedure Page - 1
  • 80. Sender Site: Main File Which define Checksum procedure Page - 3
  • 81. Hamming Code
  • 82. Error Correction
    • Hamming Code
    • Focus on a simple case: Single-Bit Error Correction
    • Use the relationship between data and redundancy bits
    • Developed by Richard Hamming
  • 83. Data and redundancy bits To calculate the no. of redundancy bits use : 2 r ≥ m + r + 1 Number of data bits m Number of redundancy bits r Total bits m + r 1 2 3 2 3 5 3 3 6 4 3 7 5 4 9 6 4 10 7 4 11
  • 84. Positions of redundancy bits in Hamming code (11,7) * Check bits occupy positions that are powers of 2 In the Hamming code, each r bit is the VRC bit for one combination of data bits: r 1 is the VRC bit for one combination of data bits, r 2 is the VRC bit for another combination of data bits, and so on. The combinations used to calculate each of the four r values for a seven-bit data sequence are as follows: r 1 : bits 1, 3, 5, 7, 9, 11 r 2 : bits 2, 3, 6, 7, 10, 11 r 4 : bits 4, 5, 6, 7 r 5 : bits 8, 9, 10, 11
  • 85.
    • All bit positions that are powers of 2 are used as parity bits. (positions 1, 2, 4, 8…)
    • All other bit positions are for the data to be encoded. (positions 3, 5, 6, 7, 9, 10, 11…)
    • Each parity bit calculates the parity for some of the bits in the code word. The position of the parity bit determines the sequence of bits that it alternately checks and skips.
    • General rule for position n : skip n −1 bits, check n bits, skip n bits, check n bits...
    • Position 1 (n=1): skip 0 bit (0=n−1), check 1 bit (n), skip 1 bit (n), check 1 bit (n), skip 1 bit (n), etc. (1,3,5,7,9,11...)
    • Position 2 (n=2): skip 1 bit (1=n−1), check 2 bits (n), skip 2 bits (n), check 2 bits (n), skip 2 bits (n), etc. (2,3,6,7,10,11...)
    • Position 4 (n=4): skip 3 bits (3=n−1), check 4 bits (n), skip 4 bits (n), check 4 bits (n), skip 4 bits (n), etc. (4,5,6,7,12...)
    • Position 8 (n=8): skip 7 bits (7=n−1), check 8 bits (n), skip 8 bits (n), check 8 bits (n), skip 8 bits (n), etc. (8-15,24-31,40-47,...)
  • 86. Redundancy bits calculation
  • 87. r 1 will take care of these bits d d d d d d d r 1 r 2 r 4 r 8 0001 0101 1011 0111 0011 1001 11 9 7 5 3 1
  • 88. r 2 will take care of these bits 0010 0011 0110 0111 1010 1011 11 10 7 6 3 2 d d d d d d d r 1 r 2 r 4 r 8
  • 89. r 4 will take care of these bits 0110 0111 0101 0100 7 6 4 5 d d d d d d d r 1 r 2 r 4 r 8
  • 90. r 8 will take care of these bits 1000 1001 1010 1011 11 10 9 8 d d d d d d d r 1 r 2 r 4 r 8
  • 91. Example of redundancy bit calculation
  • 92. Single-Bit Error
  • 93. Error Detection Error detection using Hamming code
  • 94. Example Question The data is 1011011 Add the parity bit. ??????????????? Consider the transmitted data to be 001 0 101 0 1 11 . Show how the error bit position is determined ???????????????
  • 95.
    • answer
    • The data is 1011011
    • Add the parity bit.
    • Consider the transmitted data to be 001 0 101 0 1 11 . Show how the error bit position is determined.
    101 0 101 0 1 11 1011 = 11
  • 96. Error detection and error correction (2)
    • Hamming Distance . Given any two codewords, we can determine how many of the bits differ .
      • XOR the two words, and count the number of 1 bits in the result.
      • 10001110  100011  d=2
    • If two codewords are d bits apart, d errors are required to convert one to the other.
    • A code's Hamming Distance is defined as the minimum Hamming Distance between any two of its legal codewords (from all possible codewords).
    •  
    • In general, all 2 m possible data words are legal. However, by choosing check bits carefully, the resulting codewords will have a large Hamming Distance. The larger the Hamming distance, the better the codes are able to detect errors.
  • 97. Hamming Codes
    • Want to be able to correct error with less overhead than 2D parity
    • Hamming codes correct all single bit errors with only log(M) extra bits and detect double bit errors
    • Uses an interleaved parity scheme
  • 98. Calculating a Hamming Code
    • Procedure:
      • Place message bits in their non-power-of-two Hamming positions
      • Build a table listing the binary representation each each of the message bit positions
      • Calculate the check bits
  • 99. Hamming Code Example Message to be sent: 1 0 1 1 1 0 1 1 1 2 3 4 5 6 7 2 0 2 1 2 2 2 n : check bits Position
  • 100.  
  • 101. Hamming Code Example 1 Starting with the 2 0 position: Look at positions with 1’s in them Count the number of 1’s in the corresponding message bits If even, place a 1 in the 2 0 check bit, i.e., use odd parity Otherwise, place a 0 Calculate check bits: 3 = 2 1 + 2 0 = 0 1 1 5 = 2 2 + 2 0 = 1 0 1 6 = 2 2 + 2 1 + = 1 1 0 7 = 2 2 + 2 1 + 2 0 = 1 1 1 Message to be sent: 1 0 1 1 1 0 1 1 1 2 3 4 5 6 7 2 0 2 1 2 2 2 n : check bits Position
  • 102. Hamming Code Example Repeat with the 2 1 position: Look at positions those positions with 1’s in them Count the number of 1’s in the corresponding message bits If even, place a 1 in the 2 1 check bit Otherwise, place a 0 1 0 Calculate check bits: 3 = 2 1 + 2 0 = 0 1 1 5 = 2 2 + 2 0 = 1 0 1 6 = 2 2 + 2 1 + = 1 1 0 7 = 2 2 + 2 1 + 2 0 = 1 1 1 Message to be sent: 1 0 1 1 1 0 1 1 1 2 3 4 5 6 7 2 0 2 1 2 2 2 n : check bits Position
  • 103. Hamming Code Example 1 0 Repeat with the 2 2 position: Look at positions those positions with 1’s in them Count the number of 1’s in the corresponding message bits If even, place a 1 in the 2 2 check bit Otherwise, place a 0 1 Calculate check bits: 3 = 2 1 + 2 0 = 0 1 1 5 = 2 2 + 2 0 = 1 0 1 6 = 2 2 + 2 1 + = 1 1 0 7 = 2 2 + 2 1 + 2 0 = 1 1 1 Message to be sent: 1 0 1 1 1 0 1 1 1 2 3 4 5 6 7 2 0 2 1 2 2 2 n : check bits Position
  • 104. Hamming Code Example
    • Original message = 1011
    • Sent message = 1011011
    • Now, how do we check for a single-bit error in the sent message using the Hamming code?
  • 105. Using Hamming Codes to Correct Single-Bit Errors Received message: 1 0 1 1 0 0 1 2 n : check bits Calculate check bits: 3 = 2 1 + 2 0 = 0 1 1 5 = 2 2 + 2 0 = 1 0 1 6 = 2 2 + 2 1 = 1 1 0 7 = 2 2 + 2 1 + 2 0 = 1 1 1 1 0 1 1 0 0 1 1 2 3 4 5 6 7 2 0 2 1 2 2 Position
  • 106. Using Hamming Codes to Correct Single-Bit Errors Starting with the 2 0 position: Look at positions with 1’s in them Count the number of 1’s in both the corresponding message bits and the 2 0 check bit and compute the parity. If even parity, there is an error in one of the four bits that were checked. Odd parity: No error in bits 1, 3, 5, 7 Received message: 1 0 1 1 0 0 1 2 n : check bits Calculate check bits: 3 = 2 1 + 2 0 = 0 1 1 5 = 2 2 + 2 0 = 1 0 1 6 = 2 2 + 2 1 = 1 1 0 7 = 2 2 + 2 1 + 2 0 = 1 1 1 1 0 1 1 0 0 1 1 2 3 4 5 6 7 2 0 2 1 2 2 Position
  • 107. Using Hamming Codes to Correct Single-Bit Errors Repeat with the 2 1 position: Look at positions with 1’s in them Count the number of 1’s in both the corresponding message bits and the 2 1 check bit and compute the parity. If even parity, there is an error in one of the four bits that were checked. Even parity: ERROR in bit 2, 3, 6 or 7! Received message: 1 0 1 1 0 0 1 2 n : check bits Calculate check bits: 3 = 2 1 + 2 0 = 0 1 1 5 = 2 2 + 2 0 = 1 0 1 6 = 2 2 + 2 1 = 1 1 0 7 = 2 2 + 2 1 + 2 0 = 1 1 1 1 0 1 1 0 0 1 1 2 3 4 5 6 7 2 0 2 1 2 2 Position
  • 108. Using Hamming Codes to Correct Single-Bit Errors Repeat with the 2 2 position: Look at positions with 1’s in them Count the number of 1’s in both the corresponding message bits and the 2 2 check bit and compute the parity. If even parity, there is an error in one of the four bits that were checked. Even parity: ERROR in bit 4, 5, 6 or 7! Received message: 1 0 1 1 0 0 1 2 n : check bits Calculate check bits: 3 = 2 1 + 2 0 = 0 1 1 5 = 2 2 + 2 0 = 1 0 1 6 = 2 2 + 2 1 = 1 1 0 7 = 2 2 + 2 1 + 2 0 = 1 1 1 1 0 1 1 0 0 1 1 2 3 4 5 6 7 2 0 2 1 2 2 Position
  • 109. Finding the error’s location 1 0 1 1 0 0 1 1 2 3 4 5 6 7 Position
  • 110. Finding the error’s location No error in bits 1, 3, 5, 7 1 0 1 1 0 0 1 1 2 3 4 5 6 7 Position
  • 111. Finding the error’s location ERROR in bit 2, 3, 6 or 7 ERROR in bit 4, 5, 6 or 7 Error must be in bit 6 because bits 3, 5, 7 are correct, and all the remaining information agrees on bit 6 erroneous bit, change to 1 1 0 1 1 0 0 1 1 2 3 4 5 6 7 Position
  • 112. Finding the error’s location An Easier Alternative to the Last Slide 3 = 2 1 + 2 0 = 0 1 1 5 = 2 2 + 2 0 = 1 0 1 6 = 2 2 + 2 1 = 1 1 0 7 = 2 2 + 2 1 + 2 0 = 1 1 1 E E NE 1 1 0 = 6 E = error in column NE = no error in column
  • 113. Hamming Codes
    • Hamming codes can be used to locate and correct a single-bit error
    • If more than one bit is in error, then a Hamming code cannot correct it
    • Hamming codes, like parity bits, are only useful on short messages
  • 114. Hamming Code : In short
    • Error correction (2)
      •  Hamming code (1)
        • Use overlapped parities P in data D as bellow
        • For 4-bits data D 3 , D 5 , D 6 , D 7
        • In sender P s calculate:
          • P 1 = D 3  D 5  D 7
          • P 2 = D 3  D 6  D 7
          • P 4 = D 5  D 6  D 7
        • In Receiver C s calculate:
          • C 1 = P 1  D 3  D 5  D 7
          • C 2 = P 2  D 3  D 6  D 7
          • C 4 = P 4  D 5  D 6  D 7
          • If C 4 C 2 C 1 =000  No error else C 4 C 2 C 1 =Error position
    P 1 P 2 D 3 P 4 D 5 D 6 D 7 P 8 D 9 … .
  • 115. Hamming Code : In short
    • Error correction (3)
      •  Hamming code Example(2)
        • 4-bits data D 7 D 6 D 5 D 3 =1101 using even parity
        • sender :
          • P 1 = D 3  D 5  D 7 =0
          • P 2 = D 3  D 6  D 7 =1
          • P 4 = D 5  D 6  D 7 =0
        • Receiver: if received 11 1 0110
          • C 1 = P 1  D 3  D 5  D 7 = 1
          • C 2 = P 2  D 3  D 6  D 7 = 0
          • C 4 = P 4  D 5  D 6  D 7 = 1
          • C 4 C 2 C 1 =101=5  11 0 0110
     send: 110 0 1 10 Error
  • 116. Hamming Code : In short
    • Error correction (4)
      •  Hamming code(3)
        • Question? How many parity bits ( r ) is needed for D -bits data?
        • Ex. D=11  P=4
        • Which bits check bits in data in position k?
        • k=sum of powers of two
        • 7=1+2+4 5=4+1
    g=2 r 2 r -1>=D+r P 1 P 2 D 3 P 4 D 5 … … P g
  • 117. Hamming Code : Correct burst errors
    • Error correction (5)
      •  Hamming code example(4)
        • Correct burst errors
          • Send one column at a time
  • 118. Coding: Hamming Code
  • 119. Sender Site: Main File Which define Hamming Code procedure Page - 1
  • 120. Sender Site: Main File Which define Hamming Code procedure Page - 2
  • 121. Receiver Site: Main File Which define Hamming Code procedure Page - 1
  • 122. Receiver Site: Main File Which define Hamming Code procedure Page - 2
  • 123. Receiver Site: Main File Which define Hamming Code procedure Page - 3
  • 124. CRC
  • 125. Error detection and error correction (3)
    • Error detection (1)
      •  Parity Bits
        • A single parity bit is appended to each data block (e.g. each character in ASCII systems) so that the number of 1 bits always adds up to an even (odd) number.
        • Ex. 1000000 ( 1 ) 1111101 ( 0 )
        • Can detect any Odd number of errors  Probability of detection=0.5 (Not acceptable!)
        • The Hamming Distance for parity is 2, it can detect single-bit errors.
        • To detect d -bit errors requires having a Hamming Distance of at least d+1 bits.
    Parity bit Messages (frames) data
  • 126. Error detection and error correction (4)
    • Error detection (2)
      • CRC (Cyclic Redundancy Check) or Polynomial code
        • K-bits frame is regarded as the coefficient list for a k-term polynomial
        • Ex. 11000  x 5 +x 4 +x 0 = x 5 +x 4 +1
        • Sender and receiver agree upon a r -bits generator polynomial G(x), both high and low bits are 1.
        • For a m -bits frame the corresponding poly. =M(x)
        • Compute Checksum as bellow:
    CRC bits Messages (frames) data
  • 127. CRC
    • The most powerful of the redundancy checking technique.
    • Based on binary division.
    • The redundancy bits used by CRC are derived by dividing the data unit by a predetermined divisor; the remainder is the CRC.
    • A CRC must:
      • have exactly one less bit than the divisor
      • appending it to the end of the data string must make the resulting bit sequence exactly divisible by the divisor.
  • 128. CRC generator and checker
    • Get the raw frame.
    • Left shift the raw frame by n bits and divide it by divisor.
    • The remainder is the CRC bit.
    • Append the CRC bit to the frame and transmit.
    • Receive the frame.
    • Divide it by divisor.
    • Check the reminder.
  • 129. Division in CRC encoder
  • 130. Division in the CRC decoder for two cases
  • 131. CRC
    • CRC generator – at the sending node.
    • CRC checker – at the receiving node.
    • Polynomial:
      • The CRC generator (the divisor) is most often represented as an algebraic polynomial.
      • e.g.
  • 132. A polynomial representing a divisor
  • 133. Standard polynomials Name Polynomial Application CRC-8 x 8 + x 2 + x + 1 ATM header CRC-10 x 10 + x 9 + x 5 + x 4 + x 2 + 1 ATM AAL ITU-16 x 16 + x 12 + x 5 + 1 HDLC ITU-32 x 32 + x 26 + x 23 + x 22 + x 16 + x 12 + x 11 + x 10 + x 8 + x 7 + x 5 + x 4 + x 2 + x + 1 LANs
  • 134. Error detection and error correction (5)
    • Error detection (3)
      • CRC algorithm:
      • 1. Append r zero bits to low-order end of the frame,
      • Frame= m+r bits  x r . G(x) poly.
      • 2. Divide the x r . G(x) bit string in to G(x),
      • using modulo 2
      • 3. Subtract the reminder form x r . G(x)  result=T(x)
      • Sender: send T(x)
      • Receiver: Divide T(x) in to G(x)
      •  if reminder==0, No error
  • 135. Error detection and error correction (6)
    • Error detection (4)
      • CRC example
        • Frame= 1101011011
        • Generator= 10011
        • Transmitted data =
        • 1101011011 1110
  • 136. Error detection and error correction (7)
    • Error detection (4)
      • CRC benefits:
        • Detection of any single error: If G(x) contain two or more terms
        • Detection of any double error: If G(x) dose not divide the poly. [x k +1] for all [k< frame length]
        • Detection of any odd number error: If G(x) has the poly. [x+1] as a factor
        • Detection of all burst errors of length<= r
      • Standard CRC
        • G(x)= x 32 +x 26 +x 23 +x 22 +x 16 +x 12 +x 11 +x 10 +x 8 +x 7 +x 5 +x 4 +x 2 +x 1 + 1
      • CRC implementation
        • Shift register circuit
  • 137. CRC Polynomial Codes
    • Can detect errors on large chunks of data
    • Has low overhead
    • More robust than parity bit
    • Requires the use of a “code polynomial”
      • Example: x 2 + 1
  • 138. Cyclic Redundancy Check
    • Procedure:
      • 1. Let r be the degree of the code polynomial. Append r zero bits to the end of the transmitted bit string. Call the entire bit string S(x)
      • 2. Divide S(x) by the code polynomial using modulo 2 division.
      • 3. Subtract the remainder from S(x) using modulo 2 subtraction.
    • The result is the checksummed message
  • 139. Generating a CRC Example Message : 1011 1 x x 3 + 0 x x 2 + 1 x x + 1 = x 3 + x + 1 Code Polynomial : x 2 + 1 (101) Step 1 : Compute S(x) r = 2 S(x) = 101100
  • 140. Generating a CRC Example (cont’d) Step 2 : Modulo 2 divide Remainder 101100 101 101 001 000 010 000 100 101 01 1001
  • 141. Generating a CRC Example (cont’d) Step 3 : Modulo 2 subtract the remainder from S(x) 101100 - 01 101101 Checksummed Message
  • 142. Decoding a CRC
    • Procedure
      • 1. Let n be the length of the checksummed message in bits
      • 2. Divide the checksummed message by the code polynomial using modulo 2 division. If the remainer is zero, there is no error detected.
  • 143. Decoding a CRC Example 101101 Checksummed message ( n = 6) 1011 Original message (if there are no errors) Remainder = 0 (No error detected) 101101 101 101 001 000 010 000 101 101 00 1001
  • 144. Decoding a CRC Another Example
    • When a bit error occurs, there is a large probability that it will produce a polynomial that is not an even multiple of the code polynomial, and thus errors can usually be detected.
    Remainder = 1 (Error detected) 101001 101 101 000 000 000 000 001 000 01 1000
  • 145. Choosing a CRC polynomial
    • The longer the polynomial, the smaller the probability of undetected error
    • Common standard polynomials:
      • (1) CRC-12: x 12 + x 11 + x 3 + x 2 + x 1 + 1
      • (2) CRC-16: x 16 + x 15 + x 2 + 1
      • (3) CRC-CCITT: x 16 + x 12 + x 5 + 1
  • 146. Coding : CRC
  • 147. Sender Site: Main File Which define CRC procedure Page - 1
  • 148. Sender Site: Main File Which define CRC procedure Page - 2
  • 149. Receiver Site: Main File Which define CRC procedure Page - 1
  • 150.  
  • 151.  
  • 152. Flow control
    • The speed of the sender too match that of the receiver. This is a dynamic process, as the receiving speed depends on such changing factors as the load, and availability of buffer space.
    •  
    • Solutions:
      •  Feedback-based flow control
        • Receiver send information back to sender (given permission to give more or telling its condition)
      •  Rate-based flow control
        • Use a built-in mechanism to limit the rate
  • 153.  
  • 154. NOISELESS CHANNELS Let us first assume we have an ideal channel in which no frames are lost, duplicated, or corrupted. We introduce two protocols for this type of channel. Protocol 1: Simplest Protocol Protocol 2: Stop-and-Wait Protocol Topics discussed in this section:
  • 155. Protocol 1 : Design , Implementation and Coding of Simplest Protocol
  • 156. Protocol 1 : The design of the simplest protocol with no flow or error control
  • 157. Figure Flow diagram for Example
  • 158. 11. Algorithm 1 Sender-site algorithm for the simplest protocol
  • 159. 11. Algorithm 1 Receiver-site algorithm for the simplest protocol
  • 160. Data Link Layer protocols (1)
    • Definitions
      • #define MAX PKT 1024 /* determines packet size in bytes */
      • typedef enum {false, true} boolean; /* boolean type */
      • typedef unsigned int seq_nr; /* sequence or ack numbers */
      • typedef struct {
      • unsigned char data[MAX PKT];
      • } packet; /* packet definition */
      • typedef enum {data, ack, nak} frame_kind; /* frame kind definition */
      • typedef struct { /* frames are transported in this layer */
      • frame_kind kind; /* what kind of a frame is it? */
      • seq_nr seq; /* sequence number */
      • seq_nr ack; /* acknowledgement number */
      • packet info; /* the network layer packet */
      • } frame;
  • 161. Coding : Protocol1(Utopia)
    • An Unrestricted Simplex Protocol
      • /* Protocol 1 ( utopia ) provides for data transmission in one direction only , error free channel , and the receiver is assumed to be able to process all the input infinitely fast. */
      • void sender1 (void){
      • frame s; /* buffer for an outbound frame */
      • packet buffer; /* buffer for an outbound packet */
      • while (true) {
      • from_network_layer(&buffer); /* go get something from network layer to send */
      • s.info = buffer; /* copy it into s for transmission */
      • to_physical_layer(&s); /* send it on its way */
      • }
      • }
      • void receiver1 (void){
      • frame r;
      • event_type event; /* filled in by wait, but not used here */
      • while (true) {
      • wait_for_event(&event); /* only possibility is frame arrival */
      • From_physical_layer(&r); /* go get the inbound frame */
      • To_network_layer(&r.info); /* pass the data to the network layer */
      • }
      • }
  • 162. Protocol 2 : Design , Implementation and Coding of Stop-and-Wait Protocol
  • 163. 11. Protocol 2 : Design of Stop-and-Wait Protocol
  • 164. 11. Algorithm 2 Sender-site algorithm for Stop-and-Wait Protocol
  • 165. 11. Algorithm 2 Receiver-site algorithm for Stop-and-Wait Protocol
  • 166. 11. Figure shows an example of communication using this protocol. It is still very simple. The sender sends one frame and waits for feedback from the receiver. When the ACK arrives, the sender sends the next frame. Note that sending two frames in the protocol involves the sender in four events and the receiver in two events. Example
  • 167. 11. Figure Flow diagram for Example
  • 168. Coding : Protocol2(Stop-and-wait)
    • A Simplex Stop-and-Wait Protocol
      • /* Protocol 2 ( stop-and-wait ) , one-directional flow of data from sender to receiver, error free channel, The receiver has only a finite buffer capacity and a finite processing speed, protocol must prevent the sender from flooding */
      • void sender2 (void){
      • frame s;
      • packet buffer;
      • event_type event; /* frame_arrival is the only possibility */
      • while (true) {
      • from_network_layer(&buffer);
      • s.info = buffer;
      • to_physical_layer(&s);
      • wait_for_event(event(&event); /* do not proceed until given the go ahead */
      • }
      • }
      • void receiver2 (void){
      • frame r, s;
      • while (true) {
      • wait_for_event(&event);
      • From_physical_layer(&r);
      • To_network_layer(&r.info);
      • to_physical_layer(s); /* send a dummy frame to awaken sender */
      • }
      • }
    Flow control: Drop the ability of receiving from network layer unrestricted
  • 169. 11. NOISY CHANNELS Although the Stop-and-Wait Protocol gives us an idea of how to add flow control to its predecessor, noiseless channels are nonexistent. We discuss three protocols in this section that use error control. Protocol 3: Stop-and-Wait ARQ (Automatic Repeat Request) Protocol 4: Go-Back-N ARQ (Automatic Repeat Request) Protocol 5: Selective Repeat ARQ (Automatic Repeat Request) Topics discussed in this section:
  • 170. Protocol 3 : Design , Implementation and Coding of Stop-and-Wait ARQ (Automatic Repeat Request)
  • 171. Error correction in Stop-and-Wait ARQ is done by keeping a copy of the sent frame and retransmitting of the frame when the timer expires. Note
  • 172. In Stop-and-Wait ARQ, we use sequence numbers to number the frames. The sequence numbers are based on modulo-2 arithmetic . Note
  • 173. In Stop-and-Wait ARQ, the acknowledgment number always announces in modulo-2 arithmetic the sequence number of the next frame expected. Note
  • 174. Protocol 3 : Design of the Stop-and-Wait ARQ Protocol
  • 175. Algorithm 3 Sender-site algorithm for Stop-and-Wait ARQ (continued)
  • 176. Algorithm 3 Sender-site algorithm for Stop-and-Wait ARQ (continued)
  • 177. Algorithm 3 Receiver-site algorithm for Stop-and-Wait ARQ Protocol
  • 178. 11. Figure shows an example of Stop-and-Wait ARQ . Frame 0 is sent and acknowledged. Frame 1 is lost and resent after the time-out. The resent frame 1 is acknowledged and the timer stops. Frame 0 is sent and acknowledged, but the acknowledgment is lost. The sender has no idea if the frame or the acknowledgment is lost, so after the time-out, it resends frame 0, which is acknowledged. Example
  • 179. 11. Figure Flow diagram for above Example
  • 180. Protocol3( Stop and Wait with ARQ)
    • A Simplex Protocol for a Noisy Channel (1)
    • In Protocol2 if an error occurred, protocol failed (Frame or its ACK)
    • Solutions:
      •  Adding a timer : if frame damaged, sender transmit the frame again after a specific time
      • How long should the timer be?
        • Using 3 factors: 1. transmission time 2. Processing time in receiver 3. Receiving ACK time
      • Scenario of a bug that could happen:
        • A transmits frame one
        • B receives A1
        • B generates ACK
        • ACK is lost
        • A times out, retransmits
        • B gets duplicate copy of A1 (and sends it on to network layer.)
  • 181. Protocol3(ARQ)
    • A Simplex Protocol for a Noisy Channel (2)
    • Solutions:
        • If receiver get the frame correctly but ACK damage: Sender re-transmit the previous frame!
      •  Adding a sequence number to header of frame
      • Min. No. of bits for Seq. No.?
        • The ambiguity is in frame No. m and m+1 and only concerned about two successive frames
        •  1-bite is sufficient (Seq. 0 and 1)
    • ARQ (Automatic Repeat reQuest) or PAR (Positive Ack. With Re-transmission) : Sender waits for positive acknowledgment before advancing to the next data item.
  • 182. Coding: Protocol3(Stop-n-Wait ARQ) Sender Site A Simplex Protocol for a Noisy Channel (3)
      • /* Protocol 3 (PAR) allows unidirectional data flow over an unreliable channel . */
      • #define MAX_SEQ 1 /* must be 1 for protocol 3 */
      • void sender3 (void){
      • seq_nr next_frame_to_send; /* Seq number of next outgoing frame */
      • frame s;
      • packet buffer;
      • event_type event;
      • next_frame_to_send = 0;
      • from_network_layer(&buffer); /* go get something to send */
      • while (true) {
      • s.info = buffer; /* copy it into s for transmission */
      • s.seq = next_frame_to_send ; /* insert sequence number in frame */
      • to_physical_layer(&s); /* send it on its way */
      • start_timer( s.seq); /* if answer takes too long, time out */
      • wait_for_event(event(&event); /* frame arrival or cksum err, or timeout */
      • if ( event == frame_arrival) {
      • from_physical_layers(&s); /* Get the ACK */
      • if ( s.ack == next_frame_to_send ) {
      • from_network_layer( &buffer ); /* get the next one to send */
      • inc( next_frame_to_send ); /* invert next_frame_to_send */
      • }
      • }
      • }
      • }
  • 183. Coding: Protocol3(Stop-n-Wait ARQ) Receiver Site
    • A Simplex Protocol for a Noisy Channel (4)
      • void receiver3 (void){
      • seq_nr frame_expected;
      • frame r, s;
      • event_type event;
      • while (true) {
      • wait_for_event(&event); /* only possibility is frame arrival */
      • if ( frame == event_arrival ) { /* A valid frame has arrived */
      • from_physical_layer(&r); /* go get the inbound frame */
      • if ( r.seq == frame_expected ) { /* This is what we’ve been waiting for */
      • to_network_layer(&r.info); /* pass the data to the network layer */
      • inc(frame_expected); /* next time expect the other seq # */
      • }
      • s.ack = 1 – frame_expected;
      • to_physical_layer(&s); /* send a dummy frame to awaken sender */
      • }
      • }
      • }
  • 184. 11. Stop-and-Wait ARQ is a special case of Go-Back-N ARQ in which the size of the send window is 1. Note
  • 185. Efficiency of 1-bit sliding window protocol
  • 186. Protocols (4) 1 bit Sliding Window - Stop-and-wait
    • Example: Normal case
    Host A Host B ( seq , ack , packet number ) *=Accepted: To network layer
  • 187. Sliding Window Protocols - Stop-and-wait
    • Example: Abnormal case:
      • Host A and B initiate communication simultaneously and Timer of Host B is short
    Always, frames receive in order Host A Host B ( seq , ack , packet number ) *=Accepted: To network layer
  • 188. Sliding Window Protocols - Stop-and-wait
    • Problem with stop and wait protocols, Example: 
      • 50 Kbps bandwidth (satellite channel), 1000 bit frames, 500 msec round-trip propagation delay
    Line utilization = 20/520=3.85% !!  sender is blocked 96.15% of time ! Sender Receiver first packet bit transmitted, t = 0 500 first packet bit arrives: 500/2=250 ACK arrives: 500+20=520 last packet bit transmitted, t = 20 500/2=250 500/2=250 1000 bits/50,000 bps=20 msec
  • 189. Sliding Window Protocols Reason: sender can only have one unACKed frame outstanding. This cause the problem only when R is more larger than L/B first packet bit transmitted, t = 0 R last packet bit transmitted, t = L / B first packet bit arrives last packet bit arrives, send ACK ACK arrives, send next packet, t = R + L / B Sender Receiver U sender = L / B R + L / B = L RB + L
  • 190. Sliding Window Protocols
    • Solution for poor channel utilization: 
      •  Use larger frames, but the maximum size is limited by the bit error rate of the channel. The larger the frame, the higher the probability that it will become damaged during transmission.
      •  Allowing the sender to send more than 1 frame, w frames send before blocking ( Pipelining )
    • In Pipelining:
      • Sender does not wait for each frame to be ACK'ed. Rather it sends many frames with the assumption that they will arrive. Must still get back ACKs for each frame.
      •   Provides more efficient use of transmit bandwidth, but error handling is more complex.
      • Value of w ? times equal to round-trip time, For previous example, W=26 (Because 520/20=26)
  • 191. Sliding Window Protocols
    • In Pipelining:
      • Sender after sending the w th frame, will get the ACK of first frame.
      • If error occurred:
        • What if 26 frames transmitted, and the second has an error. Frames 3-26 will be ignored at receiver side? Sender will have to retransmit. What are the possibilities?
      •   Two strategies as solutions (depends on receive Window size)
        • Go-Back-N
        • Selective-Repeat
  • 192. Protocols 4 : Design, Implementation and Coding of Sliding Window Protocol
  • 193. Protocols 4 :Sliding Window
    • Previous protocols was simplex (one-directional)
    • For full-duplex:
      • Using two separate lines (forward and backward)
      • Better way: Same line but in both directions
    • In bi-directional line using kind filed in frame’s header to show transmission direction
    • Now have two kinds of frames (containing a &quot;kind&quot; field):
      • Data
      • ACK containing (sequence number of last correctly received frame).
    • Piggybacking : add acknowledgment to data frames going in reverse direction.
    • Piggybacking issue: For better use of bandwidth, how long should we wait for outgoing data frame before sending the ACK on its own. (DLL should wait network layer)
  • 194. Sliding Window Protocols
    • Sliding Window Protocols
      • A sending window and receiving window
        • Sending window : maintain a set of seq. no.s corresponding to frames it is permitted to send
        • Receiving window : Set of frames it is permitted to accept
        • Sequence numbers are form 0 to MaxSeq, 2 n - 1 .
      •   Stop-and-wait is a sliding window protocol with n =1
      • All frames delivered in correct order.
      • These methods provide much more realism!
  • 195. Sliding Window Protocols
    • Example: 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.
  • 196. Sliding Window Protocols
    • Sending window contains:
      • 1. Frames which their ACK don’t received yet
      • 2. Frames should send
    • Sender should have a buffer with size n contained all frames send and don’t receive their ACK.
    • Receiving windows has the fix size=No. of frame it can accept, size=1: Always get frames in order
    • Frames should delivered to network layer in order
  • 197. Sliding Window Protocols
    • A One-Bit Sliding Window Protocol (1)
      • /* Protocol 4 (sliding window) is bi-directional and is more robust than protocol 3 */
      • #define MAX-SEQ 1 /* must be 1 for protocol 4 */
      • typedef enum {frame-arrival, cksum-err, timeout} event-type;
      • #include &quot;protocol.h&quot;
      • void protocol4 (void) {
      • seq-nr next-frame-to-send; /* 0 or 1 only */
      • seq-nr frame-expected; /* 0 or 1 only */
      • frame r, s; /* scratch variables */
      • packet buffer; /* current packet being sent */
      • event-type event;
      • next-frame-to-send = 0; /* next frame on the outbound stream */
      • frame-expected = 0; /* number of frame arriving frame expect */
      • from-network-layer(&buffer); /* fetch a packet from the network layer */
      • s.info = buffer; /* prepare to send the initial frame */
      • s.seq = next-frame-to-send; /* insert sequence number into frame */
      • s.ack = 1 -frame-expected; /* piggybacked ack */
      • to-physical-layer(&s); /* transmit the frame */
      • start-timer(s.seq); /* start the timer running */
  • 198. Sliding Window Protocols
    • A One-Bit Sliding Window Protocol (Continue…)
      • while (true) {
      • wait-for-event(&event); /* frame-arrival, cksum-err, or timeout */
      • if (event == frame-arrival) { /* a frame has arrived undamaged. */
      • from-physical-layer(&r); /* go get it */
      • if (r.seq == frame-expected) {
      • /* Handle inbound frame stream. */
      • to-network-layer(&r.info); /* pass packet to network layer */
      • inc(frame-expected); /* invert sequence number expected next */
      • }
      • if (r.ack == next-frame-to-send) { /* handle outbound frame stream. */
      • from-network-layer(&buffer); /* fetch new pkt from network layer */
      • inc(next-frame-to-send); /* invert sender's sequence numbe
      • }
      • } // if
      • s.info = buffer; /* construct outbound frame */
      • s.seq = next-frame-to-send; /* insert sequence number into it */
      • s.ack = 1 -frame-expected; /* seq number of last received frame */
      • to-physical-layer(&s); /* transmit a frame */
      • start-timer(s.seq); /* start the timer running */
      • } // while
      • }
  • 199. Sliding Window Protocols (13)- Go-Back-N
    • Go-Back-N:
      • Equivalent to receiver's window size = 1 .
      • If receiver sees bad frames or missing sequence numbers, subsequent frames are discarded. No ACKs for discarded frames.
  • 200. In the Go-Back-N Protocol, the sequence numbers are modulo 2 m , where m is the size of the sequence number field in bits. Note
  • 201. Figure Send window for Go-Back-N ARQ
  • 202. The send window is an abstract concept defining an imaginary box of size 2 m − 1 with three variables: Sf, Sn, and S size . Note
  • 203. The send window can slide one or more slots when a valid acknowledgment arrives. Note
  • 204. Figure Receive window for Go-Back-N ARQ
  • 205. The receive window is an abstract concept defining an imaginary box of size 1 with one single variable R n . The window slides when a correct frame has arrived; sliding occurs one slot at a time. Note
  • 206. 11. Figure Design of Go-Back-N ARQ
  • 207. 11. Figure Window size for Go-Back-N ARQ
  • 208. In Go-Back-N ARQ, the size of the send window must be less than 2 m ; the size of the receiver window is always 1. Note
  • 209. Algorithm 4 Go-Back-N sender algorithm (continued)
  • 210. Algorithm 4 Go-Back-N sender algorithm (continued)
  • 211. Algorithm 4 Go-Back-N receiver algorithm
  • 212. Example Figure shows an example of Go-Back-N. This is an example of a case where the forward channel is reliable, but the reverse is not. No data frames are lost, but some ACKs are delayed and one is lost. The example also shows how cumulative acknowledgments can help if acknowledgments are delayed or lost. After initialization, there are seven sender events. Request events are triggered by data from the network layer; arrival events are triggered by acknowledgments from the physical layer. There is no time-out event here because all outstanding frames are acknowledged before the timer expires. Note that although ACK 2 is lost, ACK 3 serves as both ACK 2 and ACK 3.
  • 213. Figure Flow diagram for Example
  • 214. Figure shows what happens when a frame is lost. Frames 0, 1, 2, and 3 are sent. However, frame 1 is lost. The receiver receives frames 2 and 3, but they are discarded because they are received out of order. The sender receives no acknowledgment about frames 1, 2, or 3. Its timer finally expires. The sender sends all outstanding frames (1, 2, and 3) because it does not know what is wrong. Note that the resending of frames 1, 2, and 3 is the response to one single event. When the sender is responding to this event, it cannot accept the triggering of other events. This means that when ACK 2 arrives, the sender is still busy with sending frame 3. Example
  • 215. The physical layer must wait until this event is completed and the data link layer goes back to its sleeping state. We have shown a vertical line to indicate the delay. It is the same story with ACK 3; but when ACK 3 arrives, the sender is busy responding to ACK 2. It happens again when ACK 4 arrives. Note that before the second timer expires, all outstanding frames have been sent and the timer is stopped. Example (continued)
  • 216. Figure Flow diagram for Example
  • 217. Stop-and-Wait ARQ is a special case of Go-Back-N ARQ in which the size of the send window is 1. Note
  • 218.
    • Summary of Go Back 'n':
    • If a frame is lost or received in error, the receiver may simply discard all subsequent frames
    • sending no acknowledgments for the discarded frames.
    • In this case the receive window is of size 1.
    • Since no acknowledgements are being received the sender's window will fill up, the sender will eventually time out and retransmit all the unacknowledged frames in order starting from the damaged or lost frame.
    • The maximum window size for this protocol can be obtained as follows.
      • Assume that the window size of the sender is n.
      • So the window will initially contain the frames with sequence numbers from 0 to (w-1).
      • Consider that the sender transmits all these frames and the receiver's data link layer receives all of them correctly.
      • However, the sender's data link layer does not receive any acknowledgements as all of them are lost.
      • So the sender will retransmit all the frames after its timer goes off.
      • However the receiver window has already advanced to w.
      • Hence to avoid overlap , the sum of the two windows should be less than the sequence number space.
    • w-1 + 1 < Sequence Number Space
    • i.e., w < Sequence Number Space
    • Maximum Window Size = Sequence Number Space - 1
  • 219. Protocols 4 : Design, Implementation and Coding of Selective Repeat
  • 220. In Selective Repeat ARQ, the size of the sender and receiver window must be at most one-half of 2 m . Note
  • 221. Algorithm Sender-site Selective Repeat algorithm (continued)
  • 222. Algorithm Sender-site Selective Repeat algorithm (continued) (continued)
  • 223. Algorithm Sender-site Selective Repeat algorithm (continued)
  • 224. 11. Algorithm 11.10 Receiver-site Selective Repeat algorithm
  • 225. 11. Algorithm 11.10 Receiver-site Selective Repeat algorithm
  • 226. 11. Figure 11.22 Delivery of data in Selective Repeat ARQ
  • 227. 11. This example is similar to Example 11.3 in which frame 1 is lost. We show how Selective Repeat behaves in this case. Figure 11.23 shows the situation. One main difference is the number of timers. Here, each frame sent or resent needs a timer, which means that the timers need to be numbered (0, 1, 2, and 3). The timer for frame 0 starts at the first request, but stops when the ACK for this frame arrives. The timer for frame 1 starts at the second request, restarts when a NAK arrives, and finally stops when the last ACK arrives. The other two timers start when the corresponding frames are sent and stop at the last arrival event. Example 11.8
  • 228. 11. At the receiver site we need to distinguish between the acceptance of a frame and its delivery to the network layer. At the second arrival, frame 2 arrives and is stored and marked, but it cannot be delivered because frame 1 is missing. At the next arrival, frame 3 arrives and is marked and stored, but still none of the frames can be delivered. Only at the last arrival, when finally a copy of frame 1 arrives, can frames 1, 2, and 3 be delivered to the network layer. There are two conditions for the delivery of frames to the network layer: First, a set of consecutive frames must have arrived. Second, the set starts from the beginning of the window. Example 11.8 (continued)
  • 229. 11. Another important point is that a NAK is sent after the second arrival, but not after the third, although both situations look the same. The reason is that the protocol does not want to crowd the network with unnecessary NAKs and unnecessary resent frames. The second NAK would still be NAK1 to inform the sender to resend frame 1 again; this has already been done. The first NAK sent is remembered (using the nakSent variable) and is not sent again until the frame slides. A NAK is sent once for each window position and defines the first slot in the window. Example 11.8 (continued)
  • 230. 11. The next point is about the ACKs. Notice that only two ACKs are sent here. The first one acknowledges only the first frame; the second one acknowledges three frames. In Selective Repeat, ACKs are sent when data are delivered to the network layer. If the data belonging to n frames are delivered in one shot, only one ACK is sent for all of them. Example 11.8 (continued)
  • 231. 11. Figure 11.23 Flow diagram for Example 11.8
  • 232. 11. Figure 11.24 Design of piggybacking in Go-Back-N ARQ
  • 233. Sliding Window Protocols (14)- Selective-Repeat
    • Selective-Repeat:
      • Receiver's window size larger than one.
      • Store all received frames after the bad one. ACK only last one received in sequence.
      • Use NAK (Negative ACK) when an error detected: checksum error or out of sequence
  • 234.
    • Selective Repeat:
    • In this protocol rather than discard all the subsequent frames following a damaged or lost frame, the receiver's data link layer simply stores them in buffers.
    • When the sender does not receive an acknowledgement for the first frame it's timer goes off after a certain time interval and it retransmits only the lost frame.
    • Assuming error - free transmission this time, the sender's data link layer will have a sequence of a many correct frames which it can hand over to the network layer.
    • Thus there is less overhead in retransmission than in the case of Go Back n protocol.
    • In case of selective repeat protocol the window size may be calculated as follows.
      • Assume that the size of both the sender's and the receiver's window is w.
      • So initially both of them contain the values 0 to (w-1).
      • Consider that sender's data link layer transmits all the w frames, the receiver's data link layer receives them correctly and sends acknowledgements for each of them.
      • However, all the acknowledgements are lost and the sender does not advance it's window.
      • The receiver window at this point contains the values w to (2w-1).
      • To avoid overlap when the sender's data link layer retransmits, we must have the sum of these two windows less than sequence number space.
      • Hence, we get the condition
        • Maximum Window Size = Sequence Number Space / 2
  • 235. Protocol Verification
    • How do you specify the operation of a protocol and then assure that it is working correctly.
    • Models:
      • Finite State Machined (FSM) Models
      • Petri Net Models
  • 236. Example Data Link Protocols
    • HDLC (High-Level Data Link Control)
    • PPP (Point to Point Protocol): DLL in the Internet
  • 237. Hamming Codes : for ED n EC
    • m data bits together with r error check bits form an n = (m + r) bit codeword
    • The number of bits two codewords differ in is called the hamming distance between the two codewords
    • Significance : If two codewords are at HD d then it requires d single bit errors to convert one into the other
  • 238. HD of a coding scheme
    • For m bit data .. All the 2^m possible combinations are legal
    • But not all the 2^n codewords are used
    • -- in a coding scheme (algorithm to compute the check bits) some of these codewords are legal and others are illegal
    • For eq .. Consider parity : 1(r = 1) parity bit is appended with value so that the total number of 1’s in the codeword is even ..
    • Then 11011 is a legal codeword in this scheme but 11010 is not
  • 239. HD of a list of legal codewords
    • Minimum HD between any pair of legal codewords in the list
    • Remember : Each algorithm to compute the check bits create a different list of legal codewords
  • 240. Use of HD for error detection
    • To detect d single bit errors , we need (an algorithm that creates) a code list with HD at least d + 1
    • For eg . For the parity scheme .. HD is 2 ..hence it can be used to detect single bit errors (d=1)
  • 241. Continued…
    • If the recvd codeword is legal .. We accept it ,
    • And if it is illegal we report (detect) an error
    • Q1 : Can it happen that we recv a legal codeword when d single bit errors have ocurred …this is eqwt to saying can we get a legal code from another legal code by d single bit errors?
    • A1 : No, since the HD of the code is at least d + 1. So a legal CW can be genearted from another LCW by inerting at least d + 1 bits and not by inverting d or less bits.
  • 242. Continued…
    • Q2 : Can we get an illegal CW when no error has occurred ?
    • A2 : Obviously not ..since the legal CW was sent by the sender and if no error has occurred then the recver must recv a legal CW
  • 243. Use of HD for error correction
    • To correct d single bit errors , we need (an algorithm that creates) a code list with HD at least 2d + 1.
    • For eg. Consider the following legal CWs:
    • 0000000000, 0000011111,1111100000,1111111111
    • HD is 5 .. It can be used to correct 2 single bit errors
  • 244. Continued..
    • Claim : Suppose we recv an illegal code C .. Then there is a unique legal code which is at a distance d or less from C
    • Proof : Suppose there are 2 codes C1 and C2 at distance d (or less) from C .. Then C1 can be obtained from C2 by 2d (or less) inversions .. A contradiction to (code has HD at least 2d + 1)
  • 245. Continue…
    • Obtain C1 from C2
    • Lets rearrange the bits of C so that all the bits(B1) that are inverted to obtain C1 are in the beginning followed by bits(B2) inverted to obtain C2 ..followed by the remaining bits (B3) ..In the worst case there is no overlapping between B1 and B2 .. In that case C1 is obtained from C2 by inverting exactly these B1 and B2 bits which together are no more than 2d .. (if there is some overlapping then those bits are not inverted, hence < 2d)
  • 246. Hamming Code to correct one bit errors
    • The bits of the CW are numbered left to right , starting from 1 … the bits that are powers of 2 are check bits (1,2,4,8 …) and the remaining are data bits.
    • Expand the position of each data bit in powers of 2 ..for eg. 11 = 1 + 2 + 8 .. So 11th bit contributes to the computation of value of these check bits I.e. 1,2, 8
  • 247. Continued…
    • We do this for each data bit ..
    • The value of a check bit is computed so that the parity of the all the data bits that contribute to it together with the check bit itself is even.
    • For eg .
    • data bits 1001000 will be sent as the codeword 00110010000
  • 248. Error-Correcting Codes
    • Use of a Hamming code to correct burst errors.
  • 249. Error detecting code
    • Polynomial code or CRC( Cyclic Redundancy Check )
  • 250. CRC
    • A message m : a string of bits corresponds to a polynomial denote it by M(x).
    • r check bits ….polynomial R(x).
    • Transmitted bits m + r ….polynomial
    • T(x) = M(x) + R(x)
    • Generator polynomial G(x)
    • r checkbits are computed so that when G(x) divides T(x), the remainder is zero.
  • 251. Error-Detecting Codes Calculation of the polynomial code checksum.
  • 252. CRC contd..
    • At the receiving end, receiver again divides the polynomial corresponding to the received bits by G(x) and accepts it iff the remainder is zero.
    • Now let E(x) denote the polynomial corresponding to the errored bits. Then receiver receives
    • T’(x) = T(x) + E(x)
    • G(x) divides T’(x) iff it divides E(x)
  • 253. CRC
    • Detecting single bit errors
    • E(x) = x^i
    • Choose G(x) = any polynomial with at least two terms
  • 254.
    • Detecting 2 single bit errors
    • E(x) = x^i + x^j = x^i (x ^ (j-i) + 1)
    • Choose G(x) s.t it neither divides x nor divides x^k + 1 for any k <= frame length
  • 255.
    • Detecting odd number of single bit errors
    • E(x) can’t be of the form (x + 1) Q(x)
    • Choose G(x) of the type (x + 1) Q(x)
  • 256. G(x) = a general polyn of degree r
    • Will detect single burst of length <= r
    • Will accept (without detecting) bursts of length r+1 with probably only ½^(r-1)
    • Will accept longer bursts (without detecting) with probability only ½^r
    • Note : Certain Polynomials have become international standards
  • 257. Detecting single burst of length k <=r with a gen polyn of degree r
    • E(x) = x^i ( x^(k-1) + …+ 1)
    • Choose G(x) = Q(x) + 1
    • If k-1 < degree of G(x) then G(x) can never divide E(x) … I.e. if k-1 < r ..I.e. if k <= r
  • 258. IEEE 802 LANs use
    • For eg.
    • X^32 + x^26 + x^23 + x^22 …..x^2 + x + 1
    • Detects single burst of length <= 32
    • Note : A simple shift register circuit can be constructed to compute and verify the checksums in hardware.
  • 259. Elementary Data Link Protocols
    • An Unrestricted Simplex Protocol
    • A Simplex Stop-and-Wait Protocol
    • A Simplex Protocol for a Noisy Channel
  • 260. Protocol Definitions Continued  Some definitions needed in the protocols to follow. These are located in the file protocol.h.
  • 261. Protocol Definitions (ctd.) Some definitions needed in the protocols to follow. These are located in the file protocol.h.
  • 262. Unrestricted Simplex Protocol
  • 263. Simplex Stop-and-Wait Protocol
  • 264. A Simplex Protocol for a Noisy Channel A positive acknowledgement with retransmission protocol. Continued 
  • 265. A Simplex Protocol for a Noisy Channel (ctd.) A positive acknowledgement with retransmission protocol.
  • 266. Sliding Window Protocols
    • A One-Bit Sliding Window Protocol
    • A Protocol Using Go Back N
    • A Protocol Using Selective Repeat
  • 267. 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.
  • 268. A One-Bit Sliding Window Protocol Continued 
  • 269. A One-Bit Sliding Window Protocol (ctd.)
  • 270. A One-Bit Sliding Window Protocol (2)
    • Two scenarios for protocol 4. (a) Normal case. (b) Abnormal case. The notation is (seq, ack, packet number). An asterisk indicates where a network layer accepts a packet.
  • 271. A Protocol Using Go Back N
    • Pipelining and error recovery. Effect on an error when
    • (a) Receiver’s window size is 1.
    • (b) Receiver’s window size is large.
  • 272. Sliding Window Protocol Using Go Back N Continued 
  • 273. Sliding Window Protocol Using Go Back N Continued 
  • 274. Sliding Window Protocol Using Go Back N Continued 
  • 275. Sliding Window Protocol Using Go Back N
  • 276. Sliding Window Protocol Using Go Back N (2)
    • Simulation of multiple timers in software.
  • 277. A Sliding Window Protocol Using Selective Repeat Continued 
  • 278. A Sliding Window Protocol Using Selective Repeat (2) Continued 
  • 279. A Sliding Window Protocol Using Selective Repeat (3) Continued 
  • 280. A Sliding Window Protocol Using Selective Repeat (4)
  • 281. A Sliding Window Protocol Using Selective Repeat (5)
    • (a) Initial situation with a window size seven.
    • (b) After seven frames sent and received, but not acknowledged.
    • (c) Initial situation with a window size of four.
    • (d) After four frames sent and received, but not acknowledged.
  • 282. Protocol Verification
    • Finite State Machined Models
    • Petri Net Models
  • 283. Finite State Machined Models
    • (a) State diagram for protocol 3. (b) Transmissions.
  • 284. Petri Net Models
    • A Petri net with two places and two transitions.
  • 285. Petri Net Models (2)
    • A Petri net model for protocol 3.
  • 286. Example Data Link Protocols
    • HDLC – High-Level Data Link Control
    • The Data Link Layer in the Internet
  • 287. High-Level Data Link Control
    • Frame format for bit-oriented protocols.
  • 288. High-Level Data Link Control (2)
    • Control field of
    • (a) An information frame.
    • (b) A supervisory frame.
    • (c) An unnumbered frame.
  • 289. The Data Link Layer in the Internet
    • A home personal computer acting as an internet host.
  • 290. PPP – Point to Point Protocol
    • The PPP full frame format for unnumbered mode operation.
  • 291. PPP – Point to Point Protocol (2)
    • A simplified phase diagram for bring a line up and down.
  • 292. PPP – Point to Point Protocol (3)
    • The LCP frame types.

×