You are on page 1of 91

UNIT - 4

MEMORY
WHAT IS MEMORY HIERARCHY?
 The memory hierarchy is the arrangement of
various types of storage on a computing system
based on access speed.

 It organizes computer storage according to


response time. Since response time, complexity,
and capacity are all connected, the levels can also
be distinguished by their performance and
controlling technologies.
MEMORY HIERARCHY DESIGN

1. Cache Memory
 It is the fastest type of memory and is located
closest to the CPU.
 It stores frequently accessed data and
instructions, making it faster to retrieve them
than from the main memory.
 There are typically two or three levels of cache
memory, with each level having a larger capacity
and slower access speed than the previous level.
2. MAIN MEMORY
 It is the primary memory of a computer system.
 It is slower than cache memory but faster than
secondary storage.
 The data and instructions stored in the main
memory can be accessed directly by the CPU.
3. SECONDARY STORAGE

 Secondary storage such as hard disks, is used for


long-term storage of large amounts of data that
cannot fit in the main memory.
 It is slower than the main memory but has a
much larger capacity and is persistent (i.e.,
retains data even when the power is turned off).
4. REGISTERS
 Registers are the fastest and smallest type of
memory, located directly within the central
processing unit (CPU).
 They store small amounts of data that are
frequently accessed by the CPU.
 They also hold data, instructions, and control
information that the CPU needs to perform
operations.
 The storage capacity for registers ranges from 16
to 64 bits.
5. MAGNETIC DISKS

 Magnetic disks, like HDDs, store data


magnetically on spinning platters.
 They offer high storage capacity and support both
sequential and random access.
 However, they are less durable and slower than
solid-state drives (SSDs).
 Still used for bulk data storage in some systems,
they provide cost-effective storage options for
various applications.
6. MAGNETIC TAPE

 Magnetic Tape is a sequential data storage


medium consisting of a long plastic ribbon coated
with a magnetic material.
 It's known for its high-capacity, low cost per
gigabyte, and longevity. Magnetic tape is used
primarily for archival purposes and data backup.
 Accessing data on tape is slower compared to disk
drives but well-suited for infrequently accessed
data.
ADVANTAGES OF MEMORY HIERARCHY
 Faster access: Due to multiple levels in the memory
hierarchy, users get faster access to frequently used data.
Cache memory, the fastest memory, stores the most
frequently used data.

 Cost-effective: Using the most expensive memory only


where it is needed can help us reduce the cost. Cache
memory is more expensive than main memory or secondary
storage. With the help of memory hierarchy, it can be used
only in necessary areas rather than using it everywhere.

 Efficient use of resources: Computer resources can be


used effectively by memory hierarchy, ensuring no waste of
resources. For example, high-speed access to a particular
data set that is not frequently used results in a waste of
resources.
 Increased capacity: A system can store large
data in secondary storage devices such as Hard
drives and SSD (solid-state drives) through
memory hierarchy. On the other hand, the most
frequently used data is stored inside the cache.

 Increased processing speed: By memory


hierarchy, operations can be performed much
faster as the fastest memory can be used for the
most frequently used data. The CPU can access
the data in a faster manner, which in turn,
increases the processing speed.
WHAT IS SEMICONDUCTOR MEMORY?
 A device for storing digital information that is
fabricated by using integrated circuit technology
is known as semiconductor memory.
 It is used to store program and data.
RANDOM ACCESS MEMORY (RAM):
 Type: Unpredictable – information evaporates
without power.
 Function: stores data for active applications on
a temporary basis.
 Speed: lightning-fast access in a flash.

 Capacity: Normally more modest than ROM.

 Applications: Running projects, open


documents, program tabs.
OPERATION OF 128*8 RAM CHIP
 A 128 * 8 RAM chip has a memory capacity of 128
words of eight bits (one byte) per word. This requires
a 7-bit address and an 8-bit bidirectional data bus.
 The 8-bit bidirectional data bus allows the transfer of
data either from memory to CPU during
a read operation or from CPU to memory during
a write operation.
 The read and write inputs specify the memory
operation, and the two chip select (CS) control inputs
are for enabling the chip only when the
microprocessor selects it.
 The bidirectional data bus is constructed using three-
state buffers.
 The output generated by three-state buffers can be
