Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Reference Peter Norton’s, Introduction to Computers, 4 th edition, Glencoe McGraw-Hill. Lessons 7 and 9.

Similar presentations


Presentation on theme: "1 Reference Peter Norton’s, Introduction to Computers, 4 th edition, Glencoe McGraw-Hill. Lessons 7 and 9."— Presentation transcript:

1

2 1 Reference Peter Norton’s, Introduction to Computers, 4 th edition, Glencoe McGraw-Hill. Lessons 7 and 9.

3 2 Online Storage of Bits Main Memory Mass Storage Representation Information Binary System - Integer & Floating Point Data Compression Communication Errors

4 3 Computer Science — An Overview J. Glenn Brookshear Chapter One Data Storage

5 4 Storage of Bits - Logic View

6 5 Question about Bits Is it enough to represent the whole world only by using 0s and 1s? What kind of operations can work on 0s and 1s to perform tasks on computer? How does the computer know which bit patterns represent what? It does not; only the program does. Computer just do it.

7 6 Data Representation Use bit strings to represent different kinds of information –Numbering: binary system, floating point notation (discuss later) –Text: ASCII code (discussed later) –Statement: True or False (1/0) Example of Numbers 00000000000000000 10000000000000001 20000000000000010 30000000000000011 40000000000000100 Example of Characters ‘A’00000000 01000001 ‘B’ 00000000 01000010

8 7 Statement and Logic (1/3) We use characters to denote statements in the real world : –P : Mary watches TV. –Q : Today is Sunday. –R : Mary has finished her homework. We use 1/0 to denote that the statement (P) is true or false. –Mary watches TV  P is True  P =1 –Mary does not watch TV  P is False  P =0

9 8 Statement and Logic (2/3) How to show following statements? –Today is Tuesday.  Q is false, Q=0 To represent 1/0 needs only one bit. Note that the statement can be negative. –Statement S: Tom has no girl friend. Tom has no girl friend.  S is True  S=1. Tom has a girl friend (or a lot of girl friends.)  S is False  S=0

10 9 Statement and Logic (3/3) How to do some prediction ? We want to predict for all cases. –Mary watches TV if today is Sunday and she has finished her homework. If Q is true and R is true, then P is true. P = Q AND R for all Q, R in {0,1} –Today is Tuesday and Mary has finished her homework. Does Mary watch TV now? Q=0 AND R=1. So P=0, Mary does not.

11 10 Boolean Algebra George Boolean Every variable is either 0 or 1. –P=0 or P=1 (P is Boolean variable.) Define some operations on {0, 1} –AND, OR, XOR, NOT (Figure 1.1) Thus, we can use the Boolean variable and these operations to perform some calculation for some predictions.

12 11 NOT NOT (A) means that If A is true, then NOT(A) is false. If A is false, then NOT(A) is true. We use notation A or  A to denote NOT (A) –P : Mary watches TV.  NOT (P) : Mary does not watch TV. –If today is not Sunday, Tom has no girl friend.  S =  Q Truth Table A NOT (A) 0 1 1 0

13 12 AND AND (A,B) means that If A=1 and B=1, then AND(A,B)=1. Else, AND(A,B) =0. AND(A,B) = AB = A ۸ B Example : –If Today is Sunday and Mary has finished her homework, then Mary watches TV. –P = Q AND R = Q R Truth Table A B AND (A,B) 0 0 0 0 1 0 1 0 0 1 1 1

14 13 OR OR (A,B) means that If A=1 or B=1, then OR(A,B)=1. Else, OR(A,B) =0. OR(A,B) = A  B = A ۷ B Example : –If Today is Sunday or Mary has finished her homework, then Mary watches TV. –P = Q OR R = Q + R Truth Table A B OR(A,B) 0 0 0 0 1 1 1 0 1 1 1 1

