Introduction
This article concentrates on tracking system memory parameters in real time. The system memory parameters will depend on the policy of memory management by the kernel. This includes the type of paging, type of relocation and algorithms behind the aforesaid processes.
About Memory Management
This topic is about the mechanism and the requirements behind system memory management. Often the physical memory available in your system is very low considered to the amount of actual memory needed for running individual processes. This situation becomes critical in a multitasking operating system like Windows. So the available physical memory should be managed in an optimized fashion to avail full system throughput. The actual physical memory thus get extended to a particular limit by the concept of Virtual Memory. This concept is applied by swapping sections of RAM memory in and out of the system hard disk. The swapped sections are called pages which we will be discussing in our next section. Since swapping involves CPU time memory should be optimized to produce minimum chances of swapping. But anyhow, it cannot be avoided too.
Paging
The process which is to be brought to the RAM is not brought as such as a whole. Instead, it is broken into pieces called pages for efficient management of memory and ease of swapping. When it is broken into pieces, the whole process need not be swapped in/out of the disk frequently. Hence each page of process will occupy a corresponding frame of divided memory. For more information regarding the above processes, perhaps you would go to
http://www.linux.com/.
About the code
All the above information is displayed graphically in the application uploaded here with. The application would show you how much physical memory your system has and the corresponding payloads. The code runs as follows: [I am including only the code with relevance. Rest being the same as generated by AppWizard]
#define MEMTRACKTIMER 10 // Declaring a timer for constant memory track
The function GlobalMemoryStatus(LPMEMORYSTATUS memStat);
defined in winbase.h, will collect all the information about the memory and fill the same in a MEMORYSTATUS structure. The structure runs as below:
typedef struct _MEMORYSTATUS { </P>
<P>DWORD dwLength;
<P>DWORD dwMemoryLoad; </P>
<P>SIZE_T dwTotalPhys;
<P>SIZE_T dwAvailPhys;
<P>SIZE_T dwTotalPageFile;
<P>SIZE_T dwAvailPageFile;
<P>SIZE_T dwTotalVirtual;
<P>SIZE_T dwAvailVirtual;
<P>}MEMORYSTATUS, *LPMEMORYSTATUS;
The object of above structure when passed into the function would fill the structure accordingly. That's it...
I am a personality from Trivandrum , a green peaceful place in Kerala, South India.
I have been an enthusiast of Windows programming when I started creating simple windows when I learnt VC++ in LCC in Trivandrum. From then on its all about Windows in my flesh and blood.
My career graph moves like this:
1. I started working as a C/C++ programmer in a company in Trivandrum where I learnt the ABCs of Software Industry. I worked with them for about 1 year. I could not contine since I was in contract for 1 year.
2. Then I joined another organization in Trivandrum who gave me challenges to love. They made me mad about VC++ and Windows.
I was mad about Embedded Systems which made me, Myself = Embedded Systems + VC++.
3. Software Engineer in a telecom company in Hyderabad, Andhra Pradesh, S.India.
4. Currently working with a telecom company in Bangalore.
I totally, so, have experience of about 4.5 years.