placed in one of the three possible states which
include a signal equivalent to logic 1, a signal equal to
logic 0, or a high-impedance state.
 A ROM memory is used for keeping programs and data that
are permanently resident in the computer.
Apart from the permanent storage of data, the ROM portion
of main memory is needed for storing an initial program
called a bootstrap loader. The primary function of
the bootstrap loader program is to start the computer
software operating when power is turned on.
ROM chips are also available in a variety of sizes and are also
used as per the system requirement. The following block
diagram demonstrates the chip interconnection in a 512 * 8
ROM chip.
 A ROM chip has a similar organization as a RAM
chip. However, a ROM can only perform read
operation; the data bus can only operate in an
output mode.
 The 9-bit address lines in the ROM chip specify
any one of the 512 bytes stored in it.
 The value for chip select 1 and chip select 2 must
be 1 and 0 for the unit to operate. Otherwise, the
data bus is said to be in a high-impedance state.
2D MEMORY ORGANIZATION
 In 2D organization, memory is divided in the
form of rows and columns(Matrix). Each row
contains a word, now in this memory
organization, there is a decoder. A decoder is a
combinational circuit that contains n input lines
and 2n output lines. One of the output lines
selects the row by the address contained in the
MAR and the word which is represented by that
row gets selected and is either read or written
through the data lines.
2.5D MEMORY ORGANIZATION
 In 2.5D Organization the scenario is the same
but we have two different decoders one is a
column decoder and another is a row decoder.
Column decoder is used to select the column and
a row decoder is used to select the row. The
address from the MAR goes as the decoders’
input. Decoders will select the respective cell
through the bit outline, then the data from that
location will be read or through the bit, inline
data will be written at that memory location.
COMPARISON BETWEEN 2D & 2.5D
ORGANIZATIONS –
 In 2D organization hardware is fixed but in 2.5D
hardware changes.
 2D Organization requires more gates while 2.5D
requires less.
 2D is more complex in comparison to the 2.5D
organization.
 Error correction is not possible in the 2D
organization but in 2.5D it could be done easily.
 2D is more difficult to fabricate in comparison to
the 2.5D organization.
2D MEMORY ORGANIZATION:
Advantages:
 Simplicity: 2D memory organization is a simple and straightforward
approach, with memory chips arranged in a two-dimensional grid.
 Cost-Effective: 2D memory organization is cost-effective, making it a
popular choice for many low-power and low-cost devices.
 Low Power: 2D memory organization has low power consumption,
making it ideal for use in mobile devices and other portable
electronics.

Disadvantages:
 Limited Bandwidth: 2D memory organization has limited
bandwidth due to the sequential access pattern of memory chips,
which can lead to slower data transfer rates.
 Limited Capacity: 2D memory organization has limited capacity
since it requires memory chips to be arranged in a two-dimensional
grid, limiting the number of memory chips that can be used.
 Limited Scalability: 2D memory organization is not scalable,
making it difficult to increase memory capacity or performance
without adding more memory chips.
2.5D MEMORY ORGANIZATION:
Advantages:
 Higher Bandwidth: 2.5D memory organization has higher bandwidth since it
uses a high-speed interconnect between memory chips, enabling faster data
transfer rates.
 Higher Capacity: 2.5D memory organization has higher capacity since it can
stack multiple memory chips on top of each other, enabling more memory to be
packed into a smaller space.
 Scalability: 2.5D memory organization is highly scalable, making it easier to
increase memory capacity or performance without adding more memory chips.

Disadvantages:
 Complexity: 2.5D memory organization is more complex than 2D memory
organization since it requires additional interconnects and packaging
technologies.
 Higher Cost: 2.5D memory organization is generally more expensive than 2D
memory organization due to the additional interconnects and packaging
technologies required.
 Higher Power Consumption: 2.5D memory organization has higher power
consumption due to the additional interconnects and packaging technologies,
making it less ideal for use in mobile devices and other low-power electronics.
WHAT IS CACHE MAPPING?
 As we know that the cache memory bridges the
mismatch of speed between the main memory and the
processor. Whenever a cache hit occurs,
 The word that is required is present in the memory of
the cache.
 Then the required word would be delivered from the
cache memory to the CPU.
 And, whenever a cache miss occurs,
 The word that is required isn’t present in the memory
of the cache.
 The page consists of the required word that we need
to map from the main memory.
 We can perform such a type of mapping using various
