《计算机导论 进制》由会员分享,可在线阅读,更多相关《计算机导论 进制(54页珍藏版)》请在金锄头文库上搜索。
1、Introduction to Computational Thinking Part III: Computer Science: An Overview Chapter 1: Data Storage,Rui Mao Shenzhen University,Chapter 1: Data Storage,1.1 Bits and Their Storage 1.2 Main Memory 1.3 Mass Storage 1.4 Representing Information as Bit Patterns 1.5 The Binary System 1.6 Storing Intege
2、rs 1.7 Storing Fractions,1.1 Bits and Bit Patterns,Bit(位): Binary Digit (0 or 1) Bit Patterns are used to represent information. Numbers Text characters Images Sound And others,1.1.1 Boolean Operations,Boolean (布尔) Operation: An operation that manipulates one or more true/false values Specific opera
3、tions: AND (与) OR (或) XOR (exclusive or, 异或) NOT (非),Figure 1.1 The Boolean operations AND, OR, and XOR (exclusive or),1.1.2 Gates,Gate (门): A device that computes a Boolean operation Often implemented as (small) electronic circuits Provide the building blocks from which computers are constructed VL
4、SI (Very Large Scale Integration),Figure 1.2 A pictorial representation of AND, OR, XOR, and NOT gates as well as their input and output values,Hexadecimal notation (16进制表示): A shorthand notation for long bit patterns Divides a pattern into groups of four bits each Represents each group by a single
5、symbol Example: 10100011 becomes A3,Figure 1.6 The hexadecimal coding system,1.2 Main Memory (主存、内存),Cell: A unit of main memory (typically 8 bits which is one byte(字节) Most significant bit: the bit at the left (high-order) end of the conceptual row of bits in a memory cell Least significant bit: th
6、e bit at the right (low-order) end of the conceptual row of bits in a memory cell Might be the other way for some machines,1.2.1 Memory organization Figure 1.7 The organization of a byte-size memory cell,Main Memory Addresses,Address: A “name” that uniquely identifies one cell in the computers main
7、memory The names are actually numbers. These numbers are assigned consecutively starting at zero. Numbering the cells in this manner associates an order with the memory cells.,Figure 1.8 Memory cells arranged by address,Memory Terminology,Random Access Memory (RAM): Memory in which individual cells
8、can be easily accessed in any order Dynamic Memory (DRAM): RAM composed of volatile memory,1.2.2 Measuring Memory Capacity,Bit (位) Byte (字节): 8 bits Word(字): usually a few bytes, machine-dependent Kilobyte: 210 bytes = 1024 bytes103, 千 Example: 3 KB = 3 times1024 bytes Megabyte: 220 bytes = 1,048,57
9、6 bytes106 ,百万 Gigabyte: 230 bytes = 1,073,741,824 bytes109 ,十亿 Terabyte: 240 bytes 1012 ,万亿 Petabyte: 250 bytes 1015 ,千万亿,1.3 Mass Storage (海量存储),On-line versus off-line Typically larger than main memory Typically less volatile than main memory Typically slower than main memory,Mass Storage Systems
10、,Magnetic Systems Disk Tape Optical Systems CD DVD Flash Drives,Figure 1.9 A magnetic disk storage system,Figure 1.10 Magnetic tape storage,Figure 1.11 CD storage,1.4 Representing Information as Bit Patterns 1.4.1 Representing Text,Each character (letter, punctuation, etc.) is assigned a unique bit
11、pattern. ASCII(American Standard Code for Information Interchange ): Uses patterns of 7-bits to represent most symbols used in written English text Unicode: Uses patterns of 16-bits to represent the major symbols used in languages world side ISO standard: Uses patterns of 32-bits to represent most s
12、ymbols used in languages world wide,upper b6b5b4,lower b3b2b1b0,ASCII codes,1.4.2 Representing Numeric Values,Binary notation: Uses bits to represent a number in base two Limitations of computer representations of numeric values Overflow occurs when a value is too big to be represented Truncation oc
13、curs when a value cannot be represented accurately,1.4.3 Representing Images,Bit map (位图) techniques Pixel (像素): short for “picture element” RGB Luminance and chrominance Vector techniques Scalable TrueType and PostScript,1.4.4 Representing Sound,Sampling techniques,Figure 1.14 The sound wave repres
14、ented by the sequence 0, 1.5, 2.0, 1.5, 2.0, 3.0, 4.0, 3.0, 0,1.5 The Binary System,The traditional decimal system is based on powers of ten.The Binary system is based on powers of two.,1.5.1 Binary notation Figure 1.15 The base ten and binary systems,1.5.2 Binary addition Figure 1.19 The binary add
15、ition facts,1.5.3 Binary vs. decimal Figure 1.16 Decoding the binary representation of 100101,Figure 1.17 An algorithm for finding the binary representation of a positive integer,Figure 1.18 Applying the algorithm in Figure 1.15 to obtain the binary representation of thirteen,Decimal to binary,Integ
16、er: 除2取余(逆序) Fraction: 乘2取整(顺序),Figure 1.20 Decoding the binary representation 101.101,1. 进位记数制的要素:基数:指各种进位记数制中允许选用基本数码的个数。例如十进制的数码有:0,1,2,3,4,5,6,7,8,9基数是10位权:每个数码所表示的数值等于该数码乘以一个与数码所在位置相关的常数,这个常数叫做权值。例如:123.41102+2101+3100 +410-1,1.5.4 General forms,2.几种进位记数制,an-1an-2a1a0.a-1a-m,几种进制数之间的对应关系,3.不同进制数的相互转换二进制数与十进制数的互换人十进制,计算机二进制二进制数转换成十进制数按权展开,然后求和,就可把二进制数转换成十进制数。例如:(101.1)21*22+0*21+1*20+1*2-1( ? )10,十进制数转换成二进制数十进制数有整数和小数两部分。在转换时,整数部分采用除2取余法小数部分采用乘2取整法然后通过小数点将转换后的二进制数连接起来即可。例如:(105.625)10=(?)2,