Presentation is loading. Please wait.

Presentation is loading. Please wait.

COMPUTER SCIENCE AN OVERVIEW.

Similar presentations


Presentation on theme: "COMPUTER SCIENCE AN OVERVIEW."— Presentation transcript:

1 COMPUTER SCIENCE AN OVERVIEW

2 Q & A

3 Question: What can I do if I can’t understand the text?

4 College is quite different from high school, you have to learn by yourself ! Do not rely on teachers! Learning method: Look up the new words in the dictionary; Use the library; Discuss with other students; Use the reference books; Search related knowledge online.

5

6

7 Question: Are we learning English or Computer Science?

8 We learn both. But computer technology is more important!

9 Class Review

10 The Study of Algorithms
An algorithm is a set of steps that defines how a task is performed. In the domain of computing machinery, algorithms are represented as programs within computers.

11 The Role of Abstraction
Abstraction - the distinction between the external properties of a component and the internal details of the component’s construction. It is abstraction that allows us to ignore the internal details of a complex device and use it as a single, comprehensible unit.

12 Figure 0.6: The hierarchy of abstraction in the hardware of a typical personal computer

13 Vocabulary

14 Part I: Machine Architecture

15 A major process in the development of a science is the construction of theories that are confirmed or rejected by experimentation. In some cases these theories lie dormant for extended periods, waiting for technology to develop to the point that they can be tested.

16 Ch. 1 Data Storage Storage of bits. First class Main memory.
Mass storage. Coding information for storage. The binary system. Storing integers. Storing Fractions. Communication errors. First class Second class

17 1.1 Bits and Their Storage Bit (binary digit ):
is either one of two digits : 0 or 1 Here 0 or 1 is just a symbol Unnecessarily has digital meaning

18 Boolean Operations AND (与) P AND Q both P and Q
P is a statement, and Q is other a statement, each has value True or False, represented by 1, and 0 respectively .

19 Boolean Operations OR P OR Q at least one of P and Q is True XOR P XOR Q at least one of P and Q is True But not both

20 Figure 1.1: The Boolean operations AND, OR, and XOR (exclusive or)

21 Gates are devices that produce the output of a Boolean operation when given the operation’s input values. A flip-flop is a circuit that has one of two output values (i.e., 0 or 1), the output will flip or flop between two values under control of external stimuli. A flip-flop is ideal for the storage of a bit within a computer (on a single wafer or chip). A flip-flop loses data when its power is turned off.

22 Figure 1.2: A pictorial representation of AND, OR, XOR, and NOT gates as well as their input and output values (continued) copy to blackboard

23 Figure 1.2: A pictorial representation of AND, OR, XOR, and NOT gates as well as their input and output values

24 Figure 1.3: A simple flip-flop circuit

25 Figure 1.4: Setting the output of a flip-flop to 1 (continued)
1

26 Figure 1.4: Setting the output of a flip-flop to 1 (continued)

27 Figure 1.4: Setting the output of a flip-flop to 1

28 Temporarily placing the value 1 on the lower input
1

29 This output will persist after the input value returns to 0
1 1

30 A flip-flop is a circuit that produces an output value of 0 or 1 that remains constant until a temporary pulse from another circuit causes it to shift to the other value.

31 The significance of a flip-flop is that it is ideal for the storage of a bit within a computer. The value stored in it is the output value of the flip-flop. Other circuits can easily adjust this value by sending pulses to the flip-flop’s inputs.

32 Figure 1.5: Another way of constructing a flip-flop
First study it by yourself!

33 Figure 1.5: Another way of constructing a flip-flop
1 1

34 Figure 1.5: Another way of constructing a flip-flop
1 1 1 1

35 Representing Numeric Value
anBn+a(n-1)  Bn-1+…+a1 B1 +a0 B0 B is called base n is called position quantity an is called digit

36 (101)10=1 × 102+0×101+1×100 (101)2=1×22+0×21+1×20 = (5)10 (101)16=1×162+0×161+1×160 =(257)10

37 The hexadecimal coding system
It is used to simplify the representation of long bit patterns of a stream. It takes advantage of the fact that bit patterns within a machine tend to have lengths in multiples of four.

38 Figure 1.6: The hexadecimal coding system
There’s a mistake in our textbook (10)10=(A)16 (11)10=(B)16 (12)10=(C)16 (13)10=(D)16 (14)10=(E)16 (15)10=(F)16

