Services of the Kernel I/O Subsystem

  1. I/O Buffering: this is about storing temporary data that is to be transferred in an I/O operation.
    • A buffer, in general, is a memory section (array) that stores data that will be transferred between 2 devices or between a device and an application.
    • Buffering is the usage of a data buffer to store data that hasn't been yet transferred.
    • The OS performs buffering for 3 reasons:
      1. The device that receives the data might be slower than the one that provides it. Hence, to prevent the data from being lost, the data is stored in a buffer until the recipient device is ready to accept and process it.
      2. Some devices can't receive data that is too large, meaning that the device can receive data only in smaller chunks. To let the recipient device process data, we store the arriving data in a buffer.
      3. To prevent the data from being mistakenly erased. When we store data in a separate buffer, instead of storing it in an array that a user program created, we ensure that the correct data that was supposed to be transferred is indeed transferred, regardless of whether the program mistakenly overwrote the array's contents before the data was processed.