different techniques of cache mapping.
CHARACTERISTICS OF CACHE MEMORY
 Cache memory is an extremely fast memory type
that acts as a buffer between RAM and the CPU.
 Cache Memory holds frequently requested data and
instructions so that they are immediately available
to the CPU when needed.
 Cache memory is costlier than main memory or disk
memory but more economical than CPU registers.
 Cache Memory is used to speed up and synchronize
with a high-speed CPU.
More than 4Mb
8 kb - 64kb 64kb – 4
mb
LEVELS OF MEMORY
Level 1
 It is a type of memory in which data is stored and
accepted that are immediately stored in CPU. Most
commonly used register is accumulator, Program
counter, address register etc.
Level 2
 It is the fastest memory which has faster access time
where data is temporarily stored for faster access.
Level 3
 It is memory on which computer works currently. It is
small in size and once power is off data no longer
stays in this memory.
Level 4
 It is external memory which is not as fast as main
memory but data stays permanently in this memory.
BASIC OPERATIONS OF CACHE MEMORY
Its basic operations are as follows:
 The CPU first checks any required data in the
cache. Furthermore, it does not access the main
memory if that data is present in the cache.
 On the other hand, if the data is not present in
the cache then it accesses the main memory.
 The block of words that the CPU accesses
currently is transferred from the main memory to
the cache for quick access in the future.
 The hit ratio defines the performance of the
cache memory.
CACHE PERFORMANCE
 The performance of the cache is in terms of the hit ratio.
 The CPU searches the data in the cache when it requires writing or read
any data from the main memory. In this case, two cases may occur as
follows:
 If the CPU finds that data in the cache, a cache hit occurs and it reads the
data from the cache.
 On the other hand, if it does not find that data in the cache, a cache
miss occurs. Furthermore, during cache miss, the cache allows the entry of
data and then reads data from the main memory.
 Therefore, we can define the hit ratio as the number of hits divided by the
sum of hits and misses.
hit ratio = hit / (hit + miss)
= number of hits/total accesses
Also, we can improve cache performance by:
 using a higher cache block size.
 higher associativity.
 reducing the miss rate.
 reducing the time to hit in the cache.
WHAT IS CACHE MAPPING?
 As we know that the cache memory bridges the
mismatch of speed between the main memory and the
processor. Whenever a cache hit occurs,
 The word that is required is present in the memory of
the cache.
 Then the required word would be delivered from the
cache memory to the CPU.
 And, whenever a cache miss occurs,
 The word that is required isn’t present in the memory
of the cache.
 The page consists of the required word that we need to
map from the main memory.
 We can perform such a type of mapping using various
different techniques of cache mapping.
PROCESS OF CACHE MAPPING
 The process of cache mapping helps us define
how a certain block that is present in the main
memory gets mapped to the memory of a cache in
the case of any cache miss.
 In simpler words, cache mapping refers to a
technique using which we bring the main
memory into the cache memory. Here is a
diagram that illustrates the actual process of
mapping:

TECHNIQUES OF CACHE MAPPING
DIRECT MAPPING
 In the case of direct mapping, a certain block of the
main memory would be able to map a cache only up
to a certain line of the cache. The total line
numbers of cache to which any distinct block can
map are given by the following:
 Cache line number = (Address of
the Main Memory Block ) Modulo
(Total number of lines in Cache)
FOR EXAMPLE,
 Let us consider that particular cache memory is
divided into a total of ‘n’ number of lines.
 Then, the block ‘j’ of the main memory would be able
to map to line number only of the cache (j mod n).
DIVISION OF PHYSICAL ADDRESS
 In the case of direct mapping, the division of the
physical address occurs as follows:
FULLY ASSOCIATIVE MAPPING
 In the case of fully associative mapping,
 The main memory block is capable of mapping to
any given line of the cache that’s available freely
at that particular moment.
 It helps us make a fully associative mapping
comparatively more flexible than direct mapping.
 For Example
 Let us consider the scenario given as follows:

Here, we can see that,


 Every single line of cache is available freely.

 Thus, any main memory block can map to a line


of the cache.
 In case all the cache lines are occupied, one of the
blocks that exists already needs to be replaced.
K-WAY SET ASSOCIATIVE MAPPING

 In the case of k-way set associative mapping,


 The grouping of the cache lines occurs into various
