10/14 10/8 OS作業

名稱
10/8 OS作業
日期
10/14
課程名稱
作業系統
指導教師
劉艾華
心得
1.
①. 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.
①. 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.



3.
①. The main functions of a device controller are interfacing with the computer system and I/O device, receiving and decoding commands from the computer, generating control signals to I/O device, transferring data form the computer to the device or form the device to the computer.

②. The main function of the CPU is processing instructions given to the computer. This is why the CPU is known as the "brain" of the PC. 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.



4.
CPU stops the running process and transfers execution to a fixed location that contains the starting address, where the service routine for the interrupt is located when a hardware or a software make an interrupt.
If the interrupt service routine finishes executing, the CPU resumes the interrupted computation before the interrupt.