15-441 - Kesden - PowerPoint PPT Presentation

15 441 kesden n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
15-441 - Kesden PowerPoint Presentation
Download Presentation
15-441 - Kesden

Loading in 2 Seconds...

play fullscreen
1 / 33
15-441 - Kesden
0 Views
Download Presentation
billyy
Download Presentation

15-441 - Kesden

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. 15-441 - Kesden Lecture 5/Spring 2007

  2. ISO/OSI Reference Model • Application • Presentation • Session • Transport • Network • Data Link – We are here • Physical – We’ve been here

  3. The Data Link Layer • The physical layer was responsible for hiding the physical properties of the media. • The network layer is responsible for moving packets from network to network. • The link layer is responsible for getting packets from one machine to another on a particular network. • For our purposes, a network is a collection of machines connected via a communications channel such that the connection logically appears as if it was a single wire or bus, regardless of the actual media or configuration.

  4. Link Layer Design Issues • Management of the media, generally • Encoding • Framing • Error-detection/Error-correction [maybe] • Flow control [maybe]

  5. Management of the Media • In many cases, there may be limitations about who can use the actual physical network connection and when. • Broadcast media, such as ethernet, is the classic example. • This issue belongs to a sublayer of the data link layer called the Medium Access Control (MAC) layer.

  6. Link Types • Broadcast: • Senders and receivers share medium – all stations hear all transmissions • Radio • Sometimes wired, e.g. ethernet • Point-to-point • Fiber, RS232, USB (upstream vs. downstream) • Switched • Token ring

  7. Address Types • Static – anointed, soft-configured • Static – anointed, more hard-wired • Ethernet, 48 bits: [????] • 24 bits “per manufacturer” • 24 bits assigned by manufacturer • Port/Position on switch • Dynamic – “Anyone else use 45?” • Special addresses, e.g. designated broadcast

  8. Encoding • It is often the case that the physical layer has “personality”. • For example, baseband signals send 1s and 0s as high and low voltages. • But if the voltage doesn’t change for a long time, timing tolerance becomes and issue. • Long streams of 0s or 1s could lead to miscounted bits. • Typically, it is the link layer’s responsibility to mitigate this type of physical layer property. • This is done by encoding the bits in a way that is not subject to this type of problem.

  9. NRZ (Non-Return to Zero) 1 0 0 0 1 1 0 0 1 • Easy thing to do • Hard to count 0’s or 1s • Not necessarily balanced

  10. Ethernet Manchester Encoding 0 = rising transition 1 = falling transition 0 1 1 0 • 1 transitions per bit, but twice as much bandwidth • High-low pattern has good electrical properties • Balanced signal – no net DC voltage. • This allows AC coupled power supply on receiver. • If code had a DC bias, it would be lost in the transformer • on the receiver side.

  11. 4B/5B Encoding • Data encoded as symbols with 5 bit symbols representing 4 bit patterns • 100Mbps data requires 125Mhz • Each valid symbol has at least two 1s • Guarantees transitions • 16 data symbols • 8 additional symbols used for control • Idle • Frame boundary • FDDI is one example

  12. Framing • Physical layer is typically not error-free • Link layer must discard correct and/or replace defective data, depending on quality of service. • Typical approach is to break streams of 1’s and 0’s into more managable pieces called frames • Frames typically contain data bits and error correction or error detection bits • Depending on the protocol, defective frames may be corrected (if possible) or discarded. • Some link layer protocols might also handle retransmission of defective frames

  13. Framing, Example Which way do we lose more?

  14. Example: Point-To-Point Protocol (PPP), cont Can be omitted by negotiation 1 variable 2 or 4 1 1 or 2 1 1 Flag Address Control Protocol Payload Checksum Flag 01111110 11111111 00000011 01111110 The network layer packet Always all 1s. All stations accept all packets Usually as shown. Indicates unnumbered frame. Can provide numbered frames and reliable link layer – especially useful for noisy lines Which network layer is above? Indicates end of frame Indicates start of frame

  15. Example: Point-To-Point Protocol (PPP), cont Options agreed ESTABLISHED AUTHENTICATE Authentication successful Carrier detect failed NETWORK DEAD failed NCP configuration OPEN Carrier dropped TERMINATE done

  16. 1 variable 2 or 4 1 1 or 2 1 1 Flag Address Control Protocol Payload Checksum Flag 01111110 11111111 00000011 01111110 Code Identifier Length Data Example: Point-To-Point Protocol (PPP), cont 1 3 1 2 LCP Packet To match request and reply What type?

  17. LCP Packet Types

  18. Error Correction vs. Error Detection • Error correction is the ability to determine that a frame contains an error and then repair the error (without additional communication). • Error detection is the ability to detect that a frame contains a defect, but not necessarily to have the ability to repair it. • Error detection and error correction often involve adding additional bits called check bits or parity bits to the original bits of data.

  19. Simple Parity • Supply extra bit to force sum to even or odd • 1011, 1 [even parity] • 1010,0 [odd parity] • Old modems, ascii data • 7 bits, character • 1 bit, parity • Quite weak

  20. Close Enough? • Consider the following code: • 0 = jump • 1 = run • If 1 bit is in error, the message will be incorrect – and misleading • Now, consider the following code: • 00 = jump • 11 = run • Now, if only 1 bit is in error, the message won’t make sense, but we know that there is an error. • Okay, one more code: • 000 = jump • 111 = run • Now, if only 1 bit is in error, we can figure out which one it should be. If 2 bits are in error, we know that the codeword is defective, but don’t know which bits are wrong.

  21. Hamming Distance • The Hamming Distance between two codewords is the number of bits that one would need to change to convert one into the other. • The (minimum) Hamming distance of a code is the minimum Hamming Distance between any pair of codewords within the code. • Hamming distance is important, because it gives us a way of determining how much error detection and how much error correction is possible for a given code.

  22. Thinking about Error Detection and Correction T T T If the targets are close enough, a “miss” might hit the wrong one. If they are far enough apart, a miss is more likely to land “in between”. If they are really far apart, it is most likely that the a miss will land closer to the intended target than any other.

  23. Hamming Distance and EC/ED • Like the example on the previous slide, Hamming distance measures how far two things (codewords) are apart. • Remember that Hamming Distance measures the distance between two codewords by the number of bits that would need to change to convert one into another. • This is a useful measure, because as long as the number of bits in error is less than the Hamming Distance, the error will be detected -- the codeword will be invalid. • Similarly, if the Hamming distance between the codewords is more than double the number of bits in the error, the defective codeword will be closer to the correct one than to any other.

  24. Hamming Distance and EC/ED • Review: • d bit errors can be detected if the Hamming Distance of the code is greater than d • d bit errors can be corrected if the Hamming Distance of the code is greater than 2*d

  25. How Many Check Bits? • If we have a dense code with m message bits, we will need to add some r check bits to the message to put distance between the code words • The total number of bits in the codeword n = m + r • If we do this, each codeword will have n illegal codewords within 1 bit. (Flip each bit). • To be able to correct an error, we need 1 more bit than this, (n + 1) bits to make sure that 1-bit errors will fall closer to one codeword than any other.

  26. Hamming’s Code • Label the bits of the codeword from left-to-right, from 1 through n. • Check bits are stored in power of two bit positions. • Data bits are stored in other positions • Each parity bit is used to force the sum of itself and the bits that it checks to an even number (or odd) • Each bit is checked by one or more parity bits. Specifically, let’s consider a bit index i. If we rewrite in terms of powers of 2, it is checked by those powers of two that contribute to the addition • For example, 7 = 4 + 2 + 1 so bit 7 contributes to parity bits 4, 2, and 1.

  27. Hamming’s Code (Example) • a = _ _ 1 _ 1 0 0 _ 0 0 1 1 2 3 4 5 6 7 8 9 10 11 • 1 checks 3, 5, 7, 9, 11 1 + 1 + 0 + 0 + 1= 3; set parity bit on to force even parity • 2 checks 6, 7, 10, 11 0 + 0 + 0 + 1= 1; set parity bit on to force even parity • 4 checks 5, 6, 7 1 + 0 + 0 = 1; set parity bit on to force even parity • 8 checks 9, 10, 11 0 + 0 + 1= 1; set parity bit on to force even parity • a = 1 1 1 1 1 0 0 1 0 0 1 1 2 3 4 5 6 7 8 9 10 11

  28. Hamming’s Code (Ex.), cont. • a = 1 1 1 1 1 0 1 1 0 0 1 1 2 3 4 5 6 7 8 9 10 11 • 1 checks 3, 5, 7, 9, 11 1 + 1 + 1 + 0 +1 = 4; parity should be 0, but it is 1. Count = 1 • 2 checks 6, 7, 10, 11 0 + 1 + 0 + 1 = 2; parity bit should be 0, but isn’t. Count +=2, so count is 3 • 4 checks 5, 6, 7 1 + 0 + 1 = 2; parity bit should be 0, but isn’t. Count += 4, so count=7 • 8 checks 9, 10, 11 0 + 0 + 1= 1; parity bit should be 1 and is. Don’t change count. Count is still 7 • So, if only 1 bit is in error, it is bit 7.

  29. Hamming’s Code (Ex.), cont. • a = 1 1 1 1 1 0 1 0 0 0 1 1 2 3 4 5 6 7 8 9 10 11 • 1 checks 3, 5, 7, 9, 11 1 + 1 + 1 + 0 + 1= 4; parity should be 0, but it is 1. Count = 1 • 2 checks 6, 7, 10, 11 0 + 1 + 0 + 1= 2; parity bit should be 0, but isn’t. Count +=2, so count is 3 • 4 checks 5, 6, 7 1 + 0 + 1 = 2; parity bit should be 0, but isn’t. Count += 4, so count=7 • 8 checks 9, 10, 11 0 + 0 + 1= 0; parity bit should be 1 but is 0. Count +=8, so count=15. • This makes no sense! More than 1 bit is in error. We can’t fix it.

  30. Checksums • Checksums are based on dividing binary polynomials, modulus 2. • Both addition and subtraction are equal to XOR in modulus 2 arithmetic • 10011011 11110000 + 11001010 + 10101111 01010001 01011111 • This can be used to perform long division.

  31. Checksums, cont. • Given a message, we will add checksum bits • These bits will be computed by dividing the message by a generator polynomial modulus 2. • The remainder is the checksum • The checksum is one bit smaller than the generator polynomial. • Good polynomials won’t divide the types of errors common in a particular channel

  32. Checksum, cont. • CRC-12: x12 + x11 + x3 + x2 + x1 + 1 • CRC-16: x16 + x15 + x2 + 1 • CRC-CCITT: x16 + x12 + x5 + 1 • These can be represented as polynomials. For example, consider CRC-12: 1 1 0 0 0 0 0 0 0 1 1 1 1

  33. Checksum, cont. 1 1 0 0 0 0 1 0 1 0 1 0 0 1 1 1 1 0 1 0 1 1 0 1 1 0 0 0 0 1 0 0 1 1 1 0 0 1 1 1 0 0 1 1 1 0 1 1 0 1 0 0 1 1 1 0 1 0 0 1 0 0 1 1 1 1 1 0 This remainder is the checksum.