VIRTUAL MEMORY
In a memory hierarchy system, programs and data are brought into main memory as they are
needed by the CPU.
Virtual memory is a concept used in some large computer systems that permit the user to
construct programs as though a large memory space were available, equal to
the totality of auxiliary memory.
Each address that is referenced by the CPU goes through an address mapping from the so-
called virtual address to a physical address in main memory.
Virtual memory is used to give programmers the illusion that they have a very large memory
at their disposal, even though the computer actually has a relatively small main memory.
A virtual memory system provides a mechanism for translating program-generated addresses
into correct main memory locations.
This is done dynamically, while programs are being executed in the CPU.
The translation or mapping is handled automatically by the hardware by means of a
mapping table.
ADDRESS SPACE AND MEMORY SPACE
An address used by a programmer will be called a virtual address, and the set of such
addresses, the address space.
An address in main memory is called a location or physical address.
The set of such locations is called the memory space.
Thus the address space is the set of addresses generated by programs as they reference
instructions and data;
the memory space consists of the actual main memory locations directly addressable for
processing.
In most computers the address and memory spaces are identical.
The address space is allowed to be larger than the memory space in computers with virtual
memory.
In a multiprogram computer system, programs and data are transferred to and from
auxiliary memory and main memory based on demands imposed by the CPU.
A virtual memory system is a combination of hardware and software techniques. The
memory management software system handles all the software operations for the efficient
utilization of memory space. It must decide
(1) which page in main memory ought to be removed to make room for a new page,
(2) when a new page is to be transferred from auxiliary memory to main
memory, and
(3) where the page is to be placed in main memory.
The hardware mapping mechanism and the memory management software together
constitute the architecture of a virtual memory.
Difference between Virtual memory and Cache memory:
S.N
O VIRTUAL MEMORY CACHE MEMORY
Virtual memory increases the While cache memory increase the accessing
1. capacity of main memory. speed of CPU.
Virtual memory is not a memory
2 unit, its a technique. Cache memory is exactly a memory unit.
The size of virtual memory is While the size of cache memory is less than
3. greater than the cache memory. the virtual memory.
Operating System manages the On the other hand hardware manages the
4. Virtual memory. cache memory.
In virtual memory, The program
with size larger than the main While in cache memory, recently used data is
5. memory are executed. copied into.
ASSOCIATIVE MEMORY
Many data-processing applications require the search of items in a table stored in memory.
An assembler program searches the symbol address table in order to extract the symbol’s
binary equivalent.
An account number may be searched in a file to determine the holder’s name and
account status.
The established way to search a table is to store all items where they can be
addressed in sequence.
The search procedure is a strategy for choosing a sequence of addresses, reading the content
of memory at each address, and comparing the information read with the item
being searched until a match occurs.
The number of accesses to memory depends on the location of the item and the efficiency of
the search algorithm.
Many search algorithms have been developed to minimize the number of accesses while
searching for an item in a random or sequential access memory.
The time required to find an item stored in memory can be reduced considerably if stored
data can be identified for access by the content of the data itself rather than by an address.
A memory unit accessed by content is called an associative memory or content addressable
memory(CAM).
This type of memory is accessed simultaneously and in parallel on the basis of data
content rather than by specific address or location.
When a word is written in an associative memory, no address is given,. The memory is
capable of finding an empty unused location to store the word.
When a word is to be read from an associative memory, the content of the word,
or part of the word, is specified.
The memory locaters all words which match the specified content and marks them for
reading.
Because of its organization, the associative memory is uniquely suited to do parallel
searches by data association.
Moreover, searches can be done on an entire word or on a specific field within a word.
An associative memory is more expensive then a random access memory because each cell
must have storage capability as well as logic circuits for matching its content
with an external argument.
For this reason, associative memories are used in applications where the search time is very
critical and must be very short.