Computer Memory 1
Computer Memory 1
I. INTRODUCTION
The computer’s memory stores data, instructions required during the processing of
data, and output results. Storage may be required for a limited period of time,
instantly, or, for an extended period of time. Different types of memories, each having
its own unique features, are available for use in a computer. The cache memory,
registers, and RAM are fast memories and store the data and instructions temporarily
during the processing of data and instructions. The secondary memory like magnetic
disks and optical disks has large storage capacities and store the data and instructions
permanently, but are slow memory devices.
The memories are organized in the computer in a manner to achieve high levels of
performance at the minimum cost.
2
D
The Internal Memory and External Memory are the two broad categories of
memory used in the computer. The Internal Memory consists of the CPU
registers, cache memory and primary memory. The internal memory is used by
the CPU to perform the computing tasks. The External Memory is also called
the Auxiliary or secondary memory. The secondary memory is used to store
the large amount of data and the software.
In general, referring to the computer memory usually means the internal
memory.
Internal Memory
3
The key features of internal memory are:
1. Limited storage capacity.
2. Temporary storage.
3. Fast access.
4. High cost.
Registers, cache memory, and primary memory constitute the internal memory.
The primary memory is further of two kinds: RAM and ROM. Registers are the
fastest and the most expensive among all the memory types. The registers are
located inside the CPU, and are directly accessible by the CPU. The speed of
registers is between 1-2 ns (nanosecond). The sum of the size of registers is
about 200B. Cache memory is next in the hierarchy and is placed between the
CPU and the main memory. The speed of cache is between 2-10 ns. The cache
size varies between 32 KB to 64MB. Any program or data that has to be
executed must be brought into RAM from the secondary memory. Primary
memory is relatively slower than the cache memory. The speed of RAM is
around 60ns. The RAM size varies from 512KB to 64GB.
Secondary Memory
The key features of secondary memory storage devices are:
1. Very high storage capacity.
2. Permanent storage (non-volatile), unless erased by user.
3. Relatively slower access.
4. Stores data and instructions that are not currently being used by CPU
but may be required later for processing.
5. Cheapest among all memory.
To get the fastest speed of memory with largest capacity and least cost, the fast
memory is located close to the processor. The secondary memory, which is not
as fast, is used to store information permanently, and is placed farthest from
the processor.
With respect to CPU, the memory is organized as follows:
Registers are placed inside the CPU (small capacity, high cost, very high
speed)
Cache memory is placed next in the hierarchy (inside and outside the
CPU)
Primary memory is placed next in the hierarchy
Secondary memory is the farthest from CPU (large capacity, low cost,
low speed) The speed of memories is dependent on the kind of technology used
for the memory. The registers, cache memory and primary memory are
semiconductor memories. They do not have any moving parts and are fast
4
memories. The secondary memory is magnetic or optical memory has
moving parts and has slow speed.
V. CPU REGISTERS
Registers are very high-speed storage areas located inside the CPU. After CPU
gets the data and instructions from the cache or RAM, the data and instructions
are moved to the registers for processing. Registers are manipulated directly by
the control unit of CPU during instruction execution. That is why registers are
often referred to as the CPU’s working memory. Since CPU uses registers for
the processing of data, the number of registers in a CPU and the size of each
register affect the power and speed of a CPU. The more the number of registers
(ten to hundreds) and bigger the size of each register (8 bits to 64 bits), the
better it is.
5
memory unit and the delivery of the requested data. It's a crucial factor in
determining the overall performance of a computer system, especially in
applications that require rapid data access.
Level 2 (L2) cache or Secondary Cache
L2 is secondary type cache memory. The Size of the L2 cache is more capacious
than L1 that is between 256KB to 1MB. L2 cache is located on computer
microprocessor. After searching the Instructions in L1 Cache, if not found then it
searched into L2 cache by computer microprocessor. The high-speed system bus
interconnecting the cache to the microprocessor.
Location: Located near the CPU, either per core or shared by multiple cores.
Speed: Slower than L1 but still much faster than main memory (RAM).
Level 3 (L3) cache or Main Memory
The L3 cache is larger in size but also slower in speed than L1 and L2, its size is
between 4MB to 64MB. In Multicore processors, each core may have separate
L1 and L2, but all cores share a common L3 cache. L3 cache double speed than
the RAM.
Location: Shared among all cores of a multi-core processor.
Speed: Slower than L2, but faster than accessing system RAM.
Level 4 (L4) cache or Main Memory
Level 4 (L4) cache is relatively uncommon compared to L1, L2, and L3 caches, but it
exists in some high-performance processors. It generally serves as an additional layer
between the CPU and main memory (RAM). Acts as a larger but slower cache
compared to L1, L2, and L3 caches. It provides an intermediate storage layer to reduce
latency when accessing data from main memory. Typically ranges from 128 MB to
several GB. For example, some Intel processors, like those with integrated eDRAM
(embedded DRAM), use an L4 cache of around 128 MB.
Location: Can be either on-die (integrated within the CPU) or off-die (on a separate
chip), sometimes shared across the entire CPU and GPU in certain architectures.
Speed: Faster than main memory (RAM) but slower than L1, L2, and L3 caches. It
reduces the time spent accessing main memory for frequently used data or
instructions.
Use Cases: Common in high-performance CPUs or processors that handle graphics
or intensive data processing tasks. For example, Intel's Crystal Well architecture
uses L4 cache for integrated graphics performance optimization.
6
The advantages and disadvantages of cache memory are as follows:
Advantages
The advantages of cache memory are as follows:
Cache memory is faster than main memory.
It consumes less access time as compared to main memory.
It stores the program that can be executed within a short period of time.
It stores data for temporary use.
Disadvantages
The disadvantages of cache memory are as follows:
Cache memory has limited capacity.
It is very expensive.
7
Types of Primary Memory
1. RAM (Random Access Memory)
The Word “RAM” stands for “random access memory” or may also refer
to short- term memory. It’s called “random” because you can read store
data randomly at any time and from any physical location. It is a temporal
storage memory. RAM is volatile that only retains all the data as long as
the computer powered. It is the fastest type of memory. RAM stores the
currently processed data from the CPU and sends them to the graphics unit.
The latest technologies in RAM (Random Access Memory) are focused on
improving speed, capacity, efficiency, and durability to meet the
demands of modern computing.
8
Comparison of SRAM and DRAM
9
memory bridges the gap between DRAM and storage. It’s used for fast data
access in data centers and high-performance applications.
6. MRAM: An emerging non-volatile memory technology with high endurance
and fast speeds, making it promising for AI, edge computing, and embedded
systems.
7. ReRAM: Another emerging non-volatile memory technology with faster
speeds than NAND flash, it’s a potential candidate for next-gen storage and
embedded memory.
8. Faster Memory Interfaces (CXL and Gen-Z):
o CXL: Enables faster data transfers between memory and processors,
reducing latency and boosting bandwidth for AI and data centers.
o Gen-Z: Provides direct access to shared memory pools between
processors, enhancing memory interconnects.
2. ROM (Read Only Memory)
ROM is the long-term internal memory. ROM is “Non-Volatile Memory”
that retains data without the flow of electricity. ROM is an essential chip
with permanently written data or programs. It is similar to the RAM that is
accessed by the CPU. ROM comes with pre-written by the computer
manufacturer to hold the instructions for booting-up the computer.
There is generally three broad type of ROM:
• PROM (Programmable Read Only Memory): PROM stands for
programmable ROM. It can be programmed only be done once and read
many. Unlike RAM, PROMs retain their contents without the flow of
electricity. PROM is also nonvolatile memory. The significant difference
between a ROM and a PROM is that a ROM comes with pre-written by
the computer manufacturer whereas PROM manufactured as blank
memory. PROM can be programmed by PROM burner and by blowing
internal fuses permanently.
• EPROM (Erasable Programmable Read Only Memory): EPROM is
pronounced ee-prom. This memory type retains its contents until it
exposed to intense ultraviolet light that clears its contents, making it
possible to reprogram the memory.
• EEPROM (Electrically Erasable Programmable Read Only Memory):
EEPROM can be burned (programmed) and erased by first electrical
10
waves in a millisecond. A single byte of a data or the entire contents of
device can be erased. To write or erase this memory type, you need a
device called a PROM burner.
3. Hybrid types
As memory technology has matured in recent years, the line between RAM and ROM
has blurred. Now, several types of memory combine features of both. These devices
do not belong to either group and can be collectively referred to as hybrid memory
devices. Hybrid memories can be read and written as desired, like RAM, but maintain
their contents without electrical power, just like ROM. Two of the hybrid devices,
EEPROM and flash, are descendants of ROM devices. These are typically used to
store code. The third hybrid, NVRAM, is a modified version of SRAM. NVRAM
usually holds persistent data.
Hybrid memory types blend the speed and flexibility of RAM with the non-volatility
of ROM, providing fast data access while retaining data even when powered off.
Here's a summary of common hybrid memory types:
11
Key Characteristics
Solid-State Drives (SSDs) are a type of data storage device that uses flash memory to store data
persistently, unlike traditional Hard Disk Drives (HDDs), which rely on spinning magnetic disks.
Flash memory uses NAND, (NAND is an acronym that stands for "Not AND." It's a logic gate used
in digital circuits to perform a specific logical operation) to store data without moving parts, making
them faster and more durable than HDDs. SSDs have become increasingly popular due to their
numerous advantages over traditional storage solutions.
Advantages of SSDs
1. Speed -The most significant advantage of SSDs is their speed. They significantly reduce boot
times, application load times, and file transfer speeds, leading to improved overall system
performance.
12
2. Durability: Due to the absence of moving parts, SSDs are less susceptible to damage from
drops and shocks, making them ideal for portable devices.
3. Lower Latency SSDs offer lower latency compared to HDDs, resulting in faster data
retrieval and improved responsiveness.
4. Noise Reduction: SSDs operate silently, while HDDs can produce noise from spinning disks
and moving read/write heads.
5. Energy Efficiency: The lower power consumption of SSDs can lead to longer battery life for
laptops and reduced electricity costs for data centers.
Types of SSDs
1. SATA SSDs: Uses the SATA interface, which limits speed compared to other types.
Commonly used in upgrading older systems to improve performance.
2. NVMe SSDs: Connects via the PCIe interface, allowing for significantly higher data transfer
rates. Ideal for high-performance tasks such as gaming, video editing, and data-intensive
applications.
3. M.2 SSDs: A compact form factor that can support both SATA and NVMe protocols. They
are commonly used in ultrabooks and desktops with limited space.
4. External SSDs: Portable SSDs connected via USB or Thunderbolt, offering fast external
storage solutions for users on the go.
5. Enterprise SSDs: Designed for data centers and enterprise applications, these SSDs are
optimized for durability, performance, and high write endurance.
Applications of SSDs
13
High density: NAND flash memory can store a large amount of data in a
relatively small space.
Fast read speeds: NAND flash memory can read data very quickly, making it
suitable for applications that require rapid data access.
Slower write speeds: While read speeds are fast, write speeds can be slower,
especially for large amounts of data.
Limited write cycles: NAND flash cells have a limited number of times they
can be programmed and erased before they wear out. This is typically measured
in program-erase (P/E) cycles.
Wear leveling: To distribute writes evenly across all cells and prolong the life
of the memory, NAND flash controllers use wear leveling algorithms.
Discs that use laser technology to read and write data to a plastic disc coated with a reflective
material.
o Capacity:
CDs: ~700 MB
DVDs: ~4.7 GB to 17 GB (dual-layer)
Blu-ray: ~25 GB to 128 GB
o Speed: Significantly slower than HDDs and SSDs, but cost-effective for archival
purposes.
o Use Cases: Archiving, software distribution, media storage (movies, music), and
backup.
Portable storage devices that use NAND flash memory, similar to SSDs, but in smaller, removable
form factors.
14
5. Memory Cards (SD, microSD)
Small, portable storage devices used primarily in cameras, smartphones, and tablets.
6. Cloud Storage
Cloud storage is a model of data storage in which digital data is stored on remote servers that are
accessed via the internet, rather than being stored locally on a physical device like a hard drive or
SSD. This model allows users and organizations to store, manage, and retrieve data from anywhere
with an internet connection. Cloud storage has become increasingly popular due to its convenience,
scalability, and accessibility.
15
Characteristics of Cloud Storage
1. Remote Accessibility: Data stored in the cloud can be accessed from any device connected to
the internet, including laptops, smartphones, and tablets. This provides users with flexibility
and ease of access.
2. Scalability: Cloud storage solutions can easily scale up or down according to the needs of the
user or organization. This means users can increase storage capacity as their data needs grow
without needing to invest in additional physical hardware.
3. Cost-Effectiveness: Many cloud storage providers offer pay-as-you-go pricing models,
allowing users to pay only for the storage they use. This reduces upfront costs associated with
purchasing and maintaining physical storage infrastructure.
4. Data Redundancy and Backup: Most cloud storage providers implement redundancy
measures, storing multiple copies of data across different locations. This helps protect against
data loss due to hardware failure or disasters.
5. Collaboration Features: Cloud storage often includes collaboration tools that allow multiple
users to access, edit, and share files simultaneously. This is particularly beneficial for teams
working on projects together.
6. Security Measures: Cloud storage providers typically employ various security protocols,
including encryption, access controls, and authentication measures, to safeguard data from
unauthorized access.
1. Accessibility: Users can access their data from anywhere in the world at any time, making it
ideal for remote work and travel.
2. Cost Savings: Reduces the need for physical storage hardware and the associated
maintenance costs, leading to potential savings for both individuals and organizations.
3. Automatic Updates and Maintenance: Cloud storage services are typically managed by the
provider, meaning users benefit from automatic updates, backups, and maintenance without
additional effort.
4. Enhanced Collaboration: Teams can easily share files and collaborate in real-time,
improving productivity and efficiency in projects.
5. Disaster Recovery: In case of data loss due to hardware failure or other disasters, cloud
storage provides an effective disaster recovery solution, as data is backed up off-site.
16
Types of Cloud Storage
1. Public Cloud: Cloud storage services offered over the internet by third-party providers (e.g.,
Google Drive, Dropbox, Amazon S3). Users share the same infrastructure but have their data
isolated and secure.
2. Private Cloud: Cloud storage solutions that are dedicated to a single organization, providing
greater control over data security and privacy. Private clouds can be hosted on-premises or by
a third-party provider.
3. Hybrid Cloud: Combines elements of both public and private clouds, allowing organizations
to keep sensitive data secure in a private cloud while leveraging the scalability and cost-
effectiveness of public cloud resources for less sensitive data.
4. Community Cloud: A shared cloud infrastructure that is used by several organizations with
similar interests or requirements, such as security, compliance, or performance.
1. File Storage and Backup: Individuals and businesses use cloud storage for securely storing
files and data backups, ensuring they are protected against data loss.
2. Application Hosting: Cloud storage is often used to host applications and data for SaaS
(Software as a Service) solutions, enabling users to access software applications over the
internet.
3. Media Hosting: Cloud storage is widely used for storing and distributing media content, such
as videos, images, and audio files, facilitating streaming services and media sharing
platforms.
4. Collaboration Tools: Many productivity tools (e.g., Google Workspace, Microsoft 365)
leverage cloud storage to allow users to collaborate on documents and projects in real time.
5. Big Data Analytics: Cloud storage provides the infrastructure necessary for storing and
processing large volumes of data, enabling organizations to analyze and derive insights from
big data.
7. Magnetic Tapes
An older technology that stores data on reels of magnetic tape, still used for archival purposes in
some industries.
o Capacity: 100 GB to 15 TB per tape, depending on the technology (e.g., LTO tapes).
o Speed: Very slow compared to modern HDDs and SSDs but cost-effective for large-
volume storage.
o Use Cases: Long-term archival, data backup in large enterprises, and for
compliance reasons (e.g., financial and healthcare data storage).
17
Comparison of Secondary Memory to Primary Memory
IDE Technology
IDE, also known as ATA (Advanced Technology Attachment), was introduced in the 1980s and
became the standard interface for connecting hard drives and optical drives to computers. IDE
technology employs a parallel data transfer method, where multiple bits of data are transmitted
simultaneously over multiple wires. Standard IDE cables can support two devices per channel
(master/slave configuration). The maximum data transfer rates for IDE technology are relatively low.
The most common version, ATA/133, can achieve speeds up to 133 MB/s, although real-world
speeds are typically lower. IDE uses a 40-pin or 80-pin ribbon cable to connect drives to the
motherboard. The physical bulk of the ribbon cables can make cable management difficult in modern
cases. IDE technology has several limitations, including:
18
1. Limited speed compared to newer technologies. Due to the parallel interface, IDE has a
relatively limited data transfer rate compared to SATA.
2. Bulkiness of the ribbon cables.
3. Master/slave configuration restrictions, which complicate drive setup and can lead to
performance bottlenecks. IDE can support a maximum of four storage devices on a single
cable.
SATA Technology
SATA was introduced in 2003 as a successor to IDE technology, offering a more efficient and
flexible interface for connecting storage devices to computers. SATA uses a serial data transfer
method, transmitting data one bit at a time over a single channel. SATA devices are connected to the
motherboard using a data cable and a power cable. SATA utilizes a thin, flexible cable with a 7-pin
connector, allowing for easier cable management and better airflow within the computer case. This
allows for higher speeds and more efficient data transfer. Many SATA controllers support hot
swapping, allowing devices to be added or removed without powering down the computer. SATA
technology has evolved through several versions, each increasing the maximum data transfer rate:
19
5. Legacy Systems: As SATA became the standard, IDE technology has become largely
obsolete, with most modern motherboards no longer supporting IDE connections. This has
necessitated the use of SATA drives in new builds and upgrades.
The shift from IDE technology to SATA technology has revolutionized the way
storage devices connect to computers, offering significant improvements in speed,
efficiency, and usability. As technology continues to evolve, SATA remains a key
player in data storage, though newer interfaces like NVMe (Non-Volatile Memory
Express) are beginning to emerge, further pushing the boundaries of performance in
the digital landscape.
Virtual Memory
Virtual memory is a memory management technique used by operating systems to
provide an "idealized abstraction of the storage resources" that allows a computer to
compensate for physical memory shortages by temporarily transferring data from
random access memory (RAM) to disk storage. memory management technique
used by operating systems to provide a program with the illusion of having more
memory available than is physically present. It does this by mapping a portion of the
hard disk to serve as an extension of the physical RAM. This enables systems to run
larger applications or multiple applications simultaneously without running out of
physical memory.
Characteristics of Virtual Memory
1. Abstraction: Virtual memory provides an abstraction layer that allows programs
to operate as though they have access to a large contiguous block of memory,
regardless of the actual physical memory available.
2. Paging: Virtual memory is typically implemented using a method called paging,
where memory is divided into fixed-size blocks called pages. Similarly, the
virtual address space is divided into corresponding blocks called virtual pages.
These pages are mapped to physical memory frames, which may not be
contiguous.
3. Segmentation: In addition to paging, some systems implement segmentation,
where memory is divided into segments of varying lengths based on logical
divisions in a program, such as functions or data structures.
4. Page Table: The operating system maintains a page table that keeps track of the
mapping between virtual addresses (used by the program) and physical addresses
(used by the hardware). This table enables the OS to quickly translate virtual
addresses into physical addresses.
20
5. Page Fault: If a virtual page is not currently in physical memory, a page fault
occurs. The operating system must then load the required page from the hard disk
into a free physical memory frame.
6. Swapping: When the physical memory is full, the operating system may use a
process called swapping to move less frequently used pages from RAM to a
special area on the hard drive known as the swap space or paging file. This frees
up RAM for more active processes.
Advantages of Virtual Memory
1. Increased Memory Capacity: Virtual memory allows systems to use more
memory than is physically available by leveraging disk storage, enabling the
execution of larger applications or multiple applications concurrently.
2. Isolation and Security: Each process runs in its own virtual address space,
providing isolation between processes and enhancing security. This prevents one
process from accessing the memory space of another process.
3. Simplified Memory Management: Virtual memory simplifies memory
management for programmers by allowing them to use a large, contiguous block
of memory without worrying about the physical organization of memory.
4. Efficiency: The operating system can manage memory more efficiently by
keeping the most frequently accessed pages in physical memory while offloading
less frequently used pages to disk storage.
5. Simplified Programming Model: Programmers can write applications without
worrying about the limits of physical memory, leading to better resource
utilization and increased application performance.
Disadvantages of Virtual Memory
1. Performance Overhead: Accessing data in virtual memory can be slower than
accessing data in physical memory. If a program frequently accesses pages that
have been swapped out to disk (a phenomenon known as thrashing), it can lead
to performance degradation.
2. Disk Space Usage: Virtual memory requires disk space for the swap file or
paging file. If the disk space is limited, it can constrain the amount of virtual
memory available.
3. Complexity: The implementation of virtual memory adds complexity to the
operating system and requires additional hardware support, such as a Memory
Management Unit (MMU).
21
4. Fragmentation: Over time, the virtual memory system can become fragmented,
leading to inefficient use of disk space and increased overhead in managing page
tables.
Applications of Virtual Memory
1. Operating Systems: Most modern operating systems, including Windows,
Linux, and macOS, use virtual memory to manage memory resources and
provide a better user experience.
2. Multi-User Environments: Virtual memory is essential in multi-user
environments, where multiple processes run concurrently without interfering
with one another.
3. Large Applications: Applications that require large amounts of memory, such as
database management systems, graphic design software, and video editing tools,
benefit greatly from virtual memory.
4. Gaming: Virtual memory allows modern video games to run smoothly by
managing large assets and resources efficiently.
5. Development and Testing: Developers can test applications under various
memory conditions, ensuring their software is robust and efficient in utilizing
system resources.
Virtual memory is a critical component of modern operating systems, allowing for
more efficient memory management and enabling the execution of larger
applications. While it has its drawbacks, the advantages it provides in terms of
flexibility, security, and increased memory capacity make it an essential technology
in computing today. As software and hardware continue to evolve, virtual memory
will remain a key factor in managing system resources effectively.
22