Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer S y stems (159.253) ~ 31 ~Data Communications: © P.L y ons 2004 Text usually unsuitable for RLE only contains repeated space chars D ata C ompression.

Similar presentations


Presentation on theme: "Computer S y stems (159.253) ~ 31 ~Data Communications: © P.L y ons 2004 Text usually unsuitable for RLE only contains repeated space chars D ata C ompression."— Presentation transcript:

1 Computer S y stems (159.253) ~ 31 ~Data Communications: © P.L y ons 2004 Text usually unsuitable for RLE only contains repeated space chars D ata C ompression RLE ( R UN L ENGTH E NCODING) Aims to save money and time by reducing amount of data transmitted Instead of sending Send ESC 7 When data includes ESC, send ESC ESC RLE is used for encoding faxes Binary files better often contain repeated chars, especially NUL there’s an alternative that would send 5 no. of repetitions more elegant; acts as its own esc RunLength Encoding

2 Computer S y stems (159.253) ~ 32 ~Data Communications: © P.L y ons 2004 D ata C ompression H UFFMAN C ODING Makes boundaries between characters hard to find ASCII encodes all characters with 7 bits Characters occur with unequal frequencies f e =100 x f q Use fewer bits to encode most-common D.A. Huffman Huffman Coding

3 Computer S y stems (159.253) ~ 33 ~Data Communications: © P.L y ons 2004 Consider an alphabet with only 4 letters 2-bit codeHuffman code (most common) A001 B01 C10001 (least common) D11000 20 bits → 19 bits better compression with larger alphabets! D ata C ompression H UFFMAN C ODING AAAABBBCCD 00 1 01 11 00 1 10 001 11 000 Huffman code 2-bit code D.A. Huffman Huffman Coding

4 Computer S y stems (159.253) ~ 34 ~Data Communications: © P.L y ons 2004 D ata C ompression H UFFMAN C ODING Most efficient to create a code specifically for the data being sent Allows for different letter frequencies in different languages Both ends must agree on the code set Fax machines use a modified Huffman scheme. codes for sequences containing 1, 2, 3,...., 63, 64 black or white dots 128, 192,... (i.e. multiples of 64) dots So 67-dot sequence would be sent as codes for 64 then 3 D.A. Huffman Huffman Coding

5 Computer S y stems (159.253) ~ 35 ~Data Communications: © P.L y ons 2004 D ata C ompression L EMPEL- Z IV C OMPRESSION ZIP and UNIX Compress utility use (modified) L-Z compression Codes are fixed-length (usually 12 or 16-bits ) 7-bit ASCII for single characters + nine 0-bits Inefficient when sending single characters But after a while, very few single characters get sent Extra codes for most common character sequences Sender creates extra codes based on the letter frequencies in the message Receiver constructs extra codes while decompressing the original message Abraham Lempel Jacob Ziv Lempel-Ziv Compression

6 Computer S y stems (159.253) ~ 36 ~Data Communications: © P.L y ons 2004 Lempel-Ziv Compression D ata C ompression L EMPEL- Z IV C OMPRESSION a 1 b2b2. z26. th27. the79. then158 the R emaining string R denotes the unsent part of the message Initially, R is the complete message A code table relates character sequences to codes Initially, code table just contains the alphabet Sender and receiver have the same table New sequences are added when they are encountered sender and receiver both add the same codes easy for the sender! L denotes the longest string of characters… starting from the first character of R occurring in the code table L ’ denotes L + the next character in R Abraham Lempel Jacob Ziv

7 Computer S y stems (159.253) ~ 37 ~Data Communications: © P.L y ons 2004 Lempel-Ziv Compression D ata C ompression …they then and there theorised that this was thus L L’ R Sender identifies L, sends the code for L to the receiver Receiver receives code looks it up in the code table adds L to the message string Sender identifies L’, & makes a new entry in the code table for L’ Abraham Lempel Jacob Ziv L EMPEL- Z IV C OMPRESSION