15 14 XOR XOR (A,B) means that If either A=1 or B=1 but not both, then XOR(A,B)=1. Else, XOR(A,B) =0. XOR(A,B) = A  B Example : –If Today is Sunday or Mary has finished her homework but not both, then Mary watches TV. –P = Q XOR R = Q  R Truth Table A B X OR(A,B) 0 0 0 0 1 1 1 0 1 1 1 0

16 15 Figure 1.1 The Boolean operations AND, OR, and XOR A B

17 16 Example: Adder A + B = Sum with a Carry Sum = A XOR B Carry = A AND B Truth Table A B SUM Carry 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1 XOR AND

18 17 Storage of Bits - Physical Device

19 18 Bits (1/2) Computer processing is performed by transistors, which are switches with only two possible states: on and off. –If a transistor is assigned a value of 1, it is on. –If it has a value of 0, it is off. A single unit of data is called a bit, having a value of 1 or 0. All computer data is converted to a series of binary numbers– 1 and 0.

20 19 Bits (2/2) In computer, high voltage represents 1 and low voltage represents 0, usually. A bit is 0 or 1. –Off or on (for switch) –Open or close (for relay) –False or True (for any statement) logic 0 logic 1 volt 1 2 3 4 5 0

21 20 Switches and Bits 1 0 1 1 0 0 1 01 0 0 1 0 0 1 01 0 0 1 0 0 1 11 1 1 1

22 21 Logic Gate A wire represent a logic 0/1. How the Boolean operation is performed on the computer? Answer is logic gate. –Input : two input wires ( may be 0 or 1 ) –Output : one wire with the appropriate value ABAB A OR B OR

23 22 Figure 1.2 (1/2) Representation of AND, OR, XOR, and NOT gates

24 23 Figure 1.2 (2/2) Representation of AND, OR, XOR, and NOT gates

25 24 Half Adder A + B = Sum with a Carry Sum = A XOR B Carry = A AND B ABAB Carry Sum XOR AND Half Adder

26 25 Physical Storage

27 26 Physical Storage Techniques Cores Flip-flop (used by SRAM, discussed later) Capacitor (used by DRAM, discussed later)

28 27 Flip-flop Logic gates generate outputs depending on present inputs. Sometime, we want to generate output data by inputs and previous data. Flip-flops can store the data even inputs change.

29 28 Figure 1.3 A simple flip-flop circuit 1 2

30 29 Figure 1.4 (1/3) Setting the output of a flip-flop to 1

31 30 Figure 1.4 (2/3) Setting the output of a flip-flop to 1

32 31 Figure 1.4 (3/3) Setting the output of a flip-flop to 1

33 32 Figure 1.5 Another way of constructing a flip-flop

34 33 Main Memory

35 34 Memory Memory is the circuits to store a lot of bits. The unit (cell) of the memory is “byte”. –A byte is 8 bits.   Size of memory: –1 kilobyte (KB) = 2 10 bytes =1,024 bytes –1 megabyte (MB) = 2 20 bytes = 1,048,576 bytes –1 Gigabyte (GB) = 2 30 bytes –1 Terabyte (TB) = 2 40 bytes Each cell is assigned a unique address.

36 35 Figure 1.7 Memory cells arranged by address 8-bit data : 8 wires to read data 2 16 cells : 16 wires to select cells (cell 0 to cell 65535)

37 36 Figure 1.8 The organization of a byte-size memory cell 8 bits are coded as a byte LSBMSB bit 7 6 5 4 3 2 1 0 

38 37 Memory Address We can identify each cell in a memory by its address. Usually, we count memory cells from addresses 0. Size of address: –If memory size is 2 3 bytes, then we need 3 wires to indicate each cell. –Cell 0, 1,...,7  2 3 bytes 000 001 111  3 wires

39 38 Address and Data

40 39 Computer Architecture

41 40 Memory Operation Two operations on memory: –Read a byte from the memory to CPU –Write a byte from CPU to the memory How memory device know that the CPU want read/write memory cells? –Another control lines can denote the operation.