sets where all the sets consist of k number of lines.
 Any given main memory block can map only to a
particular cache set.
 However, within that very set, the block of memory
can map any cache line that is freely available.
 The cache set to which a certain main memory block
can map is basically given as follows:
 Cache set number = ( Block Address of the Main
Memory ) Modulo (Total Number of sets present in
the Cache)
 For Example
 Let us consider the example given as follows of a two-
way set-associative mapping:
 In this case,
 k = 2 would suggest that every set consists of two
cache lines.
 Since the cache consists of 6 lines, the total
number of sets that are present in the cache = 6 /
2 = 3 sets.
 The block ‘j’ of the main memory is capable of
mapping to the set number only (j mod 3) of the
cache.
 Here, within this very set, the block ‘j’ is capable
of mapping to any cache line that is freely
available at that moment.
 In case all the available cache lines happen to be
occupied, then one of the blocks that already exist
needs to be replaced.
SPECIAL CASES
 In case k = 1, the k-way set associative mapping
would become direct mapping. Thus,
 Direct Mapping = one-way set associative
mapping
 In the case of k = The total number of lines
present in the cache, then the k-way set
associative mapping would become fully
associative mapping.
 Consider a direct mapped cache of size 16 KB with
block size 256 bytes. The size of main memory is 128
KB. Find-
 1. Number of bits in tag

 2. Tag directory size

Solution-
Given-
• Cache memory size = 16 KB
• Block size = Frame size = Line size = 256 bytes
• Main memory size = 128 KB
We consider that the memory is byte addressable.
Number of Bits in Physical Address-
We have,
Size of main memory = 128 KB
= 2^17 bytes
Thus, Number of bits in physical address = 17 bits

Number of Bits in Block Offset-


We have,
 Block size = 256 bytes = 2^8 bytes
 Thus, Number of bits in block offset = 8 bits

Number of Bits in Line Number-


Total number of lines in cache
= Cache size / Line size
= 16 KB / 256 bytes
= 2^14 bytes / 2^8 bytes
= 2^6 lines
Thus, Number of bits in line number = 6 bits
Number of bits in a tag:
= Number of bits in physical address – (Number of
bits in line number + Number of bits in block
offset)
= 17 bits – (6 bits + 8 bits)
= 17 bits – 14 bits
= 3 bits
Thus, Number of bits in tag = 3 bits
Tag Directory Size-
= Number of tags x Tag size
= Number of lines in cache x Number of bits in tag
= 26 x 3 bits
= 192 bits
= 24 bytes
Thus, size of tag directory = 24 bytes

Q Consider a direct mapped cache of size 512 KB


with block size 1 KB. There are 7 bits in the tag.
Find-
1. Size of main memory
2. Tag directory size
ADVANTAGES OF CACHE MEMORY
 It is faster than the main memory.
 The access time is quite less in comparison to the
main memory.
 The speed of accessing data increases hence, the
CPU works faster.
 Moreover, the performance of the CPU also
becomes better.
 The recent data stores in the cache and therefore,
the outputs are faster.
DISADVANTAGES OF CACHE MEMORY

 It is quite expensive.
 The storage capacity is limited.
AUXILIARY MEMORY

 An Auxiliary memory is known as the lowest-


cost, highest-capacity and slowest-access storage
in a computer system. It is where programs and
data are kept for long-term storage or when not
in immediate use. The most common examples of
auxiliary memories are magnetic tapes and
magnetic disks.
MAGNETIC TAPE

 Magnetic tape is a storage medium that allows data


archiving, collection, and backup for different kinds of
data. The magnetic tape is constructed using a plastic
strip coated with a magnetic recording medium.
 The bits are recorded as magnetic spots on the tape
along several tracks. Usually, seven or nine bits are
recorded simultaneously to form a character together
with a parity bit.
 Magnetic tape units can be halted, started to move
forward or in reverse, or can be rewound. However,
they cannot be started or stopped fast enough
between individual characters. For this reason,
information is recorded in blocks referred to as
records.
ADVANTAGES :
 These are inexpensive, i.e., low cost memories.
 It provides backup or archival storage.

 It can be used for large files.

 It can be used for copying from disk files.

 It is a reusable memory.

 It is compact and easy to store on racks.


DISADVANTAGES :

 Sequential access is the disadvantage, means it


does not allow access randomly or directly.
 It requires caring to store, i.e., vulnerable
