Kernel I/O Subsystem

Kernel I/O subsystem 是 OS 在 kernel 裡集中管理 I/O 的那一層。它站在 application I/O interface 和 device driver 之間:對上,它讓 application 看到比較一致的 system calls;對下,它使用 driver 控制具體 hardware。

它存在的原因是 I/O 不只是「把資料送到 device」而已。Kernel 還必須決定 request 順序、暫存資料、快取資料、管理 exclusive device、處理錯誤、保護硬體不被 user process 亂操作、追蹤 open file / socket / raw device 的狀態,甚至管理 device power。

Services

Why These Services Belong in Kernel

這些服務很多都牽涉全系統狀態,不能只交給單一 application 決定。例如:

  • I/O scheduling 需要看到多個 process 對同一 device 的 request。
  • Buffer cache 需要跨 process 共享 file data。
  • Spooling 需要保證 printer 一次只印一份 job。
  • Error handling 需要知道 device / driver 的失敗狀態。
  • I/O protection 需要 hardware privilege 和 memory protection。

因此 kernel I/O subsystem 的角色是把 device-level 操作提升成 system-wide resource management。