42 41 Type of Memory ROM (read only memory) –Read-only memory (ROM) is nonvolatile (or permanent). It holds instructions that run the computer when the power is first turned on. RAM (random access memory) –RAM stores data and program code needed by the CPU. The contents of RAM change rapidly and often.

43 42 ROM (read only memory) ROM contains programs and information essential to operation of the computer. –BIOS or storing unchanged programs Used for permanent data which cannot changed by the user Called as nonvolatile memory Data does not lost when power off

44 43 RAM (random access memory) Used for temporary storage of programs that it is running Data lost when power off Called as volatile memory They are two types of RAM: –SRAM (static RAM): cache SRAM does not need to be recharged as often as DRAM, and can hold its contents longer. –DRAM (dynamic RAM): main memory DRAM chips must be recharged with electricity very frequently, or they will lose their contents.

45 44 RAM Size

46 45 Cache Cache memory is high-speed memory that holds the most recent data and instructions that have been loaded by the CPU. Cache is located directly on the CPU or between the CPU and RAM, making it faster than normal RAM. –CPU-resident cache is called Level-1 (L1) cache. –External cache is called Level-2 (L2) cache. The amount of cache memory has a tremendous impact on the computer's speed

47 46 Cache Operation Cache is between the CPU and RAM. More cache implies better performance.

48 47 Memory Hierarchical Register Cache –SRAM Main memory –DRAM Secondary Storage or Auxiliary Memory –Disk CPU Cache Main memory Auxiliary memory fast, expansive, small slow, cheap, large primary memory

49 48 Mass Storage

50 49 Mass Storage Magnetic disks –Floppy –Hard disk CD Magnetic tapes

51 50 Figure 1.9 A disk storage system

52 51 Random particles (no data stored) Current flow (write operation) Organized particles (represent data) Medium Write head Magnetic Disk (1/3)

53 52 As the medium rotates, the head writes the data. Magnetic Disk (2/3)

54 53 Magnetic Disk (3/3) A track is divided to sectors. A set of track is called as a cylinder. Example: Seagate Medalist 3210 has 3.2G bytes –6296 cylinders –16 headers –63 sectors –A sector contains 512 bytes. sector

55 54 Disk Performance Seek time: to move the heads form one track to another. Latency time (Rotation delay) : to rotate disk and let the sector around to the head. Access time = seek time + latency time Date Transfer Time = transfer rate ×the amount of data

56 55 File Storage an Retrieval Physical record: the unit in the mass storage systems –Sector is a continuous string of bits in disk. Logic record: the natural unit of information –A file contains logic records. In each record is the information of one student. –The logic records in a file may not be together in the mass storage. Buffer: a area of memory for temporary storage

57 56 Figure 1.11 Logical records versus physical records on a disk 3 2 1

58 57 Compact Disks CD-DA ( Compact Disc-Digital Audio ) CD-ROM ( Compact Disc Read Only Memory ) Two formats: –CAV (Constant Angular Velocity) –CLV (Constant Linear Velocity)

59 58 CLV CD-ROM 的格式和唱片一樣,從中心到 外緣劃出一條螺旋狀的 Track , Track 上 再切割成一段一段的 Sector 。在每個 Sector 以相同的格式儲存資料。 sector track

60 59 1 0 Read Operation on CD

61 60 CD Speed 原本光碟機一開始是以 CD 唱片的 150Kbytes/sec 傳輸速率讀取 CD 的內容。 光碟機在讀取 CD 的內圈時轉速快( 530 rpm ),外圈轉速慢( 200 rpm )。 所謂 n 倍速光碟機,指的是光碟機資料傳 輸速率是 150Kbytes/sec 傳輸速率的 n 倍。 但除非是循序讀取 CD 的內容,否則光碟 機的 bottleneck 在於讀寫頭的 Seek time , n 倍速不代表整體效能到達 n 倍。

62 61 CD Working Principle 光碟機是用低功率的雷射光照射 CD- ROM ,平面的地方會將雷射反照射回來, 而凹點則會散射, CD-ROM 就是以蝕刻 凹點這種方法來儲存資料。

