心得分享

Card image cap

曾同學 報告/作業 分享經驗 Operating Systems Homework 1

Operating Systems Homework 1
名稱 Operating Systems Homework 1
描述 Homework Chapter 1
課程名稱 Operating Systems
指導教師 Dr. Ay-Hwa Andy Liou

1. Give two reasons why caches are useful. What problems do they solve? What problems do they cause? 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?

Caches are useful when two or more components need to exchange data, and the components perform transfers at different speeds.
Cache is useful in prefetching of instructions in the CPU execution cycle. By launching cache to hold the next few instructions, so that we won't have to wait for slow memory access.

2. What Is the purpose of interrupts? What are the differences between a trap and an interrupt? Can traps be generated intentionally by a user program? If so, for what purpose?

The purpose of interrupts is to alter the flow of execution in response to some event. An interrupt is triggered in hardware and a trap is triggered in software. User programs can generate traps intentionally. They may want to interact with some I/O which requires a system call

3. Please tell the functional differences between CPU and device controller. Is there any similarity between them?

The function of device controller is to send interrupt to
CPU when done the job. The function of CPU is to
execute an interrupt handler.
CPU and device controller use the same bus for
communication. Both CPU and device controller are
dealing with interrupt.

4. Please discuss, in your own words, the cycle of the handling of an interrupt.

First, the device driver will load the appropriate registers
within the device controller. Then, the device controller
examines the contents of these registers to determine
what action to take. The device controller starts to transfer
data form the device to its local buffer. When the transfer
is complete, the device controller will send interrupt to
device driver. The device driver then returns control to the
operating system

更新日期:2016/1/7 上午 07:00:37