|
Secrets of Virtual
Memory / Swap File
In a
multi-tasking Operating System like Windows, one can open as many as
applications one needs and work simultaneously on them. For instance, you
might be surfing the internet in your web browser and at the same time you
can also have your favorite mp3 songs being played in your favorite media player and also in the background have an FTP client uploading your
website to he server.
In such
situations where you have multiple applications and too much of data
occupying the physical memory of the system, quite often the physical
memory i.e. RAM in your system becomes insufficient to store all the
current data being used. To overcome this physical memory shortage, the
operating system makes use of a certain amount of space on the hard drive
to substitute for the deficiency of RAM. This part of memory of the hard
drive which is used as a substitute for RAM is called the Virtual Memory.
What the
operating system does in the virtual memory is, it creates a large file
called the swap file which contains all the data which theoretically
should have been in the RAM. In Windows, the name of the swap file is
Pagefile.sys and can be found as a hidden file in the root of all the
drives which have virtual memory allocated in them.
Note here that
the difference between swap file and virtual memory is that the virtual
memory is the complete block of memory allocated for the purpose of trying
to substitute for RAM deficiency and swap file is the amount of the
virtual memory currently being used by the operating system in the form of
a system file. A swap file may or may not be occupying the entire virtual
memory.
Since the swap
file is used as a substitute for RAM, the contents of the file are
volatile in nature even though the file itself resides in the hard drive.
In other words the contents of this file are lost once the system is
shutdown, and new contents arrive as soon as your operating system gets
loaded. But, finally how the contents of the swap file are handled depends
on the architectures of the individual operating systems. By the way, swap
file is called so because, the contents of the swap file are always continuously
being swapped between the swap file and system RAM.
It is also to be
noted here that even though virtual memory is used as a substitute for
system RAM it is in no means as efficient as RAM in terms of speed, as the
speed of the virtual memory again depends on that of hard drive as it is
located in the hard drive. So, if your system is slower because of
inefficient RAM, then to increase its speed increase the physical memory
i.e. RAM of the system instead of going for a hard disk with a greater
capacity to have more virtual memory.
The performance
of your system can come down heavily if the swap file is greatly
fragmented in the drives. This usually happens when the operating system
itself is managing the virtual memory. A better way out in this case would
be to manually allocate a large amount of space on the hard drive for the
virtual memory thereby reducing chances of swap file fragmentation. Also,
completely disabling the virtual memory in your system may cause your
system to slow down heavily and in the worst case might also prevent your
system from booting. It is always strongly advised that only technically
qualified and knowledgeable persons manage the virtual memory settings.
-by Gurudev
MADE IN
INDIA
gurudevp@vsnl.net
On 08 March 2003
Home
>> Computers >> Operating
System
|