63 62 Other Spec of CD CD-ROM: 600 MB DVD (Digital Versatile Disk): 1 GB CD-WORM (compact disk-write one, read many)

64 63 Magnetic Tape Sequential storage Time-consuming for moving between different position. Used for off-line data storage - backup.

65 64 Figure 1.10 A magnetic tape storage mechanism

66 65 Access Method On-line Off-line 讀卡機 ( 慢 ) CPU ( 快 ) 印表機 ( 慢 ) 磁帶機 ( 普通 ) 磁帶機 ( 普通 ) 磁帶機 ( 普通 ) 磁帶機 ( 普通 ) 掛上 CPU Disk

67 66 Representation Information

68 67 Information on Computer All of the information on the computer are form of bit string(s). How we representing text, numbers, and image?

69 68 Representing Test ANSI adopted the ASCII - this code uses bit patterns to represent characters. –Look Appendix A and Figure 1.12 –ANSI (American Notional Standards Institute) –ASCII (American Standard Code for Information Interchange) Others coding: Unicode(UTF-16), ISO( International Organization for Standardization), Big5 Content?

70 69 Figure 1.12 The message “Hello.” in ASCII

71 70 Numeric Values Base ten system v.s. base two system (binary system) Transfer between two systems: –Binary to base ten (Figure 1.13, 1.14) –Base ten to binary (Figure 1.15, 1.16) Base 10Base 2 00 11 210 311 4100 5101 6110 7111 81000 91001 101010

72 71 Figure 1.13 The base ten and binary systems 3  10 2 +7  10+5=375 10 1011 2 =1  2 3 +0  2 2 +1  2 1 +1  2 0 =11 10 2021222320212223 10 0 10 1 10 2

73 72 Figure 1.14 Decoding the binary representation 100101

74 73 Figure 1.15 An algorithm for finding the binary representation of a positive integer

75 74 Figure 1.16 Applying the algorithm in Figure 1.15 to obtain the binary representation of thirteen

76 75 Hexadecimal Notation Binary representation ( base 2 ) such as 000111110011 is not readable. –Four bits (i.e., 2 4 = 16 values) are compressed into one hexadecimal digit. –Hexadecimal is base 16, with digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F Hexadecimal notation provides a convenient way for human reading.  

77 76 Figure 1.6 The hexadecimal coding system 0100 1001 1111 0010 2 4 9 F 2 16 Examples –0011 2  3 16 –10110101 2  B5 16 –

78 77 Starting from Zero There are two conventions in everyday life: –Counting items: –Measuring positions between items: The second is often better in Computer Science. 123456 0123456

79 78 The Endian Problem Big endian versus little endian: –name Ian Holyer little –address 3.41 MVB Woodland Rd little –date 1-Jan-98 little –net addr www.cs.bris.ac.uk little –filename /home/staff/ian/file big –number 1024 big What order should the bytes be in a word? –big and little endian computers store 258 as: 00 00 01 02 16 02 01 00 00 -16 (millenium bomb?) (ISO date: big) (USA date middle!) (URL middle!)

80 79 Representing Images Two techniques for representing images: –Bit map techniques –Vector techniques

81 80 Bit Map Technique An image is a collection of dots, each of which is called a pixel. Examples: –*.bmp –Display cards 000000000000000000000 0000000001111000000000 0000001111111100000000 0001111000011110000000 1111000000001111000011 1100000000001111000111 11111111111111100111100 0000000000111101111000 0000000001111011110000 000000001111

82 81 Pictures The color of each pixel has three components: red/green/blue. Each pixel is one color, described by –one bit (monochrome, needs 2 color map) –8 bits (color, needs 256 color map) –24 bits (true color, three 8 bit intensities) 0123456789101112 ( “ a picture is worth a thousand words ” ?)

83 82 Disadvantages of Bit Map The image file has too large size. –Solution: data compression The image cannot be easily rescaled to any arbitrary size.

