Well, the executable is mmaped on execution, and on a pagefault, the handler
will ask the buffer cache code to give that page. The buffer cache however
is clever enough to read more than one page (4k) at a time, so it might
already have the needed page. Then we only need to add a page table entry
(minor pagefault), otherwise we have to read it from disk first (major
pagefault).
[That's the reason, why you are not allowed to change it on disk when it's
running, BTW]
There were some discussions about the readahead strategy of the buffer cache
when invoked by mmap some time ago on this list. It does much less readahead
than for normal file operations, which are assumed to be sequential.
For executables with a somewhat random access pattern, it seems to be quite
well not to readahead a lot, but some programs (like grep) use mmap to
sequentially read a file and are slower because of this.
Now, this is what I understood from the discussions here and there might be
I misunderstood something.
-- Kurt Garloff <kurt@garloff.de> [Dortmund, FRG] Plasma physics, high perf. computing [Linux-ix86,-axp, DUX] PGP key on http://www.garloff.de/kurt/ [Linux SCSI driver: DC390]- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/