Ict 3
Ict 3
From the moment you switch on a computer till you switch it off, the computer uses its primary
memory. When you request to process data and instructions, the processor uses its registers, cache
memory, primary memory, and secondary memory. As a computer user, you need to be aware of
the memory present in a computer. This chapter describes the different kinds of memories, their
use, and the interaction between them.
3.1 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. Modern
secondary storage devices, like SSDs and HDDs, offer large storage capacities and long-term data
retention. SSDs, using flash memory, are much faster than traditional magnetic disks, making
them ideal for high-performance tasks. HDDs remain cost-effective for large storage but are
slower due to their mechanical nature. Cloud storage also utilizes these technologies for fast,
reliable data solutions. The memories are organized in the computer in a manner that achieves
high levels of performance at the minimum cost.
In this chapter, we discuss different types of memories, their characteristics and their use in the
computer.
The computer memory stores different kinds of data like input data, output data, intermediate
results, etc., and the instructions. Binary digit or bit is the basic unit of memory. A bit is a single
binary digit, i.e., 0 or 1. A bit is the smallest unit of representation of data in a computer. However,
the data is handled by the computer as a combination of bits. A group of 8 bits form a byte. One
byte is the smallest unit of data that is handled by the computer. One byte can store 2 8, i.e., 256
different combinations of bits, and thus can be used to represent 256 different symbols. In a byte,
the different combinations of bits fall in the range 00000000 to 11111111. A group of bytes can
be further combined to form a word. A word can be a group of 2, 4 or 8 bytes.
1 bit = 0 or 1
Memory is logically organized as a linear array of locations. For a processor, the range of the
memory addresses is 0 to the maximum size of memory. Figure 3.1 shows the organization of a
16 MB block of memory for a processor with a 32-bit word length.
The memory is characterized based on two key factors — capacity and access time. Capacity is
the amount of information (in bits) that a memory can store. Access time is the time interval
between the read/ write request and the availability of data. The lesser the access time, the faster
is the speed of memory. Ideally, we want the memory with fastest speed and largest capacity.
However, the cost of fast memory is very high. The computer uses a hierarchy of memory that is
organized in a manner to enable the fastest speed and largest capacity of memory. The hierarchy
of the different memory types is shown in Figure 3.2.
Figure 3.2 Memory hierarchy.
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 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—The key features of internal memory are—(1) limited storage capacity,
(2) temporary storage, (3) fast access, and (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 in modern processors is typically less than 1 ns, allowing
near-instantaneous data access. Register sizes vary, but modern processors can have
register sets of several kilobytes, much larger than older systems which used to have 200B.
Cache memory sits between the CPU and main memory in the hierarchy, providing faster
access to frequently used data. Modern cache speeds typically range from less than 1 ns to
around 5 ns, depending on the cache level (L1, L2, L3), with L1 being the fastest and
closest to the CPU. The cache size varies depending on the level, ranging from around 32
KB for L1 cache to several megabytes (up to 64 MB or more) for L3 cache in modern
processors. 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 modern RAM, such as DDR4 and DDR5, typically ranges from 10 to 20 ns,
significantly faster than older memory technologies. The RAM size varies from 2GB to
128 GB.
• Secondary Memory — The key features of secondary memory storage devices are — (1)
very high storage capacity, (2) permanent storage (non-volatile), unless erased by the 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, and (5) cheapest among all memory.
The storage devices consist of two parts —drive and device. For example, magnetic tape
drive and magnetic tape, magnetic disk drive and disk, optical disk drive and disk, Hard
disk Drive and Hard disk, Solid State Drive and Solid state disk and Flash Disks. Figure
3.3 shows the interaction between CPU and memory.
To get the fastest speed of memory with the 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 memories. The secondary memory is magnetic or optical memory, has moving
parts and has slow speed.
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 registers available (typically tens to hundreds) and the larger their size (usually 32 to
64 bits in modern systems), the better the performance, as this allows faster data processing
and reduced reliance on slower memory access.
Cache memory is placed in between the CPU and the RAM. Cache memory is a fast
memory, faster than the RAM. When the CPU needs an instruction or data during
processing, it first looks in the cache. If the information is present in the cache, it is called
a cache hit, and the data or instruction is retrieved from the cache. If the information is not
present in cache, then it is called a cache miss and the information is then retrieved from
RAM. The content of cache is decided by the cache controller (a circuit on the
motherboard). The most recently accessed information or instructions help the controller
to guess the RAM locations that may be accessed next. To get good system performance,
the number of hits must far outnumber the misses. The two main factors that affect the
performance of cache are its size and level (L1, L2 and L3).
The CPU registers and the cache memory have been discussed in detail in the previous chapter.
Primary memory is the main memory of computer. It is a chip mounted on the motherboard of
computer. Primary memory is categorized into two main types-
RAM is used for the temporary storage of input data, output data and intermediate results. The
input data entered into the computer using the input device, is stored in RAM for processing. After
processing, the output data is stored in RAM before being sent to the output device. Any
intermediate results generated during the processing of program are also stored in RAM. Unlike
RAM, the data once stored in ROM either cannot be changed or can only be changed using some
special operations. Therefore, ROM is used to store the data that does not require a change. Flash
memory is another form of rewritable read-only memory that is compact, portable, and requires
little energy.
• RAM is used to store data and instructions during the operation of computer.
o The data and instructions that need to be operated upon by CPU are first brought
to RAM from the secondary storage devices like the hard disk.
o CPU interacts with RAM to get the data and instructions for processing.
• RAM loses information when the computer is powered off. It is a volatile memory. When
the power is turned on, again, all files that are required by the CPU are loaded from the
hard disk to RAM. Since RAM is a volatile memory, any information that needs to be
saved for a longer duration of time must not be stored in RAM.
• RAM provides random access to the stored bytes, words, or larger data units. This means
that it requires the same amount of time to access information from RAM, irrespective of
where it is located in it.
• RAM can be read from and written to with the same speed.
• The size of RAM is limited due to its high cost. The size of RAM is measured in MB or
GB.
• The performance of RAM is affected by—
o Access speed (how quickly information can be retrieved). The speed of RAM is
expressed in nanoseconds.
o Data transfer unit size (how much information can be retrieved in one request).
• RAM affects the speed and power of a computer. More the RAM, the better it is.
Nowadays, computers generally have 8 GB to 128 GB of RAM.
• RAM is a microchip implemented using semiconductors.
• There are two categories of RAM, depending on the technology used to construct a
RAM— (1) Dynamic RAM (DRAM), and (2) Static RAM (SRAM).
• DRAM is the most common type of memory chip. DRAM is mostly used as main memory
since it is small and cheap.
o It uses transistors and capacitors. The transistors are arranged in a matrix of rows
and columns. The capacitor holds the bit of information 0 and 1. The transistor and
capacitor are paired to make a memory cell. The transistor acts as a switch that lets the
control circuitry on the memory chip read the capacitor or change its state.
o DRAM must be refreshed continually to store information. For this, a memory
controller is used. The memory controller recharges all the capacitors holding a 1
before they discharge. To do this, the memory controller reads the memory and
then writes it right back.
o DRAM gets its name from the refresh operation that it requires to store the
information; otherwise it will lose what it is holding. The refresh operation occurs
automatically thousands of times per second. DRAM is slow because the
refreshing takes time.
Access speed of modern DRAM typically ranges from 10 to 50 ns, with improvements in
DDR4 and DDR5 technologies significantly reducing latency compared to older DRAM
versions
SRAM chip is usually used in cache memory due to its high speed.
o SRAM uses multiple transistors (four to six), for each memory cell. It does not
have a capacitor in each cell.
o A SRAM memory cell has more parts so it takes more space on a chip than
DRAM cell.
o It does not need constant refreshing and therefore is faster than DRAM.
o SRAM is more expensive than DRAM, and it takes up more space.
o It stores information as long as it is supplied with power.
o SRAM is easier to use and very fast, with access speeds typically ranging from
less than 1 ns to around 5 ns in modern systems, making it ideal for high-speed
cache memory. The memory chips (Figure 3.4) are available on a separate Printed
Circuit Board (PCB) that is plugged into a special connector on the motherboard.
Memory chips are generally available as part of a card called a memory module.
There are generally two types of RAM modules—Single Inline Memory Module (SIMM) and
Dual Inline Memory Module (DIMM).
Figure 3.4 PCB containing RAM chip of 8 GB
o SIMM modules have memory chip on one side of the PCB. SIMM modules can
store and transfer data in 32-bit units simultaneously, with older versions
transferring 8 or 16 bits at a time.
o DIMM modules have memory chips on both sides of the PCB. DIMM format are
64–bit memories. Smaller modules known as Small Outline DIMM (SO DIMM)
are designed for portable computers. SO DIMM modules have 32–bit memory.
o Power On Self Test (POST) is a program that runs automatically when the system
is booted. BIOS performs the power-on self-test. It checks that the major hardware
components are working properly.
o BIOS setup program, which is a built-in utility in BIOS, lets the user set the many
functions that control how the computer works. BIOS displays the system settings
and finds the bootable devices. It loads the interrupt handlers and device drivers.
It also initializes the registers.
o Bootstrap Loader is a program whose purpose is to start the computer software for
operation when the power is turned on. It loads the operating system into RAM
and launches it. It generally seeks the operating system on the hard disk. The
bootstrap loader resides in the ROM. The BIOS initiates the bootstrap sequence.
• ROMs are of different kinds. They have evolved from the fixed read only memory to the
ones that can be programmed and re-programmed. They vary in the number of re-writes
and the method used for the re-writing. Programmable ROM (PROM), Erasable
Programmable ROM (EPROM) and Electrically Erasable Programmable ROM
(EEPROM) are some of the ROMs. All the different kinds of ROM retain their content
when the power is turned off.
o PROM can be programmed with a special tool, but after it has been programmed
the contents cannot be changed. PROM memories have thousands of fuses (or diodes).
High voltage (12 V) is applied to the fuses to be burnt. The burnt fuses correspond to 0
and the others to 1.
o EPROM can be programmed in a similar way as PROM, but it can be erased by
exposing it to ultraviolet light and re-programmed. EPROM chips have to be
removed from the computer for re-writing.
o EEPROM memories can be erased by electric charge and re-programmed.
EEPROM chips do not have to be removed from the computer for re-writing.
• Flash Memory is a kind of semiconductor-based non-volatile, rewritable computer
memory that can be electrically erased and reprogrammed (Figure 3.6). It is a specific type
of EEPROM.
o It combines the features of RAM and ROM. It is a random access memory and its
content can be stored in it at any time. However, like ROM, the data is not lost
when the machine is turned off or the electric power is cut. Flash memory stores
bits of data in memory cells.
o Flash memories are high-speed memories, durable, and have low-energy
consumption. Since flash memory has no moving part, it is very shock-resistant.
Due to these features, flash memory is used in devices such as digital camera,
mobile phone, printer, laptop computer, and record and play back sound devices,
such as MP3 players.
In the previous section, we saw that RAM is expensive and has a limited storage capacity. Since
it is a volatile memory, it cannot retain information after the computer is powered off. Thus, in
addition to primary memory, an auxiliary or secondary memory is required by a computer. The
secondary memory is also called the storage device of computer. In this chapter, the terms
secondary memory and storage device are used interchangeably. In comparison to the primary
memory, the secondary memory stores much larger amounts of data and information (for example,
an entire software program) for extended periods of time. The data and instructions stored in
secondary memory must be fetched into RAM before processing is done by CPU.
Magnetic tape drives, hard disk drives (HDDs), solid-state drives (SSDs), and optical drives (such
as CD, DVD, and Blu-ray) are common types of storage devices. SSDs have largely replaced HDDs
for faster data access and reliability, while cloud storage and external drives (e.g., USB flash drives)
are also widely used. Optical drives have become less common due to the shift toward digital
downloads and streaming.
1. Sequential access
2. Direct access
Sequential access means that computer must run through the data in sequence, starting from the
beginning, to locate a particular piece of data. Magnetic tape is an example of sequential access
device. Let us suppose that magnetic tape consists of 80 records. To access the 25th record, the
computer starts from first record, then reaches second, third etc. until it reaches the 25th record.
Sequential access devices are generally slow devices. As a result, sequential access devices are
less commonly used for everyday data storage today, except in niche applications like data
archiving where high storage capacity is prioritized over speed.
Direct access devices are the ones in which any piece of data can be retrieved in a non-sequential
manner by locating it using the data’s address. It accesses the data directly, from a desired location.
Magnetic disks, solid-state drives (SSDs), and optical disks are examples of direct access devices,
allowing data to be read or written in any order. For instance, to access the 25th record in a
magnetic disk with 80 records, the system can directly retrieve it without reading the previous 24.
In contrast, magnetic tapes are sequential access devices, requiring data to be read in sequence.
Some of the storage devices were covered in the previous lecture. You are urged to make more
research about them. Especially HDD, SSD, SD card and Flash disks.