39 The hexadecimal coding system
=> A4C8 A 4 C 8 This is obtained by dividing the bit pattern into substrings of length four and then representing each substring by its hexadecimal equivalent.

40 1.2 Main Memory Cells - a typical cell size is 8 or called byte.
A byte (B) consists of a grouping of eight binary digits ("bits"), and is typically considered the smallest addressable unit of data. Address is used to identify individual cells in a main memory.

41

42 Random access memory (RAM)(随机存储器 ).
Read only memory (ROM)(只读存储器 ). Most significant bit (MSB) and least significant bit (LSB).

43 If you want a larger playing field in real life, you have to add onto the field by acquiring more property. With RAM, you do this by adding additional memory. In most cases, this memory comes in the form of "RAM sticks," small rectangular cards studded with memory modules.

44

45 ROM is a type of unchangeable memory residing in chips on your mother board. ROM contains the bare minimum of instructions needed to start your computer. Because it's used for critical functions, it can't be removed short of ripping it out of the motherboard; adding to it is just as difficult. Incidentally, the term "ROM" is also used, not entirely correctly, when referring to some kinds of storage media, that can't be modified, such as CD-ROMs.

46 Figure 1.7: The organization of a byte-size memory cell

47 Address is used to identify individual cells
in a main memory.

48 Figure 1.8: Memory cells arranged by address

49 1.3 Mass Storage Secondary memory.
Storing large units of data (called files). Mass storage systems are slow due to mechanical motion requirement. On-line Vs. off-line operations.

50 Figure 1.9: Memory cells arranged by address
找一幅动画

51 Disk Device Terminology
Outer Track Inner Arm Head Sector Platter Actuator Several platters, with information recorded magnetically on both surfaces (usually) Bits recorded in tracks, which in turn divided into sectors (e.g., 512 Bytes) Actuator(致动器) moves head (end of arm,1/surface) over track (“seek”), select surface, wait for sector rotate under head, then read or write “Cylinder”: all tracks under heads

52 Figure 1.10: CD storage format
靠激光照射反射

53 Figure 1.11: A magnetic tape storage mechanism

54 Figure 1.12: Logical records versus physical records on a disk

55 Seek Time : the time required to move the read/write head from one track to another; Rotation Delay: ( latency time ) half the time required for the disk to make a complete rotation.which is the average amount of time required for the desired data to rotate around to the r/w head once the head has been positioned over the rotated track.

56 Access Time the sum of seek time and rotation delay. Transfer Rate : the rate at which data can be transferred to or from the disk.

57 1.4 Representing Information as Bit Patterns
Representing Text By means of code in which each of the symbols in the text is assigned a unique bit pattern.

58 Text Coding System American Standard Code for Information Interchange (ASCII) - 8-bit codes.-APPENDIX A International Standards Organization (ISO) - 16-bit codes. ( Unicode ) 32-bit code

59 Figure 1.13: The message “Hello.” in ASCII

60 A practice:

61 Representing Numeric Value
Binary-decimal number conversion Numeric Value : anBn+a(n-1)  Bn-1+…+a1 B1 +a0 B0 B is called base n is called position quantity an is called digit

62 Figure 1.14: The base ten and binary systems

63 Figure 1.15: Decoding the binary representation 100101

64

65 Figure 1.16: An algorithm for finding the binary representation of a positive integer

66 Figure 1. 17: Applying the algorithm in Figure 1
Figure 1.17: Applying the algorithm in Figure 1.15 to obtain the binary representation of thirteen

67 Class practice: Convert the following base ten representation to its equivalent binary form: 27

68 Representing Images

69 Representing Images – Two ways
I) Bit maps representation - Tag Image An image is considered as to be a collection of dots ,each of which is called a pixel,short for “ picture element” In its simple form, an image is represented as a long string of bits representing the rows of pixels in the image, where each bit is either 1 or 0 depending on whether the corresponding pixel in image is black or white.

70 II) Vector Representing
Each image is represented as a collection of lines and curves .Such description leaves the detail of how the lines and curves are drawn to the device.

71 Three-byte-per-pixel (P40)
Image types: Format File (TIFF), Graphic Interchange Format (GIF), Joint Photographs Experts Group (JPEG).

72 Representing Sound The most generic method of encoding audio information for computer storage and manipulation is to sample the amplitudeof the sound wave at regular intervals and record the series of values obtained.

73 Figure 1. 18: The sound wave represented by the sequence 0, 1. 5, 2

74 Homework P26 1,4,5,6,7 P29 1,2,3 P42 5,6,7,8,10