humidity, dust free, and suitable environment.
 It stored data cannot be easily updated or
modified, i.e., difficult to make updates on data.
MAGNETIC DISKS

 A magnetic disk is a type of memory constructed


using a circular plate of metal or plastic coated
with magnetized materials. Usually, both sides of
the disks are used to carry out read/write
operations. However, several disks may be
stacked on one spindle with read/write head
available on each surface.
 The memory bits are stored in the magnetized
surface in spots along the concentric circles called
tracks.
 The concentric circles (tracks) are commonly
divided into sections called sectors.
ADVANTAGES
 Access time − With a magnetic disk, it is
achievable to access a record explicitly. Therefore
access time is less in this case.
 Flexibility − Magnetic disk has to be the
flexibility of being used as a sequential as well as
direct access storage device.
 Transmission Speed − The rate of data
transfer is fast in a magnetic disk.
 Reusable − It can remove a specific data and
save another data at the same place.
 Storage Capacity − It can store a very large
amount of data.
DISADVANTAGES:-
 Cost − The cost of per character storage is much
higher as compared to magnetic tape.
 Non-Portability − Portability of it is very less
as compared to magnetic tape.
 Limited size record − Duration of record which
can be saved on it is limited by the size of disk
track or disk sector.
 Non-human readable − Data stored on it is not
in human-readable form, therefore manual
encoding is not possible at all.
OPTICAL DISK

 An optical disk is any computer disk that uses


optical storage techniques and technology to read
and write data. It is a storage device using
optical (light) energy. It is a computer storage
disk that stores data digitally and uses laser
beams to read and write data. It uses optical
technology in which laser light is central to the
spinning disks.
ADVANTAGES OF OPTICAL DISKS :
 Cost –
The total cost involves when you look at the manufacturing is
low Optical disks since only aluminium foils and plastics are
involved within the production. Hence, the users in many cases
are benefited from the worth of buying optical disks in bulk.
And a lot of computers include optical disc Drive from its
manufacturer that is respective in that the users don’t got to
purchase them separate.
 Durability –
Optical disks are more durable than both Volatile and
memories that are non-Volatile. It’s not subjected to wear and
now any charged power failures may cause data losses.
Therefore, it should last long for many years. Nevertheless, it’s
not completely protected against scratching, heat as well as
other sorts of physical damages.
 Simplicity –
The approach to back up is created much simpler using Optical
disks. No matter what the data that really must be burnt must
be placed in the drive icon. Then in just clicking on ” Burn Disk
” the users can back up the info
 Portability –
Although Optical disks are fairly large enough,
they truly are still portable. They’ll be placed
inside bags along with other small objects in
order that it in many cases are transported to
varied places and utilized in different computers
and devices.
 Stability –
Optical disks usually provides a level that is high
of. This is because unlike magnetic disks, it’s not
prone to electromagnetic fields and other sorts of
environmental influences.
 Versatile –
Optical disks are very versatile as it helps
computer system act as music system.
DISADVANTAGES OF OPTICAL DISC :
 Security –
When the Optical disks are employed for backup purposes,
it must be kept safe through the hands of thieves. Thanks
to its size, the optical disks are more at risk of loss and
theft.
 Capacity –
Optical disks cost more per GB/TB than the other sorts of
storage drives. And it also to don’t have a lot of or no
storage capacity when compared with them. Unless it’s a
Blu-ray disc, the utmost storage the Optical disks offers is
4.7GB.
 Reliability –
Unlike flash drives, Optical disks aren’t protected by any
plastic casings. Therefore, they may be susceptible to
scratching which makes the disk unreadable. The info
thereon cannot be recovered anymore,
 Duplication –
Making a replica copy employing an optical disc
isn’t easier because this indicates on a USB flash
drive. When it comes to way of burning there
should be a software that is separate hardware.
Albeit there are lots of party that is third for this
function, the latest versions of windows consists
of a write-up software.
 User Friendliness –
Although it takes very low cost to manufacture
Optical disks, it’s actually not inside the case of
backup.
VIRTUAL MEMORY: EXPANDING THE
ADDRESS SPACE
 While cache reminiscence targets to hurry up memory to get entry
to, virtual reminiscence tackles the mission of dealing with the
confined bodily memory to be had in a laptop machine. It gives the
phantasm of a larger address space than physically exists via
leveraging disk garage as an extension of most important memory.
 In digital reminiscence systems, the bodily reminiscence is divided