8 Computer S y stems (159.253) ~ 38 ~Data Communications: © P.L y ons 2004 Lempel-Ziv Compression a1 b2 c3 d4 e5 f6 g7 h8 i9 j10 k11 l12 m13 n14 o15 p16 q17 r18 s19 t20 u21 v22 w23 x24 y25 z26 _27 Sender a1 b2 c3 d4 e5 f6 g7 h8 i9 j10 k11 l12 m13 n14 o15 p16 q17 r18 s19 t20 u21 v22 w23 x24 y25 z26 _27 Receiver D ata C ompression Abraham Lempel Jacob Ziv L EMPEL- Z IV C OMPRESSION

9 Computer S y stems (159.253) ~ 39 ~Data Communications: © P.L y ons 2004 Lempel-Ziv Compression they_then_and_there_theorised_that_this_was_thus a1 b2 c3 d4 e5 f6 g7 h8 i9 j10 k11 l12 m13 n14 o15 p16 q17 r18 s19 t20 u21 v22 w23 x24 y25 z26 _27 ► th28 the33 a1 b2 c3 d4 e5 f6 g7 h8 i9 j10 k11 l12 m13 n14 o15 p16 q17 r18 s19 t20 u21 v22 w23 x24 y25 z26 _27 R L L’ 20 28 h t Sender Receiver D ata C ompression L EMPEL- Z IV C OMPRESSION Abraham Lempel Jacob Ziv

10 Computer S y stems (159.253) ~ 40 ~Data Communications: © P.L y ons 2004 Lempel-Ziv Compression eehy_then_and_there_theorised_that_this_was_thus a1 b2 c3 d4 e5 f6 g7 h8 i9 j10 k11 l12 m13 n14 o15 p16 q17 r18 s19 t20 u21 v22 w23 x24 y25 z26 _27 ► th28 the33 a1 b2 c3 d4 e5 f6 g7 h8 i9 j10 k11 l12 m13 n14 o15 p16 q17 r18 s19 t20 u21 v22 w23 x24 y25 z26 _27 R L L’ 8 29 t Sender Receiver D ata C ompression ► he29 h ► th28 the33 Abraham Lempel Jacob Ziv L EMPEL- Z IV C OMPRESSION

11 Computer S y stems (159.253) ~ 41 ~Data Communications: © P.L y ons 2004 Lempel-Ziv Compression yey_then_and_there_theorised_that_this_was_thus a1 b2 c3 d4 e5 f6 g7 h8 i9 j10 k11 l12 m13 n14 o15 p16 q17 r18 s19 t20 u21 v22 w23 x24 y25 z26 _27 ► th28 the33 a1 b2 c3 d4 e5 f6 g7 h8 i9 j10 k11 l12 m13 n14 o15 p16 q17 r18 s19 t20 u21 v22 w23 x24 y25 z26 _27 R L L’ 5 30 t Sender Receiver D ata C ompression ► he29 h ► th28 the33 ► ey30 en34 e ► he29 Abraham Lempel Jacob Ziv L EMPEL- Z IV C OMPRESSION

12 Computer S y stems (159.253) ~ 42 ~Data Communications: © P.L y ons 2004 Lempel-Ziv Compression _ythen_and_there_theorised_that_this_was_thus a1 b2 c3 d4 e5 f6 g7 h8 i9 j10 k11 l12 m13 n14 o15 p16 q17 r18 s19 t20 u21 v22 w23 x24 y25 z26 _27 ► th28 the33 a1 b2 c3 d4 e5 f6 g7 h8 i9 j10 k11 l12 m13 n14 o15 p16 q17 r18 s19 t20 u21 v22 w23 x24 y25 z26 _27 R L L’ 25 31 t Sender Receiver D ata C ompression ► he29 h ► th28 the33 e ► he29 y ► ey30 en34 ► y_31 _ ► ey30 en34 Abraham Lempel Jacob Ziv L EMPEL- Z IV C OMPRESSION