75 Rules Copy the questions Write in neat words Hand in on next class
If you don’t know the answer, try some research.

76 Vocabulary

77 COMPUTER SCIENCE AN OVERVIEW

78 Vocabulary

79 Q & A

80 I feel the contents are very discrete, I don’t know how to grasp them.

81 Your advice is welcomed!
We are doing an overview, we have to deal with almost all topics in computer science. I will try to connect them as close as I can. Your advice is welcomed!

82 Class Review

83 Bits and Their Storage Bit (binary digit ):
is either one of two digits : 0 or 1 Here 0 or 1 is just a symbol Unnecessarily has digital meaning

84 Figure 1.1: The Boolean operations AND, OR, and XOR (exclusive or)

85 Figure 1.2: A pictorial representation of AND, OR, XOR, and NOT gates as well as their input and output values (continued) 用抽象的符号来表示这些运算电路

86 Figure 1.2: A pictorial representation of AND, OR, XOR, and NOT gates as well as their input and output values

87 Figure 1.3: A simple flip-flop circuit
计算机里面存储0,1 A flip-flop is a circuit that produces an output value of 0 or 1 that remains constant until a temporary pulse from another circuit causes it to shift to the other value.

88 Representing Numeric Value
anBn+a(n-1)  Bn-1+…+a1 B1 +a0 B0 B is called base n is called position quantity an is called digit

89 (101)10=1 × 102+0×101+1×100 (101)2=1×22+0×21+1×20 = (5)10 (101)16=1×162+0×161+1×160 =(257)10

90 Figure 1.6: The hexadecimal coding system
多位存储的简化表示

91 The hexadecimal coding system
=> A4C8 A 4 C 8 This is obtained by dividing the bit pattern into substrings of length four and then representing each substring by its hexadecimal equivalent.

92 Main Memory Storage Type
Cell- a typical cell size is 8 or called byte. A byte (B) consists of a grouping of eight binary digits ("bits"), and is typically considered the smallest addressable unit of data. Address is used to identify individual cells in a main memory. 计算机里面怎么存储

93 Figure 1.8: Memory cells arranged by address

94 Figure 1.7: The organization of a byte-size memory cell

95 Measuring Memory Capacity
1 Byte = 8 Bit 1 KB(kilobyte)= 1024 (which is 210)Byte 1 MB(megabyte)= 1024 KB 1 GB(gigabyte)= 1024 MB 1 TB(terabyte)= 1024 GB

96 Main Memory Random access memory (RAM) Read only memory (ROM)
Most significant bit (MSB) and least significant bit (LSB). 存储在哪里

97 Mass Storage Secondary memory.
Storing large units of data (called files). Mass storage systems are slow due to mechanical motion requirement. On-line Vs. off-line operations.

98 What’s Inside A Disk Drive?

99 1.4 Representing Information as Bit Patterns
Representing Text Representing Image Representing Sound

100 Representing Text in ASCII

101 Representing Images Bit maps representation Vector Representing

102 Representing Sound

103 1.5 Binary System Binary addition. Fractions in binary.
Radix point (same as decimal point in decimal notation).

104 (101)10=1 × 102+0×101+1×100 (101)2=1×22+0×21+1×20 = (5)10 (101)16=1×162+0×161+1×160 =(257)10

105 Figure 1.19: The binary addition facts

106 Practice:

107 Fractions in Binary Radix point (same as decimal point in decimal notation).

108 Figure 1.20: Decoding the binary representation 101.101
黑板画图表示

109

110 Practice: Convert the following binary representation to its equivalent base ten form:

111 Transform the fraction 0.875 to binary
Example Transform the fraction to binary Solution Write the fraction at the left corner. Multiply the number continuously by 2 and extract the integer part as the binary digit. Stop when the number is 0.0.     0.0

112 Transform the fraction 0.4 to a binary of 6 bits.
Example Transform the fraction 0.4 to a binary of 6 bits. Solution Write the fraction at the left corner. Multiply the number continuously by 2 and extract the integer part as the binary digit. You can never get the exact binary representation. Stop when you have 6 bits. 0.4       1.6

113 1.6 Storing Integers Excess notation Two’s complement notation
Addition in two’s complement notation. Overflow problem. Memory size Vs. accuracy of number representation.

114 Two’s Complement Notation
In two’s complement system , there is a convenient relationship between the patterns representing positive and negative values of the same magnitude. They are identical when read from right to left up to and including the first 1.From then on,the patterns are complements of one another.

