心得分享

Card image cap

陳同學 報告/作業 分享經驗 1013 10/8 OS作業

1013 10/8 OS作業
名稱 10/8 OS作業
日期 1013
課程名稱 作業系統
指導教師 劉艾華

1. Caches are useful when two or more components need to exchange data, and the components perform transfers at different speeds. Caches solve the transfer problem by providing a buffer of intermediate speed between the components.
If the fast device finds the data it needs in the cache, it need not wait for the slower devices. The data in the cache must be kept consistent with the data in the components. If a component has a data value change, and the datum is also in the cache, the cache must also be updated. This is especially a problem on multiprocessor systems where more than one process may be accessing a datum. A component may be eliminated by an equal-sized cache, but only it: (a) the cache and the component have equivalent state-saving capacity (that is, if the component retains its data when electricity is removed, the cache must retain data as well), and (b) the cache is affordable, because faster storage tends to be more expensive.

2. An interrupt is a hardware-generated change-of-flow within the system. An interrupt handler is summoned to deal with the cause of the interrupt; control is then returned to the interrupted context and instruction. A trap is a software-generated interrupt. An interrupt can be used to signal the completion of an I/O to obviate the need for device polling. A trap can be used to call operating system routines or to catch arithmetic errors.
A trap is an exception in a user process. It's caused by division by zero or invalid memory access. It's also the usual way to invoke a kernel routine (a system call) because those run with a higher priority than user code. Handling is synchronous (so the user code is suspended and continues afterwards). In a sense they are "active" - most of the time, the code expects the trap to happen and relies on this fact.
An interrupt is something generated by the hardware (devices like the hard disk, graphics card, I/O ports, etc). These are asynchronous (i.e. they don't happen at predictable places in the user code) or "passive" since the interrupt handler has to wait for them to happen eventually.
Yes. User programs create traps for debugging purposes. A trap can be used to call the OS routines or to catch arithmetic errors.
3. Device controller is a hardware whereas device driver is a software.

A device controller is a part of a computer system that makes sense of the signals going to, and coming from the CPU.Any device connected to the computer is connected by a plug and socket, and the socket is connected to a device controller.It functions as a bridge between the device and the operating system.The electrical part of an I/O device is known as a device controller and can take the form of a chip on personal computers.

The Device Controller receives the data from a connected device and stores it temporarily in some special purpose registers (i.e. local buffer) inside the controller. Then it communicates the data with a Device Driver . For each device controller there is an equivalent device driver which is the standard interface through which the device controller communicates with the Operating Systems.


A device driver is a computer program that operates or controls a particular type of device that is attached to a computer. A driver provides a software interface to hardware devices.

4. a callback function in microcontroller firmware, an operating system or a device driver, whose execution is triggered by the reception of an interrupt. In general, interrupts and their handlers are used to handle high-priority conditions that require the interruption of the current code the processor is executing

更新日期:2015/10/13 下午 10:12:29