10/8 OS作業

10/8 OS作業
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.

Interrupt is that causes a computer processor to temporarily stop executing its current program and execute another program instead, finally returning control to the original program. So it prevent that more important task goes back because of less important task. 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.

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.

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

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. 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. There are many device controllers in a computer system.

CPU is the heart of a real system, also be known as the unit that controls and supervises all functions of the machine. Performs all calculations and represents the main parameter for evaluating the performance of a computer. The CPU sends signals to control the other parts of the computer, almost like how a brain controls a body.

The similarity between device controller and CPU is the importance in operating system. We can’t lose both of them. Because device controller, CPU knows when it should stop the instruction. In the meanwhile, without CPU, we can’t implement almost everything in a computer. Therefore, to me, both of them are brains of computers.

An instruction cycle is the basic operation cycle of a computer. It is the process by which a computer retrieves a program instruction from its memory, determines what actions the instruction requires, and implements those actions. This cycle is repeated continuously by the CPU. After the execute cycle is completed, a test is made to determine if another process can access the CPU.