As far as I know, the page file is used to extend the RAM by temporarely storing unused RAM to the disk. Marking each page as paged and loading it when a page fault occurs.
- How systems choose pages to be paged
- RAM extension using a Paging File doesn't seem to be safe and in a (brute force) case it will slow/freeze/panic the operating system.
- Memory Management Question : the FreePool() or free() function must search through a list of memory/heap segments, a (page table scheme) will be much faster but so ineffective.
- Unused memory is selected by going through the page tables and checking the accessed bit and the dirty bit to write new content to the page file
- Do you recommand loading page by page or loading the entire heap from the page file ?
Page/Swap/RAM File Implementation
-
- Member
- Posts: 5563
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Page/Swap/RAM File Implementation
The OS tracks how recently each page was accessed. Pages that haven't been accessed recently will be moved to the disk if the OS runs out of free RAM.devc1 wrote:- How systems choose pages to be paged
Out-of-memory conditions can cause a freeze or panic even without paging to disk. You're right about the disk being slower than RAM, though.devc1 wrote:- RAM extension using a Paging File doesn't seem to be safe and in a (brute force) case it will slow/freeze/panic the operating system.
That's not a question.devc1 wrote:- Memory Management Question : the FreePool() or free() function must search through a list of memory/heap segments, a (page table scheme) will be much faster but so ineffective.
Correct. On architectures that don't provide these bits, you can emulate them by removing read or write permissions and waiting for page faults.devc1 wrote:- Unused memory is selected by going through the page tables and checking the accessed bit and the dirty bit to write new content to the page file
You know you can swap any page to disk, not just pages that are part of the heap, right? Anyway, it's a trade: loading many pages means fewer disk accesses if the program accesses all of the pages you load, but it means extra time spent waiting for the disk if the program doesn't access the extra pages that you load.devc1 wrote:- Do you recommand loading page by page or loading the entire heap from the page file ?
Re: Page/Swap/RAM File Implementation
Linux, Windows and macOS also compress memory. As in, "swap" it to a different part of RAM and compress it.
https://docs.kernel.org/admin-guide/blockdev/zram.html
https://superuser.com/questions/1383484 ... windows-10
https://support.apple.com/guide/activit ... tr1004/mac (search for "compressed memory")
https://docs.kernel.org/admin-guide/blockdev/zram.html
https://superuser.com/questions/1383484 ... windows-10
https://support.apple.com/guide/activit ... tr1004/mac (search for "compressed memory")
Re: Page/Swap/RAM File Implementation
Nice idea, I will implement it too