Input-Output

Memory-Mapped I/O

Memory-mapped I/O uses the same address space to address both main memory and I/O devices.

  • Reads/writes to those addresses are interpreted as commands to that device
  • When the processor issues the address and data, the memory system ignores it since that region is mapped to I/O. The address encodes the device identity and type of transmission.

A memory-mapped ļ¬le is a segment of virtual memory that has been assigned a direct byte-for-byte correlation with some portion of a ļ¬le.

Beneļ¬ts:

  • Orders of magnitude faster than system calls
  • Input can be ā€œcachedā€ in RAM memory (page/ļ¬le cache)
  • A ļ¬le requires disk access only when a new page boundary is crossed
  • Memory-mapping may bypass the page/swap ļ¬le completely
  • Load and store raw data (no parsing/conversion)

I'm confused, what is the alternative?

The alternative is the standard IO operations, where you read() or write() from IO, which is a System Call.