Unit V Theory and Numerical Solution
Unit V Theory and Numerical Solution
Auxiliary memory, also known as secondary storage, is a crucial component of a computer system. It
provides non-volatile storage, meaning it retains data even when the computer is powered off. This
allows for long-term storage of programs and data that are not actively being used by the CPU.
• High capacity: Offers significantly larger storage capacity compared to primary memory (RAM).
• Lower cost per bit: More economical for storing large amounts of data.
• Slower access speed: Accessing data from auxiliary memory is slower than accessing data from
RAM.
1. Magnetic Storage:
o Magnetic Disks: These are circular platters coated with magnetic material. Data is stored
by magnetizing or demagnetizing spots on the disk surface.
▪ Hard Disk Drives (HDDs): Consist of multiple platters stacked on a spindle, with
read/write heads that access data on each surface. HDDs offer high capacity and
relatively fast access times.
▪ Floppy Disks: Older, portable storage medium with lower capacity and slower
access times compared to HDDs.
o Magnetic Tapes: These are plastic tapes coated with magnetic material. Data is stored
sequentially along the tape. Magnetic tapes are commonly used for backups and archival
storage due to their high capacity and low cost.
2. Optical Storage:
o CDs (Compact Discs): Data is stored as microscopic pits on a reflective surface. CDs are
read by a laser beam.
o DVDs (Digital Versatile Discs): Similar to CDs but with higher storage capacity due to
smaller pit size and multiple layers.
o Blu-ray Discs: Use a blue laser with a shorter wavelength, allowing for even higher
storage capacity than DVDs.
3. Solid-State Storage:
o Solid State Drives (SSDs): Use flash memory to store data. SSDs have no moving parts,
resulting in significantly faster access times, lower power consumption, and greater
durability compared to HDDs.
o USB Flash Drives: Portable storage devices that use flash memory. They are small,
convenient, and widely used for transferring data between computers.
Memory Hierarchy:
Auxiliary memory forms the lowest level of the memory hierarchy in a computer system. This hierarchy
consists of:
2. Cache Memory: Fast memory used to store frequently accessed data from RAM.
3. Main Memory (RAM): Volatile memory used to store actively running programs and data.
• Permanent Storage: Enables long-term storage of programs, data, and operating systems.
• Data Backup and Archiving: Provides a means to create backups of important data and archive
old data for future use.
• Program Storage: Stores application programs that can be loaded into RAM when needed.
• Virtual Memory: Extends the apparent size of RAM by using a portion of auxiliary memory as a
swap space.
Summary
Solid-State
Feature Magnetic Storage Optical Storage
Storage
Storage
Magnetization Optical reading Flash memory
Mechanism
Access Speed Slower Slower Faster
Capacity High Medium Medium to High
Cost Low Medium Higher
Durability Moderate Moderate High
Common HDD, Magnetic SSD, USB Flash
CD, DVD, Blu-ray
Examples Tape Drive
Memory Hierarchy
Memory Hierarchy is one of the most required things in Computer Memory as it helps in optimizing the
memory available in the computer. There are multiple levels present in the memory, each one having a
different size, different cost, etc. Some types of memory like cache, and main memory are faster as
compared to other types of memory but they are having a little less size and are also costly whereas
some memory has a little higher storage value, but they are a little slower. Accessing of data is not
similar in all types of memory, some have faster access whereas some have slower access.
• External Memory or Secondary Memory: Comprising of Magnetic Disk, Optical Disk, and
Magnetic Tape i.e. peripheral storage devices which are accessible by the processor via an I/O
Module.
• Internal Memory or Primary Memory: Comprising of Main Memory, Cache Memory & CPU
registers . This is directly accessible by the processor.
1. Registers
Registers are small, high-speed memory units located in the CPU. They are used to store the most
frequently used data and instructions. Registers have the fastest access time and the smallest storage
capacity, typically ranging from 16 to 64 bits.
2. Cache Memory
Cache memory is a small, fast memory unit located close to the CPU. It stores frequently used data and
instructions that have been recently accessed from the main memory. Cache memory is designed to
minimize the time it takes to access data by providing the CPU with quick access to frequently used data.
3. Main Memory
Main memory , also known as RAM (Random Access Memory), is the primary memory of a computer
system. It has a larger storage capacity than cache memory, but it is slower. Main memory is used to
store data and instructions that are currently in use by the CPU.
• Static RAM: Static RAM stores the binary information in flip flops and information remains valid
until power is supplied. It has a faster access time and is used in implementing cache memory.
• Dynamic RAM: It stores the binary information as a charge on the capacitor. It requires
refreshing circuitry to maintain the charge on the capacitors after a few milliseconds. It contains
more memory cells per unit area as compared to SRAM.
4. Secondary Storage
Secondary storage, such as hard disk drives (HDD) and solid-state drives (SSD) , is a non-volatile memory
unit that has a larger storage capacity than main memory. It is used to store data and instructions that
are not currently in use by the CPU. Secondary storage has the slowest access time and is typically the
least expensive type of memory in the memory hierarchy.
5. Magnetic Disk
Magnetic Disks are simply circular plates that are fabricated with either a metal or a plastic or a
magnetized material. The Magnetic disks work at a high speed inside the computer and these are
frequently used.
6. Magnetic Tape
Magnetic Tape is simply a magnetic recording device that is covered with a plastic film. It is generally
used for the backup of data. In the case of a magnetic tape, the access time for a computer is a little
slower and therefore, it requires some amount of time for accessing the strip.
• Capacity: It is the global volume of information the memory can store. As we move from top to
bottom in the Hierarchy, the capacity increases.
• Access Time: It is the time interval between the read/write request and the availability of the
data. As we move from top to bottom in the Hierarchy, the access time increases.
• Performance: Earlier when the computer system was designed without a Memory Hierarchy
design, the speed gap increased between the CPU registers and Main Memory due to a large
difference in access time. This results in lower performance of the system and thus,
enhancement was required. This enhancement was made in the form of Memory Hierarchy
Design because of which the performance of the system increases. One of the most significant
ways to increase system performance is minimizing how far down the memory hierarchy one has
to go to manipulate data.
• Cost Per Bit: As we move from bottom to top in the Hierarchy, the cost per bit increases i.e.
Internal Memory is costlier than External Memory.
Advantages of Memory Hierarchy
• It helps in removing some destruction, and managing the memory in a better way.
Associative memory
Associative memory is also known as content addressable memory (CAM) or associative storage or
associative array. It is a special type of memory that is optimized for performing searches through data,
as opposed to providing a simple direct access to the data based on the address.
It can store the set of patterns as memories when the associative memory is being presented with a key
pattern, it responds by producing one of the stored pattern which closely resembles or relates to the key
pattern.
In conventional memory, data is stored in specific locations, called addresses, and retrieved by
referencing those addresses. In associative memory, data is stored together with additional tags or
metadata that describe its content. When a search is performed, the associative memory compares the
search query with the tags of all stored data, and retrieves the data that matches the query.
Associative memory is designed to quickly find matching data, even when the search query is incomplete
or imprecise. This is achieved by using parallel processing techniques, where multiple search queries can
be performed simultaneously. The search is also performed in a single step, as opposed to conventional
memory where multiple steps are required to locate the data.
• Match Register: It has m-bits, One bit corresponding to each word in the memory array. After the
making process, the bits corresponding to matching words in match register are set to ‘1’.
• Associative Memory Array: It combines word in that are to be compared with the arguments
word in parallel. It contains ‘m’ words with ‘n’ bit per word.
3. Networking: Associative memory is used in network routing tables to quickly find the path to a
destination network based on its address.
4. Image processing: Associative memory is used in image processing applications to search for
specific features or patterns within an image.
4. It is used in page tables used by the virtual memory and used in neural networks.
Virtual Memory
Virtual memory is a memory management technique used by operating systems to give the
appearance of a large, continuous block of memory to applications, even if the physical memory
(RAM) is limited. It allows larger applications to run on systems with less RAM.
• The main objective of virtual memory is to support multiprogramming, The main
advantage that virtual memory provides is, a running process does not need to be
entirely in memory.
• Programs can be larger than the available physical memory. Virtual Memory provides an
abstraction of main memory, eliminating concerns about storage limitations.
• A memory hierarchy, consisting of a computer system’s memory and a disk, enables a
process to operate with only some portions of its address space in RAM to allow more
processes to be in memory.
A virtual memory is what its name indicates- it is an illusion of a memory that is larger than the
real memory. We refer to the software component of virtual memory as a virtual memory
manager. The basis of virtual memory is the noncontiguous memory allocation model. The
virtual memory manager removes some components from memory to make room for other
components.
Types of Virtual Memory
In a computer, virtual memory is managed by the Memory Management Unit (MMU), which is
often built into the CPU. The CPU generates virtual addresses that the MMU translates into
physical addresses.
There are two main types of virtual memory:
• Paging
• Segmentation
Paging
Paging divides memory into small fixed-size blocks called pages. When the computer runs out of
RAM, pages that aren’t currently in use are moved to the hard drive, into an area called a swap
file. The swap file acts as an extension of RAM. When a page is needed again, it is swapped back
into RAM, a process known as page swapping. This ensures that the operating system (OS) and
applications have enough memory to run.
Segmentation
Segmentation divides virtual memory into segments of different sizes. Segments that aren’t
currently needed can be moved to the hard drive. The system uses a segment table to keep
track of each segment’s status, including whether it’s in memory, if it’s been modified, and its
physical address. Segments are mapped into a process’s address space only when needed.
• Since there are 4 bytes per word, the cache size in words is 16384 bytes / 4 bytes/word = 4096
words
• Number of cache lines = Cache size in words / Block size = 4096 words / 4 words/block = 1024
lines
3. Address Breakdown:
With a 32-bit address, we need to divide it into three parts for a direct-mapped cache:
• Block Offset: Since each block contains 4 words, we need 2 bits to select a word within a block
(2<sup>2</sup> = 4).
• Index: We have 1024 cache lines, so we need 10 bits to index into the cache (2<sup>10</sup> =
1024).
• Tag: The remaining bits are used for the tag. Tag bits = 32 (total address bits) - 2 (block offset
bits) - 10 (index bits) = 20 bits.
• Tag: 20 bits
• Valid Bit: 1 bit (to indicate whether the cache line contains valid data) 1
Total bits in the cache = Number of cache lines * Bits per cache line = 1024 lines * 149 bits/line = 152576
bits
Therefore, a total of 152,576 bits are required for the direct-mapped cache.