Consider the following I/O scenarios on a single-user PC.

a. A mouse used with a graphical user interface

b. A tape drive on a multitasking operating system (assume no device preallocation is available)

c. A disk drive containing user files

d. A graphics card with direct bus connection, accessible through memory-mapped I/O

For each of these I/O scenarios, would you design the operating system to use buffering, spooling, caching, or a combination? Would you use polled I/O, or interrupt-driven I/O? Give reasons for your choices.

a. 鼠标要求及时反馈,应该采用中断 IO。

b. buffering, spooling, caching 都需要。用缓冲平衡速率差异,用缓存提高访问速度。用假脱机实现任务队列化。中断 IO。

c. 包含用户文件缓冲的磁盘驱动器可用于在从用户空间传输到磁盘时保存数据,反之亦然。缓存可用于保存驻留在磁盘上的数据,以提高性能。不需要假脱机,因为磁盘是共享访问设备。中断驱动的 I/O。

d. 需要缓冲。不需要缓存和假脱机。内存映射直接 IO。