Computer System
定义
计算机系统由计算机硬件和软件两部分组成。硬件包括中央处理机、存储器和外部设备等;软件是计算机的运行程序和相应的文档。计算机系统具有接收和存储信息、按程序快速计算和判断并输出处理结果等功能。[1]
“A computer is a general-purpose device that can be programmed to carry out a set of arithmetic or logical operations automatically. Since a sequence of operations can be readily changed, the computer can solve more than one kind of problem.
Conventionally, a computer consists of at least one processing element, typically a central processing unit (CPU), and some form of memory. The processing element carries out arithmetic and logic operations, and a sequencing and control unit can change the order of operations in response to stored information. Peripheral devices allow information to be retrieved from an external source, and the result of operations saved and retrieved.”[2]
基本结构
CPU
The control unit (often called a control system or central controller) manages the computer's various components; it reads and interprets (decodes) the program instructions, transforming them into control signals that activate other parts of the computer.[61] Control systems in advanced computers may change the order of execution of some instructions to improve performance.
A key component common to all CPUs is the program counter, a special memory cell (a register) that keeps track of which location in memory the next instruction is to be read from.[62]
The control system's function is as follows—note that this is a simplified description, and some of these steps may be performed concurrently or in a different order depending on the type of CPU:
- Read the code for the next instruction from the cell indicated by the program counter.
- Decode the numerical code for the instruction into a set of commands or signals for each of the other systems.
- Increment the program counter so it points to the next instruction.
- Read whatever data the instruction requires from cells in memory (or perhaps from an input device). The location of this required data is typically stored within the instruction code.
- Provide the necessary data to an ALU or register.
- If the instruction requires an ALU or specialized hardware to complete, instruct the hardware to perform the requested operation.
- Write the result from the ALU back to a memory location or to a register or perhaps an output device.
- Jump back to step (1).
逻辑结构
Block diagram of a basic uniprocessor-CPU computer.
Black lines indicate data flow, whereas red lines indicate control flow; arrows
indicate flow directions.
物理结构
Die of an Intel 80486DX2 microprocessor (actual size: 12×6.75 mm) in its packaging
运行
The fundamental operation of most CPUs, regardless of the physical form they take, is to execute a sequence of stored instructions called a program. The instructions are kept in some kind of computer memory. There are three steps, also known as instruction cycle, that nearly all CPUs follow in their operation: fetch, decode, and execute.
Fetch
The first step, fetch, involves retrieving an instruction (which is represented by a number or sequence of numbers) from program memory. The instruction's location (address) in program memory is determined by a program counter (PC), which stores a number that identifies the address of the next instruction to be fetched. After an instruction is fetched, the PC is incremented by the length of the instruction so that it will contain the address of the next instruction in the sequence.[d] Often, the instruction to be fetched must be retrieved from relatively slow memory, causing the CPU to stall while waiting for the instruction to be returned. This issue is largely addressed in modern processors by caches and pipeline architectures (see below).
Decode
The instruction that the CPU fetches from memory determines what the CPU will do. In the decode step, performed by the circuitry known as the instruction decoder, the instruction is converted into signals that control other parts of the CPU.
The way in which the instruction is interpreted is defined by the CPU's instruction set architecture (ISA).[e] Often, one group of bits (that is, a "field") within the instruction, called the opcode, indicates which operation is to be performed, while the remaining fields usually provide supplemental information required for the operation, such as the operands. Those operands may be specified as a constant value (called an immediate value), or as the location of a value that may be a processor register or a memory address, as determined by some addressing mode.
In some CPU designs the instruction decoder is implemented as a hardwired, unchangeable circuit. In others, a microprogram is used to translate instructions into sets of CPU configuration signals that are applied sequentially over multiple clock pulses. In some cases the memory that stores the microprogram is rewritable, making it possible to change the way in which the CPU decodes instructions.
Execute
After the fetch and decode steps, the execute step is performed. Depending on the CPU architecture, this may consist of a single action or a sequence of actions. During each action, various parts of the CPU are electrically connected so they can perform all or part of the desired operation and then the action is completed, typically in response to a clock pulse. Very often the results are written to an internal CPU register for quick access by subsequent instructions. In other cases results may be written to slower, but less expensive and higher capacity main memory.
For example, if an addition instruction is to be executed, the arithmetic logic unit (ALU) inputs are connected to a pair of operand sources (numbers to be summed), the ALU is configured to perform an addition operation so that the sum of its operand inputs will appear at its output, and the ALU output is connected to storage (e.g., a register or memory) that will receive the sum. When the clock pulse occurs, the sum will be transferred to storage and, if the resulting sum is too large (i.e., it is larger than the ALU's output word size), an arithmetic overflow flag will be set.
I/O
总线
总线(Bus)是计算机各种功能部件之间传送信息的公共通信干线,它是由导线组成的传输线束, 按照计算机所传输的信息种类,计算机的总线可以划分为数据总线、地址总线和控制总线,分别用来传输数据、数据地址和控制信号。总线是一种内部结构,它是cpu、内存、输入、输出设备传递信息的公用通道,主机的各个部件通过总线相连接,外部设备通过相应的接口电路再与总线相连接,从而形成了计算机硬件系统。在计算机系统中,各个部件之间传送信息的公共通路叫总线,微型计算机是以总线结构来连接各个功能部件的。
如果说主板(Mother Board)是一座城市,那么总线就像是城市里的公共汽车(bus),能按照固定行车路线,传输来回不停运作的比特(bit)。这些线路在同一时间内都仅能负责传输一个比特。因此,必须同时采用多条线路才能传送更多数据,而总线可同时传输的数据数就称为宽度(width),以比特为单位,总线宽度愈大,传输性能就愈佳。总线的带宽(即单位时间内可以传输的总数据数)为:总线带宽 = 频率 x 宽度(Bytes/sec)。当总线空闲(其他器件都以高阻态形式连接在总线上)且一个器件要与目的器件通信时,发起通信的器件驱动总线,发出地址和数据。其他以高阻态形式连接在总线上的器件如果收到(或能够收到)与自己相符的地址信息后,即接收总线上的数据。发送器件完成通信,将总线让出(输出变为高阻态)。
总线按功能和规范可分为五大类型:
●数据总线(Data Bus):在CPU与RAM之间来回传送需要处理或是需要储存的数据。 ●地址总线(Address Bus):用来指定在RAM(Random Access Memory)之中储存的数据的地址。 ●控制总线(Control Bus):将微处理器控制单元(Control Unit)的信号,传送到周边设备,一般常见的为 USB Bus和1394 Bus。 ●扩展总线(Expansion Bus):可连接扩展槽和电脑。 ●局部总线(Local Bus):取代更高速数据传输的扩展总线。
总线特性
(1)物理特性:
(2)功能特性:
功能特性是指每一根信号线的功能,如地址总线用来表示地址码。数据总线用来表示传输的数据,控制总线表示总线上操作的命令、状态等。
(3)电气特性:
电气特性是指每一根信号线上的信号方向及表示信号有效的电平范围,通常,由主设备(如CPU)发出的信号称为输出信号(OUT),送入主设备的信号称为输入信号(IN)。通常数据信号和地址信号定义高电平为逻辑1、低电平为逻辑0,控制信号则没有俗成的约定,如WE表示低电平有有效、Ready表示高电平有效。不同总线高电平、低电平的电平范围也无统一的规定,通常与TTL是相符的。
(4)时间特性:
时间特性又称为逻辑特性,指在总线操作过程中每一根信号线上信号什么时候有效,通过这种信号有效的时序关系约定,确保了总线操作的正确进行。
为了提高计算机的可拓展性,以及部件及设备的通用性,除了片内总线外,各个部件或设备都采用标准化的形式连接到总线上,并按标准化的方式实现总线上的信息传输。而总线的这些标准化的连接形式及操作方式,统称为总线标准。如ISA、PCI、USB总线标准等,相应的,采用这些标准的总线为ISA总线、PCI总线、USB总线等。
软件
windows NT的操作系统结构
参考文献
- 计算机系统,http://baike.baidu.com/link?url=09SZSOSoUzSNk_93KQxxJiKFu-_CVzhlAzHCigWSjtXdFd3ZK_I4rWSjB3iDwjNxuF0mMY8DpbKP3X9DUUjVZ_
- https://en.wikipedia.org/wiki/Computer_system
- CPU的工作过程,https://software.intel.com/zh-cn/articles/book-Processor-Architecture_CPU_work_process/
- Intel CPU制作流程,http://v.youku.com/v_show/id_XMjQyMDAyMTUy.html
- AMD芯片的制作流程,http://v.youku.com/v_show/id_XMzcyODU1NDIw.html
- CPU的内部架构和工作原理,http://blog.chinaunix.net/uid-23069658-id-3563960.html