11.5. Memory Mapped File I/O
File I/O discussed so far is done with the read, write, and lseek system calls to perform I/O on behalf of a process and to copy the data to or from the process's address space. The I/O is performed into a kernel buffer and then copied to or from the process's address space, as illustrated in Figure 11.3.
Figure 11.3. File Read with read(2)
The new memory architecture first introduced with SunOS 3.2 allows a new way of doing file I/O, that is, by mapping a file directly into the process's address space. The mmap system call allows us to map a range of a file into a process's address space; then, the file can be accessed ...