Interrupt Handlers 中断处理程序

  • 中断处理程序隐藏中断效果最好:让驱动程序启动一个 I/O 操作块,直到中断通知完成

    • 启动一个I/O操作的驱动程序阻塞起来,直到I/O操作完成并且产生一个中断
  • 中断程序完成它的任务,然后解开启动它的驱动程序

  • 中断完成后,必须在软件中执行以下步骤:

Device Drivers 设备驱动程序

每个连接到计算机上的I/O设备都需要某些设备特定的代码来对其进行控制

Device-Independent I/O Software 与设备无关的I/O软件

独立于设备的软件的基本功能
  • 执行所有设备共有的 I/O 功能
  • 并为用户级软件提供统一的接口。

设备驱动程序的统一接口

缓冲

Modem:调制解调器

Magnetic Disk 磁盘
  • Hard disks and floppy disks 硬盘和软盘
  • Organized into cylinders, tracks, and sectors. 组织成圆柱体、磁道和扇区

Disk Hardware

  • 所有现代磁盘现在都支持一种称为逻辑块寻址的系统
    • 磁盘扇区从0开始连续编号,不管磁盘的几何规格如何
Disk Formatting 磁盘格式化
  • 在使用磁盘之前,应对磁盘进行低级格式化(low-level format)操作。
  • 每个磁道由多个扇区组成,扇区之间的间隔很短。

Cylinder Skew 柱面斜进

Cylinder skew:当低级格式被放下时,每个磁道上扇区0的位置与前一磁道的偏移

Disk Interleaving 磁盘交错

动机:当复制到内存完成时(需要一些时间成本),控制器将不得不等待几乎整个旋转时间才能让第二个扇区再次出现。

单交错:可以在连续的扇区之间给控制器以喘息的空间以便将缓存区复制到主存

Disk Arm Scheduling Algorithms 磁盘臂调度算法
  • 读取或写入磁盘块所需的时间由 3 个因素决定
    • 寻找时间 seek time
    • 旋转延迟 rotational delay
    • 实际数据传输时间 actual transfer time
  • 寻道时间占主导地位
  • 错误检查由控制器完成

FIFO 先进先出

Shortest Seek First, SSF 最短寻道优先

Elevator Algorithm 电梯算法

问题

Check Points

  1. Briefly describe the structure of a disk.
  2. What is cylinder skew?
  3. What is interleaving?
  4. What are the three factors that determine the time of reading data from disk?
  5. Briefly describe two disk arm scheduling algorithms?

Number the sectors in a staggered manner

  • seek time
  • rotational delay
  • actual tr