84 83 Vector Technique An mage is represented as a collection of lines and curves. Provide flexibility in character size. Examples: –TrueType, PostScript –CAD tool Disadvantages: –Not able to provide the photographic quality images L w 245 o 75 o 35% L 45 o

85 84 Sound Sound is described by a single varying intensity. Telephone voice is sampled: 8 bits, 8K times/sec For a HIFI orchestra recording, use more bits per sample, and more frequent samples. Memory 01234 50100255150

86 85 HyperText Plain text is used to describe formats & sources. The World Wide Web (WWW) is a collection of hypertext files, conventions, and programs on the Internet. Heading Here is a picture: Here is a cross-ref: click here Heading Here is a picture: Here is a cross-ref: click here

87 86 Binary System - Operation on Binary Data

88 87 Binary Addition carry bit Figure 1.17: The binary addition facts

89 88 An Addition Example Addition of two binary value: Figure 1.17 Example: Subtraction, multiplication, division? 00111010 00011011 01010101 +

90 89 Fractions in Binary We use a radix point in the same role as the decimal point. Figure 1.18: Decoding the binary 101.101

91 90 Fractions Addition Add tow binary numbers 10.011 and 100.11 10.011 100.11 111.001 + 1. align the radix points 2. apply the same addition process

92 91 Storing Integer

93 92 Notations to Store Integer Given fixed length of memory cells, how to store integers on the computer? –Contain positive and negative integers. –How many values can be distinguishable? Two notational systems, which are based on the binary system: –One’s complement notation (not used) –Two’s complement notation –Excess notation

94 93 Two’s Complement Used most frequently. For example, use 3 or 4 bits to represent one signed integer in Figure 1-19. For a positive integer –As same as the translation from decimal to the binary system. For a negative integer –The algorithm to find the 2’s complement notation is shown and illustrated in Figure 1-20.

95 94 Figure 1.19 (A) Two’s complement notation systems positive negative The most significant bit works as a sign bit. 0: positive 1: negative

96 95 Figure 1.19 (B) Two’s complement notation systems positive negative

97 96 Find the 2’s Complement For a negative integer -n, we can find it 2’s complement by following steps: (n  0) 1. Find the binary notation of n. 2. Toggle n by transferring 0 to 1 and 1 to 0. (That is, its 1’s complement) 3. Add 1 to the number. For example: -n = -6 0110  1001  1001+1 = 1010 n = 6 toggle add 1 result

98 97 Figure 1.20 Coding the value -6 in two’s complement notation using four bits (1) (2) (3) (4) 0 1 1 0 1 0

99 98 2’s and 1’s Complements One’s Complement Notation 0 = 00000000 -0 = 11111111  It is a waste. Two’s Complement Notation 0 = 00000000 1= 00000001 11111110 -1 = 11111111

100 99 Addition in 2’s Complement Apply the same addition algorithm of binary system to 2’s complement addition. Examples are shown in Figure 1.21.

101 100 Figure 1.21 Addition problems converted to two’s complement notation

102 101 Overflow If a integer contains 4 bits, then the range is from -2 4 to 2 4 -1, i.e., -8  7. Overflow: the value to be represented falls outside the range. 1101 (-3) 1000 (-8) 0101 + 1carry 0101 0100 1001 + overflow and error!

103 102 Addition Overflow When an overflow occurs? Let the bits of an integer be D3 D2 D1 D0. Overflow occurs: –If either (D3 carries out of the integer) or (D2 carries to D3), but not both, then the answer is incorrect, else, the answer is correct.

104 103 Subtraction A - B = A + (-B) Find the 2’s complement of -B Add A and (-B) 00001 (1) 11000 (-8) 11001 + -7 00001 (1) 01000 (8) ? -

105 104 Excess Notation Excess notation is another integral notation. Example is shown in Figures 1.22 and 1.23. Excess notation is used in the floating point representation (discussed later).

106 105 Figure 1.22 An excess eight conversion table positive negative

