Bass said:
Dexter said:

It doesn't but an OS can accomplish a lot of the intelligent read caching by a paging algorithm, which keeps track of the most commonly read parts of a file. This is easy to implement with the information the kernel gets from mmap and subsequent use of the mmaped space. Most of the performence heavy lifting can be done by the kernel, which knows more about the characters of the persistent store (eg: location of the R/W head, etc).


It would be downright stupid for a DB to take all of this in it's own hands, but I am sure there is some legacy DBs out there who still do all of this, because they were written during a time where MS-DOS was considered advanced. Smiley

Any application (big enough, complex enough to worth the effort of doing it) can do better than the kernel at caching because an application will always know better than the kernel what data it needs. The kernel can at best obeserve the reads and the writes and some hints passed through the system calls and do some guesswork based on that. The kernel does not have a time machine to look into the future but the application might just have one.