Services of the Kernel I/O Subsystem

  1. Caching: Remember cache? To reduce the time it takes for a CPU to access data in memory, the OS stores some frequently used data within the cache hardware, which lies closer to the CPU than memory does, and therefore is accessed quicker than memory.
  2. Spooling and Device Reservation: A spool (Simultaneous Peripheral Operations On-Line) buffer stores data for peripheral devices like printers that cannot support interleaved data streams. When two programs want to print files simultaneously, the spool stores the file of one of the programs until the 1st finishes the printing.
  3. Error Handling: I/O requests can fail for many reasons, either transient like buffer overflow, or permanent like disk crash. In any case, the OS is responsible for detecting when an I/O error happens and properly addressing it.
  4. I/O Protection: The OS must ensure that no data is being accidentally overwritten by another program. This also includes the prevention of accidental I/O operations. In addition, the OS must prevent access of user programs to sections in memory that are dedicated to memory-mapped I/O and other OS-only memory section.