Peter Teoh wrote:
read() vs mmap().....mmap() takes a page fault with every single byte of memory access, if the mmap() ptr is byte ptr, then it seemingly should be slower than read()....
As suggested by the name PAGE fault, it faults in a page at a time. This means it will take a page fault for every 4kB of data on x86 systems.
Page fault VS memory copy ?? which is more overhead ?? I think Rik can answer this question.
It depends on what you do. Page faults are not exactly cheap, but neither is copying around the data. If you access the file data just once, read() or write() are likely to be faster. If you access the data over and over again, mmap is likely to be faster. -- All rights reversed. -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