13 Computer S y stems (159.253) ~ 43 ~Data Communications: © P.L y ons 2004 Lempel-Ziv Compression _then_and_there_theorised_that_this_was_thus a1 b2 c3 d4 e5 f6 g7 h8 i9 j10 k11 l12 m13 n14 o15 p16 q17 r18 s19 t20 u21 v22 w23 x24 y25 z26 _27 ► th28 the33 a1 b2 c3 d4 e5 f6 g7 h8 i9 j10 k11 l12 m13 n14 o15 p16 q17 r18 s19 t20 u21 v22 w23 x24 y25 z26 _27 R L L’ 27 32 t Sender Receiver D ata C ompression ► he29 h ► th28 the33 e ► he29 y ► ey30 en34 ► y_31 t _ ► ey30 en34 ► _t32 _a36 ► y_31 Abraham Lempel Jacob Ziv L EMPEL- Z IV C OMPRESSION

14 Computer S y stems (159.253) ~ 44 ~Data Communications: © P.L y ons 2004 Lempel-Ziv Compression then_and_there_theorised_that_this_was_thus a1 b2 c3 d4 e5 f6 g7 h8 i9 j10 k11 l12 m13 n14 o15 p16 q17 r18 s19 t20 u21 v22 w23 x24 y25 z26 _27 ► th28 the33 a1 b2 c3 d4 e5 f6 g7 h8 i9 j10 k11 l12 m13 n14 o15 p16 q17 r18 s19 t20 u21 v22 w23 x24 y25 z26 _27 R L L’ 28 33 t Sender Receiver D ata C ompression ► he29 h ► th28 the33 e ► he29 y ► ey30 en34 ► y_31 e _ ► ey30 en34 th ► y_31 ► _t32 _a36 ► _t32 _a36 Abraham Lempel Jacob Ziv L EMPEL- Z IV C OMPRESSION

15 Computer S y stems (159.253) ~ 45 ~Data Communications: © P.L y ons 2004 Lempel-Ziv Compression en_and_there_theorised_that_this_was_thus a1 b2 c3 d4 e5 f6 g7 h8 i9 j10 k11 l12 m13 n14 o15 p16 q17 r18 s19 t20 u21 v22 w23 x24 y25 z26 _27 ► th28 the33 a1 b2 c3 d4 e5 f6 g7 h8 i9 j10 k11 l12 m13 n14 o15 p16 q17 r18 s19 t20 u21 v22 w23 x24 y25 z26 _27 R L L’ 5 34 t Sender Receiver D ata C ompression ► he29 h ► th28 the33 e ► he29 y ► ey30 en34 ► y_31 n _ ► ey30 en34 th ► y_31 ► _t32 _a36 ► _t32 _a36 e Several further steps ensue… Abraham Lempel Jacob Ziv L EMPEL- Z IV C OMPRESSION

16 Computer S y stems (159.253) ~ 46 ~Data Communications: © P.L y ons 2004 Lempel-Ziv Compression _th e ► n_35 a1 b2 c3 d4 e5 f6 g7 h8 i9 j10 k11 l12 m13 n14 o15 p16 q17 r18 s19 t20 u21 v22 w23 x24 y25 z26 _27 ► nd38 ► re42 ► _t32 _a36 ► _th40 ► _the43 a1 b2 c3 d4 e5 f6 g7 h8 i9 j10 k11 l12 m13 n14 o15 p16 q17 r18 s19 t20 u21 v22 w23 x24 y25 z26 _27 ► n_35 ► re42 ► th28 the33 ► _t32 _a36 ► _th40 ► y_31 _and_there_theorised_that_this_was_thus Sender Receiver ► ► he29 ► ► th28 the33 ► y_31 ► he29 ► nd38 ► an37 ► ► d_39 ► ► her41 ► ey30 en34 e_43 ► ey30 en34 e_43 R L L’ eorised_that_this_was_thus 40 43 they_then D ata C ompression Abraham Lempel Jacob Ziv L EMPEL- Z IV C OMPRESSION

