Information Technology Reference
In-Depth Information
execute them concurrently. Another advantage is
that the program can start the execution even just
after only a small portion of the program memory
has been loaded
In a virtual memory system any process is ex-
ecuted in a virtual machine that is allocated only
for the process. The process accesses addresses
in the virtual address space. And it can ignore
other processes that use the physical memory at
the same time. The task of the programmer and
the compiler becomes much easier because they
do not need to delve into the details of memory
management difficulties.
Virtual memory systems easily enable to pro-
tect the memory of processes from an access of
other processes, whereas on the other hand virtual
memory systems enable a controlled sharing of
memory portions between several processes. This
state of affairs makes the implementation of mul-
titasking much easier for the operating system.
Nowadays, computers usually have large
memories; hence, the well-known virtual memory
mechanism is mostly utilized for secure or shared
memory. The virtual machine interface also ben-
efits the virtual memory mechanism, whereas the
original need of loading too large processes into
the memory is not so essential anymore (Jacob,
2002).
Virtual memory operates in a similar way to
the cache memory. When there is a small fast
memory and a large slow memory, a hierarchy of
memories will be assembled. In virtual memory
the hierarchy is between the RAM and the disk.
The portion of the program that a chance of ac-
cessing to them is higher will be saved in the fast
memory; whereas the other portions of the pro-
gram will be saved in the slow memory and will
be moved to the fast memory just if the program
accesses them. The effective access time to the
memory is the weighted average that based on
the access time of the fast memory, the access
time of the slow memory and the hit ratio of the
fast memory. The effective access time will low
if the hit ratio is high.
A high hit ratio will be probably produced be-
cause of the locality principle which stipulates that
programs tend to access again and again instruc-
tions and data that they have accessed them lately.
There is a time locality and position locality. Time
locality means the program might access again the
same memory addresses in a short time. Position
locality means the program might access again not
only the same memory address in a short time,
but also the nearby memory addresses might be
accessed in a short time. According to the locality
principles, if instructions or data have been loaded
into the memory, there is a high chance that these
instructions or data will be accessed soon again. If
the operating system loads also program portions
that contain the “neighborhood” of the original
instructions or data, the chances to increase the
hit ratio, will be even higher.
With the purpose of implementing virtual
memory, the program memory space is split into
pieces that are moved between the disk and the
memory. Typically, the program memory space is
split into equal pieces called pages. The physical
memory is also split into pieces in the same size
called frames.
There is an option to split the program into
unequal pieces called segments. This split is logi-
cal; therefore, it is more suitable for protection
and sharing; however on the other hand, since the
pieces are not equal, there will be a problem of
external fragmentation. To facilitate both of the
advantages, there are computer architectures that
use segments of pages.
When a program tries to access a datum in an
address that is not available in the memory, the
computer hardware will generate a page fault.
The operating system handles the page fault by
loading the missing page into the memory while
emptying out a frame of the memory if there is a
need for that. The decision of which page should
be emptied out is typically based on LRU. The
time needed by the pure LRU algorithm is too
costly because we will need to update too many
data after every memory access, so instead most
Search WWH ::




Custom Search