心得分享

Card image cap

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

10/8 OS作業
名稱 OS
日期 2015/10/14
課程名稱 Operating System
指導教師 劉艾華

1-1 Caches are useful when two or more components need to exchange data, and the components perform transfers at different speeds.

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

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

1-4 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-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,when a hardware or software makes a interrupt , the cpu will stops working and start executing the interrupt routine , when finishing the routine , the cpu will restores CPU state

更新日期:2015/10/14 下午 11:08:41