17 Computer S y stems (159.253) ~ 47 ~Data Communications: © P.L y ons 2004 Lempel-Ziv Compression spin- s a1 b2 c3 d4 e5 f6 g7 h8 i9 j10 k11 l12 m13 n14 o15 p16 q17 r18 s19 t20 u21 v22 w23 x24 y25 z26 _27 a1 b2 c3 d4 e5 f6 g7 h8 i9 j10 k11 l12 m13 n14 o15 p16 q17 r18 s19 t20 u21 v22 w23 x24 y25 z26 _27 Sender R L L’ pin-effect 89 92 A special case ► sp73 ► spi79 ► spin84 ► ► sp73 ► spi79 ► spin84 ► spin- 89 ► s Receiver spin- 89 ► spin-s 92 ► (well, nearly) D ata C ompression Abraham Lempel Jacob Ziv L EMPEL- Z IV C OMPRESSION

18 Computer S y stems (159.253) ~ 48 ~Data Communications: © P.L y ons 2004 Lempel-Ziv Compression spin- e a1 b2 c3 d4 e5 f6 g7 h8 i9 j10 k11 l12 m13 n14 o15 p16 q17 r18 s19 t20 u21 v22 w23 x24 y25 z26 _27 a1 b2 c3 d4 e5 f6 g7 h8 i9 j10 k11 l12 m13 n14 o15 p16 q17 r18 s19 t20 u21 v22 w23 x24 y25 z26 _27 Sender R L L’ effect 89 93 ► sp73 ► spi79 ► spin84 ► spin- 89 ► spin-s 92 ► ► sp73 ► spi79 ► spin84 ► spin- 89 ► spin-s 92 ► Receiver spin- spin-e 93 ► A special case(well, nearly) D ata C ompression Abraham Lempel Jacob Ziv L EMPEL- Z IV C OMPRESSION

19 Computer S y stems (159.253) ~ 49 ~Data Communications: © P.L y ons 2004 Lempel-Ziv Compression spin- ef a1 b2 c3 d4 e5 f6 g7 h8 i9 j10 k11 l12 m13 n14 o15 p16 q17 r18 s19 t20 u21 v22 w23 x24 y25 z26 _27 a1 b2 c3 d4 e5 f6 g7 h8 i9 j10 k11 l12 m13 n14 o15 p16 q17 r18 s19 t20 u21 v22 w23 x24 y25 z26 _27 e Sender R L L’ ffect 5 94 ► sp73 ► spi79 ► spin84 ► spin- 89 ► spin-s 92 ► ► sp73 ► spi79 ► spin84 ► spin- 89 ► spin-s 92 ► Receiver spin- spin-e 93 ► ef 94 ► spin-e 93 ► A special case(well, nearly) D ata C ompression Abraham Lempel Jacob Ziv L EMPEL- Z IV C OMPRESSION

20 Computer S y stems (159.253) ~ 50 ~Data Communications: © P.L y ons 2004 Lempel-Ziv Compression s spin- s a1 b2 c3 d4 e5 f6 g7 h8 i9 j10 k11 l12 m13 n14 o15 p16 q17 r18 s19 t20 u21 v22 w23 x24 y25 z26 _27 a1 b2 c3 d4 e5 f6 g7 h8 i9 j10 k11 l12 m13 n14 o15 p16 q17 r18 s19 t20 u21 v22 w23 x24 y25 z26 _27 Sender R L L’ pin-splitt 89 92 ► sp73 ► spi79 ► spin84 ► ► sp73 ► spi79 ► spin84 ► spin- 89 ► Receiver spin- 89 ► spin-s 92 ► A special case(yes, really!) ing D ata C ompression Abraham Lempel Jacob Ziv L EMPEL- Z IV C OMPRESSION

