1.
Give two reasons why caches are useful.
What problems do they solve?
What problems do they cause?
If a cache can be made as large as the device for which it is caching
(for instance, a cache as large as a disk), why not make it that large and eliminate the device?
Caches are useful when two or more components need to exchange data, and the components perform transfers at differing 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 device. 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 if: (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.
What Is the purpose of interrupts? What are the differences between a trap and an interrupt?
Can traps be generated intentionally by a user program?
If so, for what purpose?
An interrupt is a hardware-generated change of flow within the system. An interrupt handler is called 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 generated intentionally by a user program. It can be used to call operating system routines or to catch arithmetic errors.
3.
Please tell the functional differences between CPU and device controller設備控制器. Is there any similarity between them?
CPU controls the operations, and device controller translates software input into something a hardware device understands.CPU and device controllers use a common bus for communication.
A device controller is a part of a computer system that makes sense of the signals going to, and coming from the CPU.
4.
Please discuss, in your own words, the cycle of the handling of an interrupt.
Receive an interrupt instruction, and go to I/O device to transfer data and when done the job ,send interrupt to CPU and return control.