115 Figure 1.21: Two’s complement notation systems

116 Figure 1. 22: Coding the value -6 in two’s
Figure 1.22: Coding the value -6 in two’s complement notation using four bits

117 Representing negative numbers in two’s complement

118 Class practice Convert the base ten form -16 to two‘s complement representation using patterns of length eight. First, we convert its positive part to binary form using patterns of length eight. Second, we have two ways: 1) invert each bit and add 1. 2) copy the bits from right to left until a 1 has been copied and invert the remaining bits.

119 Class practice Convert the two's complement representation to its equivalent base ten form. First, we get that it’s a negative value. Second, we try to find it’s positive counterpart.

120 Figure 1.23: Addition problems converted to two’s complement notation

121 Summary of Two’s Complement

122

123 Example of Overflow: 5+4: 0101+0100 = 1001 The hospital example (P49)

124 Note that the difference between an excess system and a two’s complement system is that the sign bits are reversed. What’s the difference between an excess system and a two’s complement system?

125 Figure 1.24: An excess eight conversion table

126

127 Figure 1. 25: An excess notation system using bit
Figure 1.25: An excess notation system using bit patterns of length three

128 1.7 Storing Fractions

129 1.7 Storing Fractions Floating Point Notation Exponent Field
Mantissa Field

130 Figure 1.26: Floating-point notation components

131 Example: Suppose one byte contains bit pattern , we get mantissa 1011,and put radix point on its left side ,then we obtain The exponent field is 110,it means 2 (three bit excess method ),so, we move radix point two places to right,and get result It is 2 ¾.

132 Attention: ( Normalized Form )
When we fill the mantissa field , the rule is to copy the bit pattern appearing in the binary representation from left to right ,starting with the leftmost 1. Storing 3/8, which is .011 in binary notation, in this case ,the mantissa will be 1100, it will not be 0110

133 Class practice Convert the following value into floating-point format:
23/4 First get its binary representation, both its integer part and fraction part. Second, when we fill the mantissa field , copy the bit pattern appearing in the binary representation from left to right ,starting with the leftmost 1. Answer: Third, use three bit excess method to get the exponent field(+2).

134 Truncation Errors also called Round off Error 1. use longer mantissa field (usually, 32bits are used to store floating point value ) 2. Non-terminating expansion, like to express 1/3 in decimal point notation

135 Figure 1.27: Coding the value 2 5/8

136 Q & A

137 Question 1: When I’m given a string of binary numbers, how do I know it’s in what notation?

138 Question2: When are these different notations are used?

139 Question 3: I still don’t understand the conversion between base ten form and floating-point notation.

140 Question 4 about the content in page 55

141 Class Review

142 Practice Decode the following bit pattern using the floating-point format.

143 Practice Encode the following values into the floating-point format.
-31/2

144 1.8 Data Compression Run length encoding Relative encoding Frequency-dependent encoding Variable length code Huffman code Adaptive dictionary encoding Lempel-Ziv encoding

145 Figure 1.28: Decompressing xyxxyzy (5, 4, x) using LZ77

146 1.9 Communication Errors How can you make sure the information you receive is correct??? Coding techniques for error detection and correction. Parity bits. Error-correcting codes.

147 Parity Bits Odd parity Even Parity Checkbyte Hamming Distance

148 Figure 1.29: The ASCII codes for the letters A and F adjusted for odd parity

149 Figure 1.30: An error-correcting code

150 Figure 1.31: Decoding the pattern 010100 using the code in Figure 1.30

151 Assignments: Page42 4, Page46 1,2,3,4, 5
Write down your student number on the cover. Write down the steps. Write down in neat words, with neat cover Hand in your homework next Wednesday. View the chapter review problems by yourself.

152 Q & A

153 Q1. I still don’t understand the Hamming Distance

154 Q2. Where’s the previous content stored in the cell number after exchanged with another one?

155 Q3. Can we have the vocabulary?

156 Q4. Why the other class is slower?

157 Related Readings 1.5 1.6 1.7 P52-P54 1.9 P62 Figure 1.29, Figure 1.30, Figure 1.31

158 The content you need to grasp:
A) Bits And Their Representation; Main Memory; Representing Information as Bit Patterns; B) Storing Integer;;Storing Fractions; C) Data Compression;The Binary System;


Download ppt "COMPUTER SCIENCE AN OVERVIEW."

Similar presentations


Ads by Google