Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Memory Mapped Files

I am trying to investigate the behaviour of the Windows Kernel with respect to Memory Mapped Files / Virtual Memory. Specifically I am interested in determining how frequently the contents of a memory mapped file are flushed (by Windows) to disk and what criterion Windows uses for deciding it is time to do so.

I have done a bit of research online and, apart from the MSDN which deals more with the 'hows and whys' rather than detailing the internal workings, there doesn't appear to be much information. If anyone can point me to any articles or has looked into this before and has some insight I would welcome it.

Thanks.

like image 722
Konrad Avatar asked Jun 09 '09 13:06

Konrad


2 Answers

I suggest reading Microsoft Windows Internals by Mark Russinovich and David Solomon, in fifth edition also with Alex Ionescu.

like image 103
msuvajac Avatar answered Nov 11 '22 18:11

msuvajac


Memory mapped files are controlled by the modified page writer in the kernel - they're flushed whenever the memory that backs the page needs to be re-used (so it can happen under memory pressure).

The system also keeps track of the number of dirty pages and writes them after a threshold is reached.

You can find more information about in this article about Windows memory management changes for Windows Vista - it doesn't directly answer your question about how the memory manager treats modified pages but you can infer some of the details based on the information in the article.

like image 22
ReinstateMonica Larry Osterman Avatar answered Nov 11 '22 18:11

ReinstateMonica Larry Osterman