Is that true that Windows can eventually address executable files as if they were parts of virtual memory?

1

I've once read somewhere that Windows can treat programs' executables and DLL files as parts of swap file rather than duplicating their content into pagefile.sys when swapping them out of physical memory. Is that true?

Ivan

Posted 2011-03-06T04:01:09.597

Reputation: 6 173

AFAIK, the only "swap" memory Windows has is the pagefile. Other then that, it's up to individual programs to use swap files to save RAM (e.g. Adobe Photoshop). – Breakthrough – 2011-03-06T15:21:45.603

Answers

6

This is true.

For example: If you open notepad, then windows will load bits and pieces of the notepad.exe file from the hard drive. Then you write something in notepad. Then you minimize it and do something else that needs a lot of memory so that notepad gets paged out. The stuff you wrote will get page out to the pagefile, but the pieces of notepad.exe that were loaded just gets dropped, since they are already on the hard drive.

While this reduces page file usage, it does not increase your virtual memory. Windows still won't commit to giving more memory than RAM + pagefile.

Mr Alpha

Posted 2011-03-06T04:01:09.597

Reputation: 6 391

Clarification: It doesn't increase the system commit limit, which pertains to "private commmitted" virtual address space. exe's, dll's, other "code files", are all mapped into virtual address space, and they do contribute to the TOTAL virtual address space a process can use. But not to the "commit limit". – Jamie Hanrahan – 2014-10-04T17:08:37.430

I would add: Windows always does this. exe and dlls are mapped into process virtual address space and their pages are brought into memory when and as they're needed ("demand paging"). Nor is there normally a need to write those pages to the pagefile as they are almost never modified. If there is high demand for RAM, such pages (code and constant data) can just be overwritten and used for something else. A page that's needed again later can just be read in again from the original exe or dll. It is a myth that the pagefile is the only file involved in paging. Nor is this unique to Windows. – Jamie Hanrahan – 2015-12-05T12:02:00.447