How does the DB manage a pool of buffers when the operating system ends up controlling what's really in memory? For example, couldn't the operating system decide to evict a page frame from a DB's buffer?
-
$\begingroup$ I haven't written a database, but presumably the DB requests an extremely large chunk of memory which it then runs its own memory management on. Similarly, databases may also choose to eschew the OS's logical file system and work directly with raw blocks. $\endgroup$– gardenheadMar 17, 2017 at 3:33
1 Answer
Yes, absolutely, that could happen, and it makes it harder for databases to optimize their own performance.
Some databases bypass the operating system's virtual memory management and manage memory themselves. They might request that the operating system pin a range of the address space into memory (and never page it out). Or, they might be designed to be the only application that runs on the machine, and take care of their own memory management so they never use too much memory -- hoping that this will make it unlikely that the OS ever pages out any of their data.