6.2.2 计算机如何工作

更新于 2026年11月27日 版权声明
6.2.2 计算机如何工作

How Does a Computer Work

Let us use the system shown in figure 6-1 to show you how a typical computer works.A computer is controlled by a stored program,so if we want to use a computer,the first step is copying the program from diskette into memory.Now the processor can begin executing instructions;the data input from the keyboard are stored in memory.The processor processes the data and then stores the results back into memory.At last,we can get the result.

图示

Figure 6-1 Computer system

Now we can see that a computer system consists of four basic components.An input device provides data.The data are stored in memory,which also holds a program.Under the controls of the program,the computer's processor processes the data.The results flow from the computer to an output device.Let us introduce the system components one by one,beginning with the processor.

The processor,usually called the central processing unit(CPU)or main processor,is the heart of a computer.It is the CPU that in fact processes or manipulates data and controls all the rest parts of the computer.How can it manage its job?The secret is software.Without a program to provide control,a CPU can do nothing.How can a program guide the CPU through the processes?Let us consider from the basic element of a program—instruction.

An instruction is composed of two parts:an operation code and one or more operands(figure 6-2).The operation codes tell the CPU what to do and the operands tell the CPU where to find the data to be manipulated.

图示

Figure 6-2 Instruction

The processor contains four major components(figure 6-3):a clock,an instruction control,an arithmetic and logic unit(usually shortened ALU)and several registers.The clock generates precisely timed pulses of current that synchronize the processor's other components.Then the instruction control unit determines the location of the next instruction to be executed and fetches it from the main memory.The arithmetic and logic unit performs arithmetic operations(such as addition and subtraction)and logic operations(such as testing a value to see if it is true or false),while the registers are temporary storage devices that hold control information,key data and some intermediate results.Since the registers are located in the CPU(figure 6-4),the processing speed is faster than the main memory.Then which is the key component to a computer's speed?It is the clock!In more detail,it is the clock's frequency that decides a computer's processing speed.When we buy a computer,we usually consider the main frequency first,and that means a clock's frequency.

图示

Figure 6-3 Processor's four major components

Transistors are the basic building blocks of microprocessors.A single microchip may contain millions of transistors.When electric current is allowed to pass through,the switch is on.This represents 1 bit.If the current does not pass through,the switch is off.This represents 0 bit.Different combinations of transistors represent different combinations of bits,which are used to represent special characters,letters,and digits.(https://www.daowen.com)

图示

Figure 6-4 CPU

We often hear of input/output system(or I/O),What's the I/O system?In computing,I/O is the communication between an information processing system(such as a computer)and the outside world.Inputs are the signals or data received by the system,and outputs are the signals or data sent from it.I/O devices are used by a person(or other system)to communicate with the computer.For example,The keyboard and the mouse(figure 6-5)may be an input devices for the computer,while monitors(figure 6-6)and printers are considered output devices.Modem(figure 6-7)and network interface cards(NIC figure 6-8)typically serve for both input and output devices.

图示

Figure 6-5 Keyboard and mouse

图示

Figure 6-6 Monitors

图示

Fi ure 6-7 Modem

图示

Fi ure 6-8 NIC

The mouse and the keyboard take as input physical devices.The user use them input the information,and the Input devices convert it into the signal that a computer can understand.The output information from these devices is input for the computer.Similarly,the printer and the monitor take as input signal that a computer output.They convert these signals into symbols that the user can see or read.These interactions between the computer and the user are called human-computer interaction.Memory is the devices that the CPU can read and write to directly,with individual instructions.In computer architecture,the combination of the CPU and the main memory is considered the brain of a computer.and from that point of view any transfer of information from or to that combination,for example to or from a disk drive,is considered I/O.The CPU and its supporting circuitry provide memory-mapped I/O that is used in low-level computer programming,such as the implementation of device drivers.An I/O algorithm is one designed to exploit locality and perform efficiently when data reside on secondary storage,such as a disk drive.A computer uses memory-mapped I/O accesses hardware by reading and writing to specific.

A computer uses memory-mapped I/O accesses hardware by reading and writing to specific memory locations,using the same assembly language instruction that computer would normally use to access memory.

✍AI写作