21 Computer S y stems (159.253) ~ 51 ~Data Communications: © P.L y ons 2004 Lempel-Ziv Compression pspin-s spin- a1 b2 c3 d4 e5 f6 g7 h8 i9 j10 k11 l12 m13 n14 o15 p16 q17 r18 s19 t20 u21 v22 w23 x24 y25 z26 _27 a1 b2 c3 d4 e5 f6 g7 h8 i9 j10 k11 l12 m13 n14 o15 p16 q17 r18 s19 t20 u21 v22 w23 x24 y25 z26 _27 R L L’ 92 93 ► sp73 ► spi79 ► spin84 ► spin- 89 ► spin-s 92 ► ► sp73 ► spi79 ► spin84 ► spin- 89 ► spin-s 92 ► spin-s spin-sp 93 ► A special case(yes, really!) litting Sender Receiver p D ata C ompression Abraham Lempel Jacob Ziv L EMPEL- Z IV C OMPRESSION We are standing up

22 Computer S y stems (159.253) ~ 52 ~Data Communications: © P.L y ons 2004 Error Detection Sensitivity of applications to errors E rror D etection and C orrection E RROR D ETECTION Errors caused by noise Impulse (clicks) Crosstalk (between lines) Thermal (can’t eliminate) If we can detect errors, we can eliminate them Undetected errors can’t be eliminated altogether Aim for a detection rate high enough for application Video transfer Bank transactions high low Tanenbaum 3 rd edition: 183-190

23 Computer S y stems (159.253) ~ 53 ~Data Communications: © P.L y ons 2004 with even parity: 1111111 ↓ 11111111 0111111 ↓ 01111110 Error Detection Methods E rror D etection and C orrection E RROR D ETECTION Double sending M ETHODS used by data prep operators not normally used in data comms Parity Add 1 or 0 after character to make total no of 1s even (even parity ) or odd (odd parity) On arrival, no. of 1 bits in characters should still be even Single-bit corruptions make no. of 1 bits odd Two-bit corruptions are undetected.

24 Computer S y stems (159.253) ~ 54 ~Data Communications: © P.L y ons 2004 Receiver calculates XOR sum of complete byte sequence detects error if calculated XOR sums is non-zero E rror D etection and C orrection B LOCK C HECKSUMS Sender sends byte sequence & XOR sum of byte sequence does not detect two characters that are reversed. Block Checksums

25 Computer S y stems (159.253) ~ 55 ~Data Communications: © P.L y ons 2004 conventional “horizontal” parity “longitudinal” parity Uses both longitudinal and horizontal parity. Note: positional information => block parity can be used for error correction E rror D etection and C orrection B LOCK P ARITY 0001010 0000100 0010000 0011100 0000000 0100000 0000010 0100000 0 1 1 1 0 1 1 1 0 Block Parity

26 Computer S y stems (159.253) ~ 56 ~Data Communications: © P.L y ons 2004 CRCs Receiver DATA Sender E rror D etection and C orrection CRC (C YCLIC R EDUNDANCY C HECK ) divisor represents a polynomial: 11001 represents a polynomial of degree D = 4 1x 4 + 1x 3 + 0x 2 + 0x 1 + 1x 0 divisor quotient divisor quotient + 0 + remainder DATA + + remainder DATA’

27 Computer S y stems (159.253) ~ 57 ~Data Communications: © P.L y ons 2004 CRCs If data = 11100110, divisor = 11001 (D = 4 (x 4 is the highest term) ) add D 0s to the data divide, using rules of modulo-2 division: XOR instead of subtraction CRC (C YCLIC R EDUNDANCY C HECK ) E rror D etection and C orrection B “goes into” A if B’s high-order bit is in the same position as A’s high-order bit In A/BA/B,

