Why Is There A Need For Virtual Memory?: R: ET/COE/ND/19/003 Cousre: Cte 214 D: 6 S 2021

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

A SSIGNMENT

REG NO : ET/COE/ND/19/003

COUSRE: CTE 214

DATE : 6TH SEPTEMBER 2021

Virtual memory is an area of a computer system’s secondary memory storage space


(such as a hard disk or solid state drive) which acts as if it were a part of the
system’s RAM or primary memory.

Ideally, the data needed to run applications is stored in RAM, where they can be
accessed quickly by the CPU. But when large applications are being run, or when
many applications are running at once, the system’s RAM may become full.

To get around this problem, some data stored in RAM that is not actively being used
can be temporarily moved to virtual memory (which is physically located on a hard
drive or other storage device). This frees up space in RAM, which can then be used to
accommodate data which the system needs to access imminently.

By swapping data between RAM and virtual memory when it is not needed and back 
from virtual memory to RAM when it is needed, a system can continue to work
smoothly with far less physical RAM than it would otherwise require.

Virtual memory enables a system to run larger applications or run more applications
at the same time without running out of RAM.  Specifically, the system can operate as
if its total RAM resources were equal to the amount of physical RAM, plus the
amount of virtual RAM.

Why is There a Need for Virtual Memory?


Virtual memory was developed when physical RAM was very expensive, and RAM is
still more expensive per Gigabyte than storage media such as hard disks and solid
state drives. For that reason it is much less costly to use a combination of physical
RAM and virtual memory than to equip a computer system with more RAM.
Since using virtual memory (or increasing virtual memory) has no extra financial cost
(because it uses existing storage space) it offers a way for a computer to use more
memory than is physically available on the system.

Another key driver for the use of virtual memory is that all computer systems have a
limit (dictated by hardware and software) on the amount of physical RAM that can be
installed. Using virtual memory allows the system to continue to operate beyond those
physical RAM limits.

How Does Virtual Memory Work?


When an application (including the operating system) is running, it stores the location
of program threads and other data at a virtual address, while the data is actually stored
at a physical address in RAM. If later that RAM space is needed more urgently by
another process, then the data may be swapped out of RAM and into virtual memory.

The responsibility for keeping track of all this data as it is swapped between physical
and virtual memory falls to the computer’s memory manager. The memory manager
maintains a table which maps virtual addresses used by the operating system and
applications to the physical addresses that data is actually stored in. When data is
swapped between RAM and virtual memory, the table is updated so that a given
virtual address always points to the correct physical location.

A computer can only run threads and manipulate data that is stored in RAM rather
than virtual memory. And it takes a non-negligible amount of time to swap data that is
needed into RAM. Consequently, it follows that using virtual memory involves a
performance hit.

Put another way, a system with 4 GB RAM will generally offer higher performance
than a system with 2 GB RAM and 2 GB virtual memory because of the performance
hit caused by swapping, and for that reason it is said that virtual memory is slower
than RAM.

One potential problem with virtual memory is that if the amount of RAM present is
too small compared to the amount of virtual memory then a system can end up
spending a large proportion of its CPU resources swapping data back and forth.
Meanwhile, performance of useful work grinds to a near halt – a process known
as thrashing.
To prevent thrashing it is usually necessary to reduce the number of applications
being run simultaneously, or simply to increase the amount of RAM in the system.

Operating systems, such as most versions of Windows, generally recommend that


users do not increase virtual memory beyond 1.5 times the amount of physical RAM
present. So a system with 4 GB RAM should have virtual memory of no more than 6
GB.

To minimize the performance hit caused by swapping between physical and virtual
memory, it is best use the fastest storage device connected to the system to host the
virtual memory, and to locate the virtual memory storage are

Virtual memory can act in concert with a computer’s main memory to enable faster,
more fluid operations.

How to Increase Virtual Memory in a System


Most operating systems allow users to increase virtual memory from a configuration
page.

 In Windows, users can also allow the system to manage the amount of
virtual memory provided dynamically.

 Similarly, in the Mac OS, users can use the preferences panel to allot virtual
memory.

Advantages and Disadvantages of Virtual Memory


Even though RAM is now relatively inexpensive compared to its cost when virtual
memory was first developed, it is still extremely useful and it is still employed in
many, perhaps most, computer systems. The key problem with virtual memory relates
to performance.

Advantages  of Virtual Memory


 Allows more applications to be run at the same time.
 Allows larger applications to run in systems that do not have enough
physical RAM alone to run them.

 Provides a way to increase memory which is less costly than buying more
RAM.

 Provides a way to increase memory in a system which has the maximum


amount of RAM that its hardware and operating system can support.

Disadvantages of Virtual Memory


 Does not offer the same performance as RAM.

 Can negatively affect the overall performance of a system.

 Takes up storage space which could otherwise be used for long term data
storage.

REFERENCE

“What Is Virtual Memory? How Does It Work?”

From https://www.enterprisestorageforum.com/hardware/virtual-memory/

You might also like