into fixed-length blocks referred to as pages. Similarly, the digital
deal with space used by packages is split into pages of the same
size. When a program references a reminiscence location, it makes
use of a virtual cope with. This digital cope is then translated right
into a physical deal with the reminiscence management unit
(MMU).
 Virtual reminiscence allows a couple of applications to proportion
the same bodily reminiscence while preserving isolation. Each
application operates within its very own digital scope with space,
blind to different packages jogging simultaneously. This isolation
prevents programs from interfering with every change and
enhances machine stability.
 When the physical reminiscence turns into complete, the
operating machine makes use of a way known as demand
paging to transfer every so often used page to disk, making
area for greater vital pages. When an application accesses a
web page that is not currently in physical memory (a page
fault occurs), the working system retrieves the page from
disk and places it into memory. This retrieval introduces
better latency because of disk access, but it avoids program
crashes and enables green usage of physical memory.
 Virtual memory gives numerous benefits past expanding
the scope of space. It enables the green execution of huge
programs by way of loading handiest the necessary pages
into memory, maintaining valuable sources. Additionally, it
simplifies reminiscence control for the running device, as it
is able to quickly allocate and deallocate pages without
worrying about approximately contiguous blocks of bodily
memory.
1. BALANCE THE SHORTAGE OF PHYSICAL
SPACE
Virtual memory has gained popularity over the years
owing to its capacity to compensate for physical RAM.
Paging and segmentation methods ensure that main
memory is freed up for necessary and critical
operations.
2. Inexpensive virtual memory
 Virtual memory does not necessarily replicate the
true power of physical memory. However, its
inexpensive nature makes it a viable alternative to
complement RAM. If you own a compatible system,
adding virtual memory is possible without technical
knowledge, physical soldering, or physical space. It
settles within the system’s hardware limit and boosts
the device performance, especially in mobile phones,
without causing a financial burden.
3. SUPPORTS MULTITASKING AND
COLLABORATION
 Virtual memory allows users to utilize more RAM space
than the hardware permits. The logical memory space goes
beyond the physical limits that help the execution of
processes that demand more memory than what the
system can manage. As a result, the system’s turnaround
time improves considerably. Moreover, virtual memory
enables multiprogramming wherein multiple users or
processes can access shared memory, enhancing CPU and
RAM utilization.
4. AVOID MEMORY FRAGMENTATION
 The workflow of virtual memory does not demand
contacting physical MMU. Users can execute segments
residing in the virtual RAM necessary for a program based
on individual memory mapping. It enables easy program
data management as processes can utilize unused memory
segments that often cause ‘memory fragmentation.’
Consequently, the need for external I/O (input/output)
devices for efficient memory management is also reduced.
5. ENHANCE DATA SECURITY
 The computer’s memory management system
uses page tables to record physical and virtual
memory addresses. This reduces the possibility of
data loss that may occur during space swapping.
Segment tables follow a similar procedure.
Moreover, virtual memory is characterized by the
‘memory isolation’ feature, where the process
memory stays isolated from the kernel and other
processes during execution. This reduces the
chances of data manipulation and spying.
1. HOLDS VITAL STORAGE SPACE
 Although users prefer enhanced system performance, virtual memory
can sometimes take up precious storage space, leading to a loss of
storage capacity. Such situations may not arise some of the time as
modern devices are provided with storage units that are durable and
quick. Also, they possess sufficient capacity that can manage complex
address-mapping procedures. Hence, the problem of capturing vital
storage space was observed earlier but has gradually faded with
technological advancement.
2. SLOWER SPEED THAN PHYSICAL
MEMORY
 Irrespective of the configuration type, physical RAM reveals higher
speeds than virtual memory when operated on the system’s internal
storage. When virtual memory is used on external storage, the
constant reading and writing can impact the overall lifespan of the
external device. One cannot avoid such consequences as it is the
fundamental nature of virtual memories. In short, applications take
longer to execute in virtual memory, thanks to page swapping.
3. CONTEXT SWITCH REQUIRES EXTRA
TIME
 Physical memory is equipped with necessary hardware and
