1. 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? (Chapter 1)
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. The main difference between a trap and an interrupt is where they are generated. An interrupt is a hardware-generated. And it can be used to signal the completion of an I/O to obviate the need for device polling. Whereas a trap is software-generated interrupt and it can be used to call operating system routines or to catch arithmetic errors.
2. Direct memory access is used for high-speed I/O devices in order to avoid increasing the CPU’s execution load. (Chapter 1)
a) How does the CPU interface with the device to coordinate the transfer? b) How does the CPU know when the memory operations are complete? c) The CPU is allowed to execute other programs while the DMA controller is transferring data. Does this process interfere with the execution of the user programs? If so, describe what forms of interference are caused.
a) After setting up buffers, pointers, counters and I/O device, the device controller transfers an entire block of data directly to or form its own buffer storage to memory with no intervention by CPU. b) One interrupt is generated per block.
c) Cycle stealing. It causes CPU computation slow down because the memory can fetch at a time. So if CPU and DMA do it at the same time, it causes some bump. So they give DMA priority because CPU speed is fast enough.
3. Describe three general methods for passing parameters to the operating system. (Chapter 2)
1) Pass parameters in registers. (But...