Published on

Published in: Technology, News & Politics
1 Comment
  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide


  1. 1. Reference Model
  2. 2. Data Link layer• Data link Layer – explicit in OSI – can be synchronous or asynchronous• Reliable & Efficient Data Transfer (over a point-to-point link) – Error Detection, Error Recovery, Flow Control• Protocol performance governed by – propagation delay – bit-rate & frame size – noise• Provide service interface to the network layer• Regulating data flow – Slow receivers not swamped by fast senders
  3. 3. (a) Virt ual c o m m u n ic atio n.(b) Act u al c o m m u n icatio n.
  4. 4. Services offered to Network Layer• Unacknowledged connectionless service – Sender has no way of knowing if a frame has been successfully delivered – No logical connection is established – Appropriate for low error rate and real-time traffic – Losses are taken care at higher levels – 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. – Most LANs use it
  5. 5. Acknowledged Connectionless service• Useful on unreliable medium like wireless.• Acknowledgements add delays.• Adding ack in the DLL rather than in the NL is just an optimization and not a requirement. Leaving it for the NL 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.• No logical connection still, but each individual frame is acknowledged• Appropriate for WLANs
  6. 6. 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
  7. 7. End to End ACK/NAK1 2 3 4 5 Data Data Data Data Hop by Hop Data Data Data Data1 2 3 4 5 ACK/ ACK/ ACK/ ACK/ NAK NAK NAK NAK
  8. 8. Data Link Frames• General Frame format
  9. 9. Data Link Frames• Start and End of frames need to be identified at the destination, so they should be marked – Character counts – Start and ending flags with bit stuffing – Flag bytes with byte stuffing – Physical layer coding violation
  10. 10. Framing with Character CountA character stream. (a) Without errors. (b) With one error.
  11. 11. 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
  12. 12. Framing with bit stuffingBit 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.
  13. 13. Framing with byte stuffing
  14. 14. Framing with byte stuffing• Problem : fixed character size : assumes character size to be 8 bits : can’t handle heterogeneous environment.
  15. 15. Physical Layer coding violations• Some LANs encode 1 bit of data by using 2 physical bits – Normally, a 1 bit is a high-low pair and a 0 bit is a low-high pair – The start/end of a frame could be represented by the signal low-low or high-high• The advantage is that no extra bandwidth is required as in byte stuffing• The IEEE 802.4 standard uses this approach
  16. 16. Types of Errors• Single-Bit Error – only one bit in the data unit has changed• Burst Error – 2 or more bits in the data unit have changed• Error Correcting Codes – Include enough redundancy to detect and correct errors – appropriate for unreliable channels• Error Detecting Codes – Include enough redundancy bits to detect errors and use – ACKs and retransmissions to recover from the errors – Appropriate for reliable channels
  17. 17. Error Detection and Correction• In some cases it is sufficient to detect an error and in some, it requires the errors to be corrected also. For eg. – On a reliable medium : ED is sufficient where the error rate is low and asking for retransmission after ED would work efficiently – In contrast, on an unreliable medium : Retransmission after ED may result in another error and still another and so on. Hence EC is desirable.
  18. 18. Redundancy• Error detection uses the concept of redundancy, which means adding extra bits for detecting errors at the destination
  19. 19. Even-parity concept
  20. 20. Note:• In parity check, a parity bit is added to every data unit so that the total number of 1s is even (or odd for odd-parity).• This method is called Vertical Redundancy Check
  21. 21. Example 1• 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 11101110 11011110 11100100 11011000 11001001 • 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.
  22. 22. • 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.
  23. 23. Note:• Simple parity check can detect all single-bit errors. It can detect burst errors only if the total number of errors in each data unit is odd.
  24. 24. LRC• In two-dimensional parity check, a block of bits is divided into rows and a redundant row of bits is added to the whole block.
  25. 25. Two-dimensional parity(Longitudinal redundancy check)
  26. 26. Example 2• Suppose the following block is sent: 10101001 00111001 11011101 11100111 10101010• However, it is hit by a burst noise of length 8, and some bits are corrupted. 10100011 10001001 11011101 11100111 10101010• When the receiver checks the parity bits, some of the bits do not follow the even-parity rule and the whole block is discarded. 10100011 10001001 11011101 11100111 10101010
  27. 27. CRC generator and checker
  28. 28. Binary division in a CRC generator
  29. 29. Binary division in CRC checker
  30. 30. Polynomial
  31. 31. Standard PolynomialsName Polynomial ApplicationCRC-8 x8 + x2 + x + 1 ATM headerCRC-10 x10 + x9 + x5 + x4 + x 2 + 1 ATM AALITU-16 x16 + x12 + x5 + 1 HDLC x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5ITU-32 LANs + x4 + x2 + x + 1
  32. 32. Checksum
  33. 33. Checksum• The sender follows these steps: – The unit is divided into k sections, each of n bits. – All sections are added using one’s complement to get the sum. – The sum is complemented and becomes the checksum. – The checksum is sent with the data.
  34. 34. Checksum• The receiver follows these steps: – The unit is divided into k sections, each of n bits. – All sections are added using one’s complement to get the sum. – The sum is complemented. – If the result is zero, the data are accepted: otherwise, rejected.
  35. 35. Checksum• 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
  36. 36. Checksum• Now suppose the receiver receives the pattern sent in Example 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.
  37. 37. Checksum• Now suppose there is a burst error of length 5 that affects 4 bits. 10101111 11111001 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.
  38. 38. Correction• Backword Error Control – Retransmission• Forward Error Control – Single bit Error Correction – Burst Error Correction
  39. 39. 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 codeword differ in is called the hamming distance between the two codeword• Significance : If two codeword are at HD d then it requires d single bit errors to convert one into the other
  40. 40. HD of a coding scheme• For m bit data .. All the 2^m possible combinations are legal• But not all the 2^m codewords are used -- in a coding scheme (algorithm to compute the check bits) some of these codewords are legal and others are illegalFor 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
  41. 41. 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 + 1For eg . For the parity scheme .. HD is 2 ..hence it can be used to detect single bit errors (d=1)• If the recvd codeword is legal .. We accept it ,• And if it is illegal we report (detect) an errorRemember : Each algorithm to compute the check bits create a different list of legal codewords
  42. 42. Data and redundancy bits Hamming CodeNumber of Number of Total data bits redundancy bits bits m r m+r 1 2 3 2 3 5 3 3 6 4 3 7 5 4 9 6 4 10 7 4 11
  43. 43. Positions of redundancy bits in Hamming code
  44. 44. Redundancy bits calculation
  45. 45. Example of redundancy bit calculation
  46. 46. Error detection using Hamming code
  47. 47. Burst error correction example
  48. 48. Flow and Error Control• Flow Control  Flow control refers to a set of procedures used to restrict the amount of data that the sender can send before waiting for acknowledgment.• Error Control  Error control in the data link layer is based on automatic repeat request, which is the retransmission of data (Backward Error Control).
  49. 49. Flow Control• Ensure sending entity does not overwhelm receiving entity – By preventing buffer overflow• Influenced by: – Transmission time• time taken to emit all bits into medium – Propagation time• time for a bit to traverse the link• Assume here no errors but varying delays
  50. 50. Stop and Wait Flow Control• Source transmits frame• Destination receives frame and replies with acknowledgement (ACK)• Source waits for ACK before sending next• Destination can stop flow by not send ACK• Works well for a few large frames• Stop and wait becomes inadequate if large block of data is split into small frames
  51. 51. Sliding Windows Flow Control• Allows multiple numbered frames to be in transit• Receiver has buffer W long• Transmitter sends up to W frames without ACK• ACK includes number of next frame expected• Receiver can ack frames without permitting further transmission (Receive Not Ready)• Must send a normal acknowledge to resume• If have full-duplex link, can piggyback ACks
  52. 52. Error Control• Detection and correction of errors such as:– Lost frames– Damaged frames• Common techniques use:– Error detection– Positive acknowledgment– Retransmission after timeout– Negative acknowledgement & retransmission
  53. 53. Elementary Data Link Protocols• An Unrestricted Simplex Protocol• A Simplex Stop-and-Wait Protocol• A Simplex Protocol for a Noisy Channel
  54. 54. An Unrestricted Simplex Protocol• Transmitting and receiving NW layers are always ready• Simplex transmission• Processing time ignored• Infinite buffer space• Error free channel• No sequence numbers and ACKs used• Sender – Fetch a packet, construct a frame, send the frame• Receiver – Receives the undamaged frame from the physical layer.
  55. 55. A Simplex Stop-and-Wait Protocol• Communication in one direction• Channel is assumed to be error free• Deals with – preventing the sender from flooding the receiver with data faster than later is able to process them• ACK is used – Sender sends data frame – Receiver sends ACK (dummy frame) – Sender sends the next frame
  56. 56. Stop-and-Wait ARQ for Noisy Channel
  57. 57. Stop and Wait• Source transmits single frame• Wait for ACK• If received frame damaged, discard it – Transmitter has timeout – If no ACK within timeout, retransmit• If ACK damaged,transmitter will not recognize it – Transmitter will retransmit – Use alternate numbering and ACK0 / ACK1
  58. 58. Stop-and-Wait ARQ, lost frame
  59. 59. Stop-and-Wait ARQ, lost ACK frame
  60. 60. Stop-and-Wait ARQ, delayed ACK• In Stop-and-Wait ARQ, numbering frames prevents the retaining of duplicate frames• Numbered acknowledgments are needed if an acknowledgment is delayed and the next frame is lost
  61. 61. Sliding Windows Flow Control• Allows multiple numbered frames to be in transit• Receiver has buffer W long• Transmitter sends up to W frames without ACK• ACK includes number of next frame expected• Receiver can ack frames without permitting further transmission (Receive Not Ready)• Must send a normal acknowledge to resume• If have full-duplex link, can piggyback ACks
  62. 62. Piggybacking• To increase the utilization of the link• Frames in reverse direction carry the Ack for received frames – No separate frames for Ack
  63. 63. Piggybacking
  64. 64. Go-Back-N ARQ• Based on sliding window• If no error, ACK as usual• Use window to control number of outstanding frames• If error, reply with rejection – Discard that frame and all future frames until error frame received correctly – Transmitter must go back and retransmit that frame and all subsequent frames
  65. 65. Go Back N - Handling• Damaged Frame – Error in frame i so receiver rejects frame i – Transmitter retransmits frames from i• Lost Frame – Frame i lost and either• Transmitter sends i+1 and receiver gets frame i+1 out of seq and rejects frame i• Or transmitter times out and send ACK with P bit set which receiver responds to with ACK i – Transmitter then retransmits frames from i
  66. 66. Go Back N - Handling• Damaged Acknowledgement – Receiver gets frame i, sends ack (i+1) which is lost – Acks are cumulative, so next ack (i+n) may arrive before transmitter times out on frame i – If transmitter times out, it sends ack with P bit set – Can be repeated a number of times before a reset procedure is initiated• Damaged Rejection – Reject for damaged frame is lost – Handled as for lost frame when transmitter times out
  67. 67. Go-Back-N ARQIn Go-Back-N ARQ, the size of the sender window must be less than 2m; the size of the receiver window is always 1.
  68. 68. Sender sliding window
  69. 69. Receiver sliding window
  70. 70. Control variables
  71. 71. Go-Back-N ARQ, normal operation
  72. 72. Go-Back-N ARQ, lost frame
  73. 73. Go-Back-N ARQ: sender window size
  74. 74. Selective-Repeat ARQ• Also called selective reject ARQ• Only rejected frames are retransmitted• Subsequent frames are accepted by the receiver and buffered• Minimizes retransmission• Receiver must maintain large enough buffer• More complex logic in transmitter• Hence less widely used• Useful for satellite links with long propagation delays
  75. 75. Selective Repeat ARQ, sender and receiver windows
  76. 76. Selective Repeat ARQ, lost frame
  77. 77. Selective Repeat ARQ• In Selective Repeat ARQ, the size of the sender and receiver window must be at most one-half of 2m.
  78. 78. Selective Repeat ARQ, sender window size
  79. 79. Buffer Requirement of ARQ• Stop-and-Wait: –1• Go-back-N: –W+1• Selective Reject: – 2W