10/14 10/8 OS作業

名稱
10/8 OS作業
日期
10/14
課程名稱
作業系統
指導教師
劉艾華
心得
1-1. Caches are useful when two or more components need to ex-change data, and the components perform transfers at differing speeds.

1-2 Caches solve the transfer problem by providing a buffer of intermediate speed between the components.

1-3 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

1-4 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-1. 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.

2-2 Interrupts are hardware interrupts, while traps are software-invoked interrupts. Occurrences of hardware interrupts usually disable other hardware interrupts, but this is not true for traps. If you need to disallow hardware interrupts until a trap is served, you need to explicitly clear the interrupt flag. And usually the interrupt flag on the computer affects (hardware) interrupts as opposed to traps. This means that clearing this flag will not prevent traps. Unlike traps, interrupts should preserve the previous state of the CPU.

2-3 Yes. User programs create traps for debugging purposes. A trap can be used to call the OS routines or to catch arithmetic errors.



3-1. The main function of the CPU is processing instructions given to the computer. Every operation that is carried out, including key strokes, opening and closing programs, and saving files, is carried out by the CPU. This function is separated into four functions or steps for every operation: fetch, decode, execute and store.
A device controller is a part of a computer system that makes sense of the signals going to, and coming from the CPU.It functions as a bridge between the device and the operating system.

3-2 They both can recieve the control signals from the unit.



4. For example, press the keyboard then there is a signal got to CPU to let it read the key and copy the associated information into the computer's memory.when finished interrupt comes to let it stop the task.