Explaining Windows Memory Paging and Allocation

  • Thread starter Thread starter martix
  • Start date Start date
  • Tags Tags
    Memory Windows
AI Thread Summary
Memory allocation and paging in Windows can appear inefficient, particularly when there is ample free physical memory yet sections remain paged out. This behavior is primarily due to the operating system's strategy of optimizing memory usage. Windows often swaps out infrequently used data to the pagefile, as this process is less time-consuming than retrieving it later. By doing so, the system can free up RAM for other tasks, allowing for quicker access to memory when needed. This approach ensures that memory management is efficient, especially during idle times when the system can offload data without impacting performance.However, the reason physical memory rarely reaches full capacity, despite having 2048MB installed, is linked to how Windows allocates memory. The operating system maintains a balance between available memory and performance, often keeping a buffer of free RAM to handle sudden demands. This strategy prevents the system from becoming overloaded and ensures smoother operation, even if it means not fully utilizing all available physical memory at all times.
martix
Messages
167
Reaction score
5
I have wondered for quite a while why memory allocation and paging in Windows seems to be so weird and doesn't want to use memory to the fullest.
For example even when there is a lot of free physical memory, there are sections that are paged out.
And then - physical memory never seems to fill up totally.

I'd appreciate someone explaining the reasons behind this behavior.
 
Technology news on Phys.org
It's a complex subject -

The main reason it uses swap/pagefile when there is free ram is that swapping out memory is cheap (in time) compared to getting it back, so when you have some memory that doesn't look like it's changing very often Windows (and most modern OSs) will swap it out when they aren't busy. If they then need some more memory for another task they can quickly delete the in-memory copy of the other data because they already have a swapped copy. Of course when the other process needs that memory it will have to be read back in - but that's a problem for the future.
 
Let me see if I got this:
Basically while windows is idle it uses the time to copy infrequently used data to HDD, so if the need arises for lots of memory, it can just delete the memory copy, without the effort of swapping it first.
If this is right, then it does make a lot of sense and is actually a cool idea, provided the page replacement algorithm knows its job...

Then there's the other extreme - why does it not use the entire physical memory space?
For example I have 2048MB of memory and I have never seen it reach 2000MB physical usage(always ~19-- MB).
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...
Back
Top