107 106 Figure 1.23 An excess notation system using bit patterns of length time positive negative 011 010 001 000 111 110 101 100 2‘s complement 1

108 107 Find the Excess Notation If we use k bits to denote an integer. For a integer n, we can find it excess notation by following steps: (n  0) 1. Find the 2’s complement of n. 2. Add 2 k-1 to the number (ignoring the carry bit). For example: n = -6, k=4 -6  1010  1010+1000 = 0010 find 2’s complement add 2 3 result

109 108 Homework 1 –Social Issues 1 –Problems 2,5,11,23,28,35,37,39,40,41,42,43

110 109 Floating Point Notation

111 110 Floating Point Floating-point notation is used for storing fraction. It uses three components as shown in Figure 1.24.

112 111 Figure 1.25 (1/2) Coding the value 2 5 / 8. 2 2  0 Exponent 2 has excess code 110 1 1 0

113 112 Figure 1.25 (2/2) Coding the value 2 5 / 8. sign bit:positive= 0negative=1 0 1 1 0 positive

114 113 Truncation Error Also called as round-off error: error due to the fixed length of mantissa field. Example: –17/32 in decimal  0.10001 in binary  01001000 in floating point, data lost! –1/3, 1/10 have infinite terms 0.1 dollar v.s. 10 cents, choose suitable unit! –2 1/2 + 1/8 + 1/8 v.s. 1/8 + 1/8 + 2 1/2 Different orders of addition have different results! We must take care of truncation error.

115 114 Data Compression

116 115 Data Compression Techniques Run-length encoding –3 1s + 5 0s + 7 1s = 111000001111111 Relative encoding –List the difference between consecutive frames Frequency-dependent encoding –The frequently used words are encoded as patterns with shorter lengths. –Huffman code

117 116 Lempel-Ziv Encoding Abraham Lempel and Jacob Ziv A general-purposed compression technique –Example: zip and unzip Figure 1.26 is a LZ77 decoding example. –Simple and Fast!

118 117 Lempel-Ziv Compression An adaptive dictionary encoding –Use pattern match algorithm to find the same string. –Create dictionary of patterns used frequently in the files.

119 118 Data Compression ( 1/6 ) Zip 的壓縮方式 : 欲處理字串為 A A A B A A B C A B C D LZ77 演算法在壓縮或解壓縮資料的時候, 是以一 個以前曾出現過的一段資料來表示目前正在處理 的資料。比如說如果我們要表示第五個字母以後 的資料, 也就是字串 “AABCABCD”, 這時便到該 字串之前的資料, 或稱為已處理過的資料, 也就是 字串 “AAAB” 中, 去尋找有沒有相同的子字串。

120 119 Data Compression ( 2/6 ) Zip 的壓縮方式 : 欲處理字串為 A A A B A A B C A B C D 在這個例子中, 我們可以找到長度為三的相同 字串 "AAB", 而該相同字串起始於原資料的的 二個字元, 於是我們記錄下 (1, 3), 可用來取代原 字串 “AAB”, 其中第一個數字 1 代表起始位置為 第二個字母 ( 在電腦中我們習慣從 0 開始數 ), 第 二個數字 3 代表著該字串長度為三。

121 120 Data Compression ( 3/6 ) Zip 的壓縮方式 : 欲處理字串為 A A A B A A B C A B C D 接著, 為了避免發生在已處理過的資料中, 完全 找不到和目前正在處理的字串完全不相同的窘 境, LZ77 強迫在每處理完一個相同字串後, 便需 傳送一個原始的資料到接收端, 以確保每回至 少都能處理掉一個上的字母。 於是在上面的例子便成為要記錄下 (1, 3, C), 以 取代原來的字串 “AABC”, 其中字母 C 為原資料 中接在字串 “AAB” 之後的字母。

