从PC的外部看,最显眼的组成部件是主机、键盘、鼠标和显示器。在主机的前面是一些按钮和一个小的展示区,在这个展示区上有一些数字和一个软盘。现在的大多数系统还拥有一个CD ROM,如果你需要保护你的数据,那么会有备份用的磁带机。这些都被称为外部设备。
尽管CPU全面地控制着系统,但它不是唯一的智能设备。例如,在这些外设中,IDE控制器也有某种程度的智能。在PC内部(图1.1)有一块主板,上面有CPU或微处理器,内存和多个槽(ISA或PCI外设控制器)。一部分控制器,例如IDE 磁盘控制器可能会被直接嵌在系统板上。
1.1 CPU
CUP,或者微处理器,是计算机系统的核心。微处理器通过从内存读入的指令来计算、处理逻辑操作和管理数据流。早期在CPU这一名词诞生的时候,微处理器计算功能的组件是分离的单元(实际上很大)。现代微处理器将这些组件组合到一块电路板上,并将这块电路蚀刻在一块很小的硅晶体上。(CUP、微处理器、和处理器在这本书里是同一意思)。
微处理器处理的对象是二进制数据,这些二进制数据有1和0组成。这些1和0对应电子元件的开和关。就像十进制的42代表4个10和2个1一样,一个二进制数是一系列单个二进制数组成的,其中每位代表2的一个次方(原文power,代表数字被自身乘)10的一次方是10,10的二次方是10*10,10的三次方是10*10*10,以此类推。二进制的0001是十进制的1,二进制的0010是十进制的2,二进制的0011是3,二进制的0100是4,可往下依次类推。所以,十进制的42是二进制的101010 (2 + 8 + 32 or 21 + 23 + 25 ) 。计算机程序中除了用二进制来代表数字之外,十六进制也很常用。
附:
Looking at a PC from the outside, the most obvious components are a system box, a keyboard, a mouse and a video monitor. On the front of the system box are some buttons, a little display showing some numbers and a floppy drive. Most systems these days have a CD ROM and if you feel that you have to protect your data, then there will also be a tape drive for backups. These devices are collectively known as the peripherals.
Although the CPU is in overall control of the system, it is not the only intelligent device. All of the peripheral controllers, for example the IDE controller, have some level of intelligence. Inside the PC (Figure 1.1) you will see a motherboard containing the CPU or microprocessor, the memory and a number of slots for the ISA or PCI peripheral controllers. Some of the controllers, for example the IDE disk controller may be built directly onto the system board.
1.1 The CPU
The CPU, or rather microprocessor, is the heart of any computer system. The microprocessor calculates, performs logical operations and manages data flows by reading instructions from memory and then executing them. In the early days of computing the functional components of the microprocessor were separate (and physically large) units. This is when the term Central Processing Unit was coined. The modern microprocessor combines these components onto an integrated circuit etched onto a very small piece of silicon. The terms CPU, microprocessor and processor are all used interchangeably in this book.
Microprocessors operate on binary data; that is data composed of ones and zeros.
These ones and zeros correspond to electrical switches being either on or off. Just as 42 is a decimal number meaning ``4 10s and 2 units'', a binary number is a series of binary digits each one representing a power of 2. In this context, a power means the number of times that a number is multiplied by itself. 10 to the power 1 ( 101 ) is 10, 10 to the power 2 ( 102 ) is 10x10, 103 is 10x10x10 and so on. Binary 0001 is decimal 1, binary 0010 is decimal 2, binary 0011 is 3, binary 0100 is 4 and so on. So, 42 decimal is 101010 binary or (2 + 8 + 32 or 21 + 23 + 25 ). Rather than using binary to represent numbers in computer programs, another base, hexadecimal is usually used.