OS kernel routines for IOs, such as read or write calls, are still just functions. These functions are written to copy data to / from the user space buffer in the kernel space structure, and then to the device. When you think that there is a user buffer, an IO library buffer (like stdio buf), a kernel buffer, and then a file, the data can potentially go through 3 copies to get between your program and disk. I / O procedures must also be reliable, and finally, the sys calls themselves impose a delay (kernel capture, context switch, wake-up process again).
When you store a memory card, you skip almost all of this part, excluding copies of the buffer. By efficiently processing the file as a large virtual array, you enable random access without missing the syscall overhead, so you reduce IO latency, and if the source code is inefficient (many small random I / O calls), then the overhead decreases even more dramatically.
An abstraction of virtual memory, a multiprocessor OS has a price, and that is it.
However, you can improve IO in some cases by disabling buffering in cases where you know that it will hurt performance, such as large continuous recordings, but beyond that you really cannot improve IO performance with memory mappings, without excluding the OS at all.
source share