[prev] 47 [next]

Buffered I/O

Devices are typically very slow compared to CPU speed

Using a read() from a device for each byte is inefficient

  • OS uses a collection of buffers to hold data from devices
  • data is supplied to user programs normally from buffer
  • sometimes (infrequently?) need to access device
Assumption: many buffers, holding the current data working set


Note that read() accesses data via the OS buffers

  • it is slow because it is a system call and therefore requires a context switch each time it is called