os concept 1.2.1

1.2.1 Computer-System Operation

A modern general-purpose computer system consists of one or more CPUs and a number of device controllers connected through a common bus that provides access to shared memory.Each device controller is in charge of a specific type of device(for example,disk drives,audio devices,and video displays).The CPU and the device controllers can execute concurrently,competing for memory cycles.To ensure orderly access to the shared memory,a memory controller is provided whose function is to synchronize access to the memory.

现代目标通用型计算机系统由一个或多个CPU和一些其它设备控制器组成,它们通过一个公用总线连接到共享内存。每个设备控制器负责一个特殊设备(如磁盘,声音亢奋,显示器)。CPU与设备控制器能同步执行,计算存储周期。为保证顺序访问共享内存,内存控制器提供了同步访问机制。

for a computer to start running--for instance, when it is powered up or rebooted--it needs to have an initial program to run.This initial program,or bootstrap rpogram,tends to be simple.Typically,it is stored in read-only memory(ROM) or electrically erasable programmable read-only memory(EEPROM),known by the general term firmware,within the computer hardware.It initializes all aspects or the system,from CPU registers to device controllers to memory contents.The bootstrap program must know how to load the operating system and to start executing that system.To accomplish this goal,the bootstrap program must locate and load into memory the operating-system kernel.The operating system then starts executing the first process,such as "init," and waits for some event to occur.

计算机要开始运行如打开电源或者重启时,它需要一个初始化程序来运行。这个初始化程序或者bootstrap程序,倾向于简单。它通常储存在ROM或EEPROM中,我们所知的术语硬件固件正是指它。它初始化系统的所有方面,从CPU注册到设备控制器再到内存内容。bootstrap程序必须知道怎样载入系统和开始执行系统。为达成此目标,bootstrap程序必须定位到系统内核并载入其至内存中。然后操作系统将执行第一个进程如init并等待一些事件发生。

The occurrence of an event is usually signaled by an interrupt from either the hardware or the software.Hardware may trigger an interrupt at any time by sending a signal to the CPU,usually by way of the system bus.Software may trigger an interrupt by executing a special operation called a system call(also called a monitor call).

When the CPU is interrupted,it stops what it is doing and immediately transfers execution to a fixed location.The fixed location usually contains the starting address where the service routine for the interrupt is located.The interrupt service routine executes;on completion,the CPU resumes the interrupted computation.A time line of this operation is shown in FIgure1.3

一个事件发生通常由一个由来自于硬件或软件的中断来标识。硬件可以在任意时刻触发一个中断,通过总线发送信号到CPU。软件可以通过执行一个特殊操作称为系统调用来触发中断(也叫做monitor调用)。

当CPU被中断,它停止进行中的工作并立即传输执行到一个固定的位置。此位置通常包括一个起始地址,此中断的服务常规在此。此中断的服务常规执行,当完成时,CPU继续先前中断的计算,时间线如图1.3所示

Interrupts are an important part of a computer architecture.Each computer design has its own interrupt mechanism,but several functions are common.The interrupt must transfer control to the appropriate interrupt service routine.The straightforward method for handling this transfer would be to invoke a generic routine to examine the interrupt information;the routine,in turn,would call the interrupt-specific handler.However,interrupts must be handled quickly.Since only a predefined number of interrupts is possible, a table of pointers to interrupt routines can be used instead to provide the necessary speed.The interrupt routine is called indirectly through the table,with no intermediate routine needed.Generally,the table of pointers is stored in low memory )the first 100 or so locations).These locations hold the addresses of the interrupt service routines for the various devices.This array,or interrupt vector,of addresses is then indexed by a unique device number,given with the interrupt request,to provide the address of the interrupt service routine for the interrupting device.Operating systems as different as Windows and UNIX dispatch interrupts in this manner.

中断是计算机架构中的重要组成部分。每个计算机设计拥有其自己的中断机制,但一些功能是通用的。中断必须将控制权传输给适当的中断服务例行程序。直接处理此传输的方法将请求一个类属例程来检查中断信息;此例程将调用特别中断处理程序。

猜你喜欢

转载自chnsslf.iteye.com/blog/1262673