|
Virtual
Memory
This article addresses virtual memory and related issues.
The purpose is to provide clear descriptions and
recommendations. As this is a complex computer function, we
suggest that you continue to do more investigation if coming
across areas that are of interest to you. We have provided
some useful links to point you in the right direction.
A Definition
In simple terms, virtual memory is a particular method of
temporarily storing information used by most desktop
operating systems. To go a little deeper than this we will
need to provide a few definitions of some frequently used
terms.
-
Memory: computer memory is related to storage of
information; this can be physical memory stored on a
physical storage device or it can be virtual memory.
- Main
memory: the actual physical memory used by a computer that
is internal to the system (such as RAM). The term main is
used to set it apart from external storage of data such as
disk drives. As will be described in this article, the
amount of memory that is in main memory directly impacts the
amount of applications that can be running at one time.
- RAM:
Random Access Memory (RAM) is memory that is stored on a
physical device – a chip or module. It is “volatile” in
that it is not permanently stored. Instead it becomes lost
when the computer is turned off. It is also referred to as
read-write memory.
- Address:
like a street address, computers use addresses for managing
and locating data in memory. Each address is a unique number
utilized by programs and the operating system.
- Page:
a specific area for data storage, or computer instructions,
or a combination of these. The operating system creates
pages for virtual memory and each contains a fixed range of
addresses.
- Paging:
the act of transferring data, instructions, or a combination
of both of these, between the hard disk drive and memory.
This is also called “swapping”.
- Mapping:
the translation of virtual addresses to real physical
addresses.
- Processes:
when an application runs it will use one or more tasks that
are required to carry out the program’s instructions.
Virtual memory is useful as it enables access to a larger
range of memory than what could be provided by main memory
alone. The operating system maps virtual addresses between
software programs and actual storage addresses in physical
memory. Virtual memory is also frequently used in the
swapping of storage between RAM and physical storage devices
(such as your physical hard disk drive or external drives).
In an effort to run several applications at the same time,
your computer will free up areas in RAM that have not been
recently used by copying data to the hard disk.
So, in a nutshell, the operating system utilizes a virtual
memory technique whereby it creates pages that have specific
addresses so that data can be stored until required for
use. When the data is required a paging process occurs
where data is copied from the physical disk storage to main
memory.
Since Windows 3.0 was introduced (as early as 1990), virtual
memory was used in Microsoft Windows systems. A virtual
memory “swapfile”, called WIN386.SWP (or 386SPART.PAR), was
created and by default was hidden from user. Certain system
files like this are called “hidden files” and can be viewed
if you change the setting in Windows Explorer. With the
introduction of Windows 95, the file was no longer referred
to as a swapfile but as a paging file. It can be accessed
and configured by going to the virtual memory section of the
System settings (Control Panel | System | Performance tab).
With the onset of NT systems such as Windows 2000 and
Windows XP, paging files came into existence. The file is
called: “pagefile.sys” and is located by default in the
directory where Windows was installed. Like its predecessor
it is used to create virtual memory. Where swapfiles move
entire processes to system memory, paging files move “pages”
to a page file. The use of swapfiles occurs when there is a
significant resource demand on the system. One other
distinction between these two – the use of swapfiles is
based on heavy resource demand where paging can be
pre-emptive.
Not So Virtual Issues
While virtual memory is advantageous in terms of making use
of available storage and utilizing the fastest memory on
your system, there are known instances of errors occurring.
The most common of these involves page faults. Page fault
errors are also known as invalid page faults and there are
various conditions that cause these. The most common subset
of these is referred to as a general protection fault. They
are typically caused by instability with virtual memory due
to shortages of either free disk space or RAM.
Other page faults involve issues related to applications.
For example:
-
A program attempts to access data that is in use by another
active program.
-
Virtual memory becomes corrupt as a result of a program not
behaving as expected.
When a page fault is encountered the operating system
attempts to solve the problem and, if it succeeds, a paging
operation (“swapping”) takes place – it transfers control to
the program. If it does not succeed, an error message will
appear. If this is the case you can go to the Microsoft
support site and enter the type of error message to see if
it is listed there. To search the support site do the
following:
-
Click on this link or type it in your Internet Browser:
http://support.microsoft.com/search/
-
In the Search Product field, click the drop down
arrow and select your operating system or a particular
application you suspect as a possible cause.
-
In the For field, type the name of the page fault
error.
-
Click Search.
Thrashing
As mentioned, data is transferred from storage spaces such
as the physical disk drive to main memory (RAM). One of the
reasons for this is that RAM memory is faster than hard disk
drives. Disk drives are not designed to deal with small
pieces of data. However, if your system has too large a
reliance on virtual memory, you can expect a decrease in
performance especially when many programs and processes are
running consecutively. You can typically detect this when
switching form one program task to another. If there are
delays the operating system is swapping information from the
hard disk to RAM memory. When the hard disk drive is used
excessively as a virtual memory resource, your computer may
experience what is commonly known as “thrashing”.
You can tell if your system is thrashing if an open
application no longer responds but the hard disk drive light
is blinking off and on. Other symptoms include noise being
made by the computer. This brings about an over-reliance on
system functions that require electricity and will result in
a faster decrease of battery life for laptops. In these
situations, the running processes are competing for
resources. In order to temporarily remedy the situation you
need to close programs that are not in use. To fix the
problem you will need to try one or more strategies.
-
Add more RAM.
-
Kill startup programs from running in the background (see
below for more information).
Causes for Concern… and Solutions
Your overall system performance can be affected by how well
your virtual memory is able to function and how well it is
managed. In some instances this may mean that you have to
“tweak” or fine-tune the settings. Before doing this it is
best that you do some initial research and have a clear idea
of what adjustments you are going to use beforehand.
If you are running Windows 98 we recommend visiting the
following site which has considerable information on virtual
memory and how to configure it for best performance:
http://computer.howstuffworks.com/virtual-memory.htm.
It appears that this article was not written recently – it
states that today’s computers have 32 to 64 megabytes (MB)
of RAM. However, it is applicable to Windows 98 systems and
you will find detailed information on how to configure
virtual memory (use the “Inside This Article” links at the
top of the page for easy navigation).
For more recent systems it is clear that today’s demand on
computers is greater than in the past and the addition of
RAM is commonplace. Even with 256 MB of RAM or more, your
computer system still requires paging and virtual memory
techniques. Software programs rely on paging to store
sensitive data rather than having to rely on “volatile”
(temporary) storage such as RAM. Also, it is common to run
several programs as we often multi-task while working on a
computer. It’s not unusual to have an instant messenger
program running in the background, while an email program is
running, while a word document is open, while listening to
music from your computer system.
To get a better idea of what is running on your system at
any one time you can use Windows Task Manager. You can
access the task manager by combining the following keys:
Ctrl + Shift + Esc. You can also
right-click an empty space in the taskbar and select the
Task Manager option. If you are running Windows 2000,
NT, XP, or Vista you can try the following:
-
Press and hold the following keys in sequence: Ctrl
+ Alt + Delete.
-
Your screen will change and a dialog with six options will
appear; click the Task Manager button.
The Task Manager has many functions including setting
priorities for processes, logging off or disconnecting
users, and ending tasks or processes. While these functions
are available to you, you need to use caution when ending a
process or application. This is not the usual way to close
applications and as a result data is not saved. We
recommend that you only use this option when you know what
the process is and other attempts have failed. Once you
have opened the Task Manager you can select any of the tabs
displayed at the top of the dialog. The Applications tab
will list all the active programs that are running. The
Processes tab provides a lot of information about the active
tasks that are running including “Mem Usage”. The
Performance tab will give you an idea of how heavily tasked
your CPU is and give you a clear indication of your Page
File Usage, the total amount of Physical Memory on your
system and what is cached and what is available.
Experts tend to lean to one solution when insufficient
memory is encountered – add more RAM. Another technique
involves changing your settings in an attempt to achieve
performance optimization. While you can choose to optimize
your page file, you should know that it will not improve
performance. Instead it will minimize system slow down when
you are using programs that place heavy demands on your
system or when multi-tasking. To examine methods of page
file optimization we suggest referring to information
presented in the following article:
http://www.techarp.com/showarticle.aspx?artno=143&pgno=3.
You can use the quick link menu at the bottom of the page to
see a list of topics and to link to one of your choice. In
these articles you can find out how to configure your page
file to make it permanent or semi-permanent and how to
ensure that it is contiguous.
If, like most computer users today, you are doing a
considerable amount of online browsing and you have done a
numerous software installations and un-installations, your
system could be prone to slow performance. When traversing
the Internet, files are automatically downloaded to your
system. Most of these are only meant for temporary use.
Over time a large number of downloaded items can clog up
your hard disk drive and your computer registry. Another
common occurrence that affects performance is when
applications automatically install by default to your
Startup list (Start | Programs | Startup). This has
considerable impact on how quick your computer starts as
these programs and processes are initiated each time you
start your computer. We recommend using a program that can
clean up unwanted and unused items from your registry and
also gives you the ability to decide what programs are
launched when you start your computer.
Malicious Software Attacks
With the virtual memory system there is a process referred
to as “memory protection”. This involves protecting the
memory allocated for a running process so that other
processes do not access it without permission.
Malfunctioning code in one program can cause problems with
other running programs if this protection mechanism is
violated. There are situations where malicious code can be
the cause of such violations as the offending program gains
access to your computer system.
The Windows Task Manager is commonly targeted and sabotaged
by malware (malicious software) and virus programs. In an
attempt to evade termination and detection, malware will try
to disable the manager program, modify the Task Manager’s
registry policy settings, or alter the Task Manager so as to
go unnoticed.
Defending yourself from such attacks is crucial as is being
able to remove these offenders from your system when they
are installed without your knowledge. Malware, also
commonly known as “spyware”, can be downloaded to your
system without your knowledge simply by browsing to a web
site. These programs can tax your system resources. Many
of these are adware programs that produce popup
advertisements and become more than an annoyance when
attempting to remove them. The first line of defence in
such situations is to use a software program that can detect
the items and remove them completely. Your choice for an
anti-spyware product should be based on having ongoing
updates so as to get the most recent and up-to-date
protection from these threats. We recommend XoftSpySe
Anti-Spyware.
|