10/15 10/8 OS作業

名稱
10/8 OS作業
日期
10/15
課程名稱
作業系統
指導教師
劉艾華
心得
1.
Give two reasons why caches are useful.What problems do they solve?
A:
 Cache memory is random access memory (RAM), one of its access speed faster than normal RAM.es are useful when two or more components need to exchange data, and the components perform transfers at differing speeds.
 Cache buffer role is viewed pages, pictures, etc., such as A page has just seen, and now look at the B page, if you want to see A page directly point back, A page can be loaded from the cache, instead of and then connect to the network to download
What problems do they cause?
A:
 Cache are small in size so we cannot store large amount of data on it.We cannot store data permanently in Cache, it stores data as long as the power is available.
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?
A:
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?
A:
 An interrupt is a signal from hardware (h/w interrupt) or software (s/w interrupt) to indicate the occurence of an event. It indicates the need of a change in execution. Interrupt handling or servicing of the interrupts depends upon the design of the operating system. A routine which will be called for servicing the interrupt is known as interrupt service routine or ISR and the request for the ISR through an interrupt is known as interrupt request or IRQ. Interrupt is a mechanism used for implementing the multitasking concept. It will use the concept of context switching, for servicing the request.
What are the differences between a trap and an interrupt?
A:
 A trap is an exception in a user process. It's caused by division by zero or invalid memory access. It's also the usual way to invoke a kernel routine (a system call) because those run with a higher priority than user code. Handling is synchronous (so the user code is suspended and continues afterwards). In a sense they are "active" - most of the time, the code expects the trap to happen and relies on this fact.
 An interrupt is something generated by the hardware (devices like the hard disk, graphics card, I/O ports, etc). These are asynchronous (i.e. they don't happen at predictable places in the user code) or "passive" since the interrupt handler has to wait for them to happen eventually.
Can traps be generated intentionally by a user program? If so, for what purpose?
A:
 Yes. User programs create traps for debugging purposes. A trap can be used to call the OS routines or to catch arithmetic errors.
3.
Please tell the functional differences between CPU and device controller.
Is there any similarity between them?
 A device driver is a computer program that operates or controls a particular type of device that is attached to a computer. A driver provides a software interface to hardware devices.
4.
Please discuss, in your own words, the cycle of the handling of an interrupt.
A:
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.