28 Computer S y stems (159.253) ~ 58 ~Data Communications: © P.L y ons 2004 CRCs 11001 ) 11100110 0000 CRC (C YCLIC R EDUNDANCY C HECK ) E rror D etection and C orrection 1 11001  01011 0 00000 10111 11001 11100 1 1 11001 01010 00000 10100 11001 11010 11001 00110 00000 0 1 1 0 The CCITT polynomial (divisor) is x 16 + x 15 + x 2 + x 0 CRCs detect all single bit errors, most double bit errors, all error bursts <16 bits most error burst >16 bits. 11000000000000101

29 Computer S y stems (159.253) ~ 59 ~Data Communications: © P.L y ons 2004 FEC ( F orward E rror C ontrol) Used where retransmission is undesirable Include extra information with message so it can be reconstructed Computer memory, or disk Simplex transmission from a data logger Transmissions from distant spacecraft E rror D etection and C orrection E RROR C ORRECTION ARQ ( A utomatic R etransmission on re Q uest) Most common in data comms if received data contains errors, request retransmission Error Correction

30 Computer S y stems (159.253) ~ 60 ~Data Communications: © P.L y ons 2004 H AMMING C ODES E rror D etection and C orrection Facilitate error detection and correction Use >1 bit to encode a bit 0 in data becomes codeword 000 1 in data becomes codeword 111 000 100 110 010 011 001 111 101 “Hamming Distance” = 3 Closer to 111 than to 000 Closer to 000 than to 111 To detect d bit errors, a code’s HD must be  d+1 To correct d bit errors, a code’s HD must be  2d+1 With HD = 3, it is possible EITHER to detect 2-bit errors OR to correct 1-bit errors Richard Hamming Hamming Codes

31 Computer S y stems (159.253) ~ 61 ~Data Communications: © P.L y ons 2004 To detect d bit errors, code’s HD must be  d+1 To correct d bit errors, a code’s HD must be  2d+1 H AMMING C ODES E rror D etection and C orrection a 0000011111 b 0000000000 c 1111100000 d 1111111111 HD for some character-pairs is 10 But minimum intercharacter HD is 5, so HD for the whole code is 5. If 1 or 2 bits change, the result is nearer to the original valid codeword So, for 2-bit error correction, HD  5 5105a dcba Inter- character Hamming Distances a 00000 11111 0000 1 0 1111 00000 11111a 0000000000b 11111 00000c 1111111111d 2 5 8 5 5105d 55 c 55b Richard Hamming Hamming Codes

32 Computer S y stems (159.253) ~ 62 ~Data Communications: © P.L y ons 2004 Richard Hamming H AMMING C ODES Hamming Codes E rror D etection and C orrection 151413121110987654321 001110101001000 1 1 1 1 1 1 1 0 1 1 0 1 1 1 0 0 1 0 1 1 1 0 1 0 1 0 0 1 1 0 0 0 0 1 1 1 0 1 1 0 0 1 0 1 0 1 0 0 0 0 1 1 0 0 1 0 0 0 0 1

33 Computer S y stems (159.253) ~ 63 ~Data Communications: © P.L y ons 2004 0010100001111000 Richard Hamming H AMMING C ODES Hamming Codes E rror D etection and C orrection 00111010 00111001 151413121110987654321 001110101001000 0 0 0 0 0000 Hamming Codes

34 Computer S y stems (159.253) ~ 64 ~Data Communications: © P.L y ons 2004 0010100001111000 Richard Hamming H AMMING C ODES Hamming Codes E rror D etection and C orrection 00111010 00111001 151413121110987654321 001110101001000 0 0 0 0 0000 0 0 0 0 0 1 1 1 1011 1 Hamming Codes


Download ppt "Computer S y stems (159.253) ~ 31 ~Data Communications: © P.L y ons 2004 Text usually unsuitable for RLE only contains repeated space chars D ata C ompression."

Similar presentations


Ads by Google