122 121 Data Compression ( 4/6 ) 1. 剛開始, 已處理的字串為空字串, 因此我們無法 在原始資料及已處理字串中找到任何相同的子 字串, 於是我們記錄下第一個字母為 (0,0,A) 。 已處理字串 欲處理資料 編碼 AAABAABCABCD (0, 0, A) 2. 第二步, 已處理字串為 “A”, 原始資料變為 “AABAABCABCD”, 此時可以找到相同的字串 “AA”, 因此我們記錄下該相同字串的起始位置 0 、長度 2 及其後所接的字母 B 。 已處理字串 欲處理資料 編碼 A AABAABCABCD (0, 2, B) 0

123 122 Data Compression ( 5/6 ) 3. 第三步, 已處理字串為 “AAAB”, 原始資料變為 “AABCABCD”, 此時可以找到相同的字串 “AAB”, 因此我們記錄下該相同字串的起始位置 1 、長度 3 及其後所接的字母 C 。 已處理字串 欲處理資料 編碼 A AAB AABCABCD (1, 3, C) 0 1

124 123 Data Compression ( 6/6 ) 4. 已處理字串為 “AAABAABC”, 原始資料變為 “ABCD”, 此時可以找到相同的字串 “ABC”, 因 此我們記錄下該相同字串的起始位置 5 、長度 3 及其後所接的字母 D 。 已處理字串 欲處理資料 編碼 AAABA ABC ABCD (5, 3, D) 0 1 2 3 4 5 5. 而編碼後的資料為 :(0, 0, A), (0, 2, B), (1, 3, C), (5, 3, D) 。 Note: 此法與課本教的方式不完全相同。

125 124 Figure 1.26 Decompressing  (5, 4,  )

126 125 Image Compression Two compression techniques: 1. GIF (Graphic Interchange Format) CompuServe 16 bits/pixel, using pallet 2. JPEG (Joint Photographic Experts Group) loss-less mode and baseline standard MPEG (Motion Picture Experts Group)

127 126 Communication Errors

128 127 Communication Errors Error due to... What kind of error is (not) tolerable? Coding techniques: –To check if error occurs Parity check, checksum, CRC (Cyclic Redundancy Codes) check –To correct the error error-correcting code, Hamming code

129 128 Parity Checking (1/2) Add a redundant bit as the significant bit of the string, such that the new string has odd number of 1s. –See Figure 1.27 If the receiver find that a string has even number of 1s, then discard the string. This mechanism is called as odd parity.

130 129 Parity Checking (2/2) If let the string have even number of 1s, then it is called as even parity. If two bits toggle together, the error can’t be found. Also, we can’t correct the error. However, parity check is very simple. Main memory use the parity checking, too.

131 130 Figure 1.27 Odd parity check

132 131 Error-correcting Use more than one redundant bits to contain more information. Special coding mechanism is used. Figure 1.28 shows a error-correcting code.

133 132 Hamming Distance Define Hamming distance is the number of different relative-position bits between two codes. Example: Distance (A, B) = 4 The Hamming distance between every two codes (in Figure 1-28)  3. A 000000 B 001111 4 differences

134 133 Error Occurs When an received code (010100) does not match any code, we count the distances between the received codes and other codes. –See Figure 1-29. –A and the receive code 010100 has distance = 2. 000000 010100 2 differences A received code

135 134 Figure 1.29 Correcting the received pattern 010100 We guess that 010100 should be 011100, then correct it!

136 135 Limit of Correcting If the Hamming distance between every two codes  5, then we can find 4 bits communication error and correct 2 bits error. We need more redundant bits! Error correcting technique is used in CD- ROM to avoid error.

137 136 Social Issues 1. A truncation error has occurred in a critical situation. Who is liable, if anyone? 5.The ability to alter or fabricate photograph is being placed within the abilities of the general public. What changes will this bring to society? What ethical and legal issues could arise?

138 137 Homework 2 –Social Issues 5 –Problems 45,46,48,56,58,60,62,63


Download ppt "1 Reference Peter Norton’s, Introduction to Computers, 4 th edition, Glencoe McGraw-Hill. Lessons 7 and 9."

Similar presentations


Ads by Google