software components that simultaneously balance multiple
processes. It makes RAM speedy and versatile. However,
virtual memory performs context switching between high-
priority and low-priority processes to elevate performance.
The switching process causes quantifiable delays.
Moreover, if low-speed storage is used for paging and
segmentation, this situation can worsen further.
4. STABILITY PROBLEMS
 With virtual memory, program execution depends on
memory capabilities that exceed what the underlying
hardware can support. This can sometimes lead to system
instability, slowdown, or even crash. Also, with page miss
events, page swapping can consume more time. That
significantly impacts the speed of program execution,
resulting in sluggish performance.
5. PRONE TO MARKETING GIMMICKS
 As the advantages of virtual memory are widely
known, several manufacturers tend to use smart
wording strategies to attract customers. The devices
are presented so customers are sometimes fooled into
believing the marketing gimmicks. For example, an
8GB RAM can be sold at the price of 4GB. The cost
difference is adjusted by providing 4GB physical RAM
and 4GB virtual memory.
 The details are mentioned on RAM’s specification
sheet, but customers tend to overlook them. Since end
consumers can easily buy 8GB RAM at the price of
4GB, they feel satisfied. However, when users analyze
the system’s real-time performance, they realize that
the promised RAM speed fails to deliver as expected
USES OF VIRTUAL MEMORY

 Extended Addressable Memory: Virtual reminiscence lets


in a laptop device to increase its addressable reminiscence
beyond the physical barriers of the primary memory (RAM). It
affords a bigger digital cope with space that can be utilized by
programs, despite the fact that the bodily memory is smaller.
 Memory Management: Virtual memory permits efficient
reminiscence management by dividing the digital address
space into fixed-length blocks called pages. These pages are
stored in secondary storage (commonly the hard disk) and are
swapped in and out of the main memory as wished. This
allows the machine to run more packages simultaneously than
the physical reminiscence could accommodate.
 Memory Isolation: Virtual reminiscence affords memory
isolation between unique tactics walking on a computer. Each
system has its personal virtual address space, which is
mapped to the bodily reminiscence through the working
machine. This prevents one manner from gaining access to or
modifying the reminiscence of any other method, improving
system safety and stability.
 Demand Paging: Virtual reminiscence implements a
technique known as demand paging, wherein only the
required pages of a software are loaded into memory whilst
needed. This reduces the preliminary loading time and allows
programs to execute even if their entire code and information
can't fit inside the physical memory right now.
 Memory Swapping: When the bodily reminiscence will
become complete, virtual reminiscence swaps out less
regularly used pages from the primary memory to the
secondary storage, making room for brand new pages.
Swapped-out pages can be brought lower back into
reminiscence when they may be wanted again. This swapping
manner happens transparently to the running programs.
 Memory Protection: Virtual memory allows memory safety
mechanisms, allowing the running machine to allocate
reminiscence areas as read-best, study-write, or execute-
handiest. This prevents unauthorized access or change of
crucial reminiscence areas, improving machine safety.
Cache Memory Virtual Memory

Location Located close to the CPU Exists in secondary


(at the processor chip) garage (e.G., hard disk)
Size Smaller in length in Larger in size compared
comparison to to essential memory
predominant (extends addressable
reminiscence (RAM) space)
Purpose Provides faster get
admission to to regularly
used records Extends
available memory
capability and manages
reminiscence assets
Access Time Extremely speedy access Slower get right of entry
time (nanoseconds) to time as compared to
cache reminiscence
(milliseconds)
Hierarchy Multiple stages of cache Single-degree
(L1, L2, L3) reminiscence hierarchy
Cost More highly-priced Less high priced in
according to unit of keeping with unit of
garage storage
Control Controlled immediately Controlled through the
by using the CPU and its working system (OS)
cache controller
Scope Limited to the bounds of Shared by way of more
a single processor than one strategies and
applications

Data Persistence Volatile memory Non-unstable


(statistics is misplaced reminiscence
whilst strength is (information is retained
became off) even when electricity is
off)

Granularity Works at the extent of Works at the extent of


cache lines or blocks of reminiscence pages
records

Access Mechanism Hardware-primarily Software-controlled,


based, obvious to the handled with the aid of
software program the running gadget
Locality Principle Exploits temporal and Utilizes demand paging
spatial locality of and swapping based on
statistics get admission application needs
to
Performance Impact Directly affects Indirectly affects overall
processor performance performance with the
and velocity aid of coping with
reminiscence resources

You might also like