Module : 4
Memory Organization :
The memory is organized in the form of a cell, each cell is able to be
identified with a unique number called address. Each cell is able to
recognize control signals such as “read” and “write”, generated by CPU
when it wants to read or write address. Whenever CPU executes the
program there is a need to transfer the instruction from the memory to
CPU because the program is available in memory. To access the instruction
CPU generates the memory request.
Memory Request:
Memory request contains the address along with the control signals. For
Example, When inserting data into the stack, each block consumes
memory (RAM) and the number of memory cells can be determined by the
capacity of a memory chip.
Example: Find the total number of cells in 64k*8 memory chip.
With the number of cells, the number of address lines required to enable
one cell can be determined.
Word Size:
It is the maximum number of bits that a CPU can process at a time and it
depends upon the processor. Word size is a fixed size piece of data
handled as a unit by the instruction set or the hardware of a processor.
With the number of cells, the number of address lines required to enable
one cell can be determined.
Word Size:
It is the maximum number of bits that a CPU can process at a time and it
depends upon the processor. Word size is a fixed size piece of data
handled as a unit by the instruction set or the hardware of a processor.
Digital Computers use Binary number system to represent all types of
information inside the computers. Alphanumeric characters are
represented using binary bits (i.e., 0 and 1). Digital representations are
easier to design, storage is easy, accuracy and precision are greater.
There are various types of number representation techniques for digital
number representation, for example: Binary number system, octal
number system, decimal number system, and hexadecimal number
system etc. But Binary number system is most relevant and popular for
representing numbers in digital computer system.
Storing Real Number
These are structures as following below −
There are two major approaches to store real numbers (i.e., numbers with
fractional component) in modern computing. These are (i) Fixed Point
Notation and (ii) Floating Point Notation. In fixed point notation, there are
a fixed number of digits after the decimal point, whereas floating point
number allows for a varying number of digits after the decimal point.
Fixed-Point Representation −
This representation has fixed number of bits for integer part and for
fractional part. For example, if given fixed-point representation is [Link],
then you can store minimum value is 0000.0001 and maximum value is
9999.9999. There are three parts of a fixed-point number representation:
the sign field, integer field, and fractional field.
We can represent these numbers using:
Signed representation: range from -(2(k-1)-1) to (2(k-1)-1), for k bits.
1’s complement representation: range from -(2(k-1)-1) to (2(k-1)-1), for
k bits.
2’s complementation representation: range from -(2(k-1)) to (2(k-1)-1),
for k bits.
2’s complementation representation is preferred in computer system
because of unambiguous property and easier for arithmetic operations.
Example −Assume number is using 32-bit format which reserve 1 bit for
the sign, 15 bits for the integer part and 16 bits for the fractional part.
Then, -43.625 is represented as following:
Where, 0 is used to represent + and 1 is used to represent.
000000000101011 is 15 bit binary value for decimal 43 and
1010000000000000 is 16 bit binary value for fractional 0.625.
The advantage of using a fixed-point representation is performance
and disadvantage is relatively limited range of values that they can
represent. So, it is usually inadequate for numerical analysis as it does not
allow enough numbers and accuracy. A number whose representation
exceeds 32 bits would have to be stored inexactly.
These are above smallest positive number and largest positive number
which can be store in 32-bit representation as given above format.
Therefore, the smallest positive number is 2-16 ≈ 0.000015 approximate
and the largest positive number is (215-1)+(1-2-16)=215(1-2-16) =32768, and
gap between these numbers is 2-16.
We can move the radix point either left or right with the help of only
integer field is 1.
Floating-Point Representation −
This representation does not reserve a specific number of bits for the
integer part or the fractional part. Instead it reserves a certain number of
bits for the number (called the mantissa or significand) and a certain
number of bits to say where within that number the decimal place sits
(called the exponent).
The floating number representation of a number has two part: the first
part represents a signed fixed point number called mantissa. The second
part of designates the position of the decimal (or binary) point and is
called the exponent. The fixed point mantissa may be fraction or an
integer. Floating -point is always interpreted to represent a number in the
following form: Mxre.
Only the mantissa m and the exponent e are physically represented in the
register (including their sign). A floating-point binary number is
represented in a similar manner except that is uses base 2 for the
exponent. A floating-point number is said to be normalized if the most
significant digit of the mantissa is 1.
So, actual number is (-1)s(1+m)x2(e-Bias), where s is the sign bit, m is the
mantissa, e is the exponent value, and Bias is the bias number.
Note that signed integers and exponent are represented by either sign
representation, or one’s complement representation, or two’s complement
representation.
The floating point representation is more flexible. Any non-zero number
can be represented in the normalized form of ±(1.b1b2b3 ...)2x2n This is
normalized form of a number x.
Example −Suppose number is using 32-bit format: the 1 bit sign bit, 8
bits for signed exponent, and 23 bits for the fractional part. The leading
bit 1 is not stored (as it is always 1 for a normalized number) and is
referred to as a “hidden bit”.
Then −53.5 is normalized as -53.5=(-110101.1)2=(-1.101011)x25 , which
is represented as following below,
Where 00000101 is the 8-bit binary value of exponent value +5.
Note that 8-bit exponent field is used to store integer exponents -126 ≤ n
≤ 127.
The smallest normalized positive number that fits into 32 bits is
(1.00000000000000000000000)2x2-126=2-126≈1.18x10-38 , and largest
normalized positive number that fits into 32 bits is
(1.11111111111111111111111)2x2127=(224-1)x2104 ≈ 3.40x1038 . These
numbers are represented as following below,
The precision of a floating-point format is the number of positions
reserved for binary digits plus one (for the hidden bit). In the examples
considered here the precision is 23+1=24.
The gap between 1 and the next normalized floating-point number is
known as machine epsilon. the gap is (1+2 -23)-1=2-23for above example,
but this is same as the smallest positive floating-point number because of
non-uniform spacing unlike in the fixed-point scenario.
Note that non-terminating binary numbers can be represented in floating
point representation, e.g., 1/3 = (0.010101 ...)2 cannot be a floating-point
number as its binary representation is non-terminating.
IEEE Floating point Number Representation −
IEEE (Institute of Electrical and Electronics Engineers) has standardized
Floating-Point Representation as following diagram.
So, actual number is (-1)s(1+m)x2(e-Bias), where s is the sign bit, m is the
mantissa, e is the exponent value, and Bias is the bias number. The sign
bit is 0 for positive number and 1 for negative number. Exponents are
represented by or two’s complement representation.
According to IEEE 754 standard, the floating-point number is represented
in following ways:
Half Precision (16 bit): 1 sign bit, 5 bit exponent, and 10 bit mantissa
Single Precision (32 bit): 1 sign bit, 8 bit exponent, and 23 bit
mantissa
Double Precision (64 bit): 1 sign bit, 11 bit exponent, and 52 bit
mantissa
Quadruple Precision (128 bit): 1 sign bit, 15 bit exponent, and 112
bit mantissa
Special Value Representation −
There are some special values depended upon different values of the
exponent and mantissa in the IEEE 754 standard.
All the exponent bits 0 with all mantissa bits 0 represents 0. If sign
bit is 0, then +0, else -0.
All the exponent bits 1 with all mantissa bits 0 represents infinity. If
sign bit is 0, then +∞, else -∞.
All the exponent bits 0 and mantissa bits non-zero represents
denormalized number.
All the exponent bits 1 and mantissa bits non-zero represents error.
Floating-point representation has several advantages and disadvantages,
including:
Advantages
Wide range: Can represent a wide range of values, including
very large and very small numbers
Precision: Can offer high precision, which is important for
engineering and medical calculations
Standardized: IEEE 754 standardization ensures consistency
and compatibility across different systems and programming
languages
Easy to use: Most programming languages offer integrated
support for floating-point representation
Disadvantages
Precision issues: Floating-point numbers can suffer from
rounding and truncation errors, which can lead to limited
precision
Complexity: Floating-point arithmetic is more complex than
integer arithmetic, which can make it difficult to understand
and implement
Slower: Floating-point operations are usually slower than
integer operations, especially on older or less powerful
hardware
Representation gaps: There are gaps between
representable numbers, which can lead to inaccuracies in
calculations
Consistency: Floating-point calculations can yield slightly
different results on different systems or compilers
Semiconductor Memory
The silent workhorse of modern electronics, semiconductor memory stores
data and instructions and makes it possible for smartphones, computers,
medical equipment, and industrial automation to function. This little
wonder, worked with silicon and inventiveness, utilizes electrical charges
to address double data, the "1s" and "0s" that structure the language of
advanced innovation.
The widespread use of semiconductor memory is fueled by its remarkable
properties:
High Storage Density: Semiconductor memory can store a lot of
information in a little space.
Fast Access Time: Information can be gotten rapidly from
semiconductor memory, making it appropriate for elite execution
applications.
Lower Power Consumption: reduces environmental impact,
extends battery life, and minimizes energy consumption.
Scalability: Compared to other kinds of memory, like magnetic
storage, semiconductor memory uses less power.
Semiconductor memory is the invisible foundation of our digital world and
can be found in everything from smartphones and computers to complex
systems. Its steady development guarantees significantly quicker, denser,
and more effective methods for putting away and controlling the data that
characterizes our lives.
Types of Semiconductor Memory
There are two types of semi conductor memory
Random Access Memory(RAM)
Read-Only Memory(ROM)
Random Access Memory(RAM)
It permits information to be gotten to in any request, making it
appropriate for brief capacity.
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.
Types of RAM
RAM is majorly categorised into two categories:
o SRAM (Static Random Access Memory)
o DRAM (Dynamic Random Access Memory)
Static RAM (SRAM)
SRAM full form is Static Random Access Memory. It possesses an array
of flip-flops that are used to save the data. The memory cells consist of
flip flops that hold the information till the power supply is on.
The word static implies that the memory holds its contents as long as the
electricity is being supplied and the data is dumped when the power gets
down because of its volatile nature.
In Static RAM, data is stored in FFs like structure and is implemented by
BJT or MOSFET. A flip-flop for a memory cell uses four or six transistors
along with some wiring which does not require refreshments. This makes
static RAM significantly faster as compared to dynamic RAM.
Static Random Access Memory holds information as long as the power
supply is on. Static RAM’s are more expensive and consume more power
and also have higher speeds than D-RAMs. Static RAM is used to build the
CPU’s speed-sensitive cache, while dynamic RAM forms the larger system
RAM space.
Check the various types of Input and Output Devices here.
Dynamic RAM (DRAM)
DRAM( Dynamic Random Access Memory) stores the data in the form of
charges in the capacitor and transistor pair available in the memory cell.
DRAM is implemented using MOSFETs.
The Dynamic Random Access Memory needs to be regularly refreshed so
that the data should be maintained. This is achieved by installing the
memory on a refresh circuit that rewrites the content several hundred
times every second. It dissipates less power as compared to SRAM and
operates at a slower rate than as well.
Dynamic Random Access Memory is installed for most system memory as
it is relatively cheap and small. It consists of memory cells, which
constitute a single capacitor and a single transistor.
Check the Components of Computer here.
Few other types of RAM are:
Synchronous Dynamic RAM (SDRAM)
SDRAM is a type of DRAM and works in sync with the CPU clock, which
implies it waits for the clock signal before acknowledging the data input. It
simply works in contrast to Dynamic Random Access Memory(responds
instantly to data input). Mostly applied in Computer memory, video game
consoles, etc.
Single Data Rate Synchronous Dynamic RAM (SDR SDRAM)
The ‘single data rate’ symbolises how the memory processes. It can
process one read and one write instruction per clock cycle. Popularly used
in Computer memory, video game consoles, etc.
Read more about ROM, here.
Double Data Rate Synchronous Dynamic RAM (DDR SDRAM)
DDR SDRAM works similar to SDR SDRAM just twice faster than it. DDR
SDRAM can process two reads and two write instructions per clock cycle.
Popularly used in Computer memory. The other upgraded versions of DDR
SDRAM are DDR2, DDR3 and DDR4.
Graphics Double Data Rate Synchronous Dynamic RAM (GDDR
SDRAM)
GDDR SDRAM is a variety of DDR SDRAM and is specifically designed for
Video graphics cards. The other upgraded version of GDDR SDRAM is
GDDR2 SDRAM, GDDR3 SDRAM, GDDR4 SDRAM, and GDDR5 SDRAM.
Flash Memory
Flash memory is a sort of non-volatile storage that holds all data after
power off also. popularly used in digital cameras, smartphones and
tablets, hand-operated gaming systems and toys.
What is ROM
A ROM(read-only memory) is a sort of semiconductor memory technology
applied where the data is written once and then not changed. This type of
memory is used where data requires to be stored permanently, even when
the power is switched, as many memory technologies lose the data once
the power is switched.
ROM can be understood as a semiconductor memory designed to hold
data permanently or do not change frequently. During normal operation,
no new data can be written into ROM but data can be read from ROM. It is
a non-volatile memory that can retain information even after the power
supply is turned off.
Types of ROM
o PROM (programmable read-only memory).
o EPROM (erasable programmable read-only memory).
o EEPROM( electrically erasable programmable ROM).
o Mask ROM.
Masked ROM (MROM)
The early ROMs were hard-wired instruments that consisted of a pre-
programmed set of data or instructions. These types of ROMs are called
masked ROMs, which are comparatively inexpensive.
Programmable Read-Only Memory (PROM)
PROM is a type of read-only memory that can be amended only once by a
user. The user buys an empty PROM and inputs the required data using a
PROM program. It consists of the small fuses inside which are burnt open
during programming. It is possible to program this memory only once and
is not erasable.
Check the various types of Input and Output Devices here.
Erasable & Programmable Read-Only Memory (EPROM)
It is possible to erase EPROM by exposing it to ultraviolet light for a period
of up to 40 minutes. Normally, an EPROM eraser performs this operation.
An electrical charge is stored in an insulated gate region while
programming. The charge is held for more than 10 years as there is no
leakage path.
To erase this charge, ultraviolet light is passed via a quartz crystal window
(lid). This process of exposure to UV light dissipates the charge. The
quartz lid is hidden with a sticker during normal usage.
Electrically Erasable & Programmable Read-Only Memory
(EEPROM)
EEPROM can be programmed and erased using electricity. It is possible to
erase and reprogram it about ten thousand times. Erasing or
programming, both take about 4 to 10 ms (millisecond) time. In EEPROM,
any desired location can be separately erased and programmed.
It is possible to erase EEPROMs at the rate of one byte at a time, instead
of erasing the entire chip all at once. That is why the technique of
reprogramming is quite flexible but slow.
Check the Components of Computer here.
Advantages of ROM
o It is a non-volatile type of memory.
o This type of memory cannot be randomly modified.
o More affordable than RAMs.
o Simple to examine.
o More reliable than RAMs.
o Static and do not require refreshment.
Flash memory
A type of ROM that can be erased and reprogrammed, but usually only a
certain number of times and at a slow speed.
Advantages of Semiconductor Memory
High Speed: Fast data retrieval from semiconductor memory
enables responsive performance and smooth operation. Applications
like gaming, real-time video, and online transaction all depend on
this.
Low power consumption: Compared to other types of memory,
such as magnetic storage, semiconductor memory is very energy
efficient. This is important for laptops and mobile devices, as it
extends battery life.
High storage density: Semiconductor memory can pack an
enormous measure of information into a minuscule space. Because
of this, it is ideal for high-performance computing systems and
portable devices like smartphones and tablets where space is at a
premium.
Scalability: Semiconductor memory innovation can be effortlessly
scaled to satisfy the rising needs of registering. This indicates that
the capacity of semiconductor memory chips will also increase in
tandem with our demand for data storage.
Non-volatile(except for RAM): Non-volatile semiconductor
memory, such as read-only memory (ROM) and flash memory,
stores data even when the power is turned off. Because of this, they
are excellent for storing long-term data like operating systems and
firmware.
Disadvantages of Semiconductor Memory
Volatile(for RAM): When the power is turned off, data stored in
traditional RAM are lost. This can be risky on the off chance that you
are chipping away at something significant and the power goes out
of the blue.
Can be much expensive: When compared to other types of
storage, such as hard disk drives, high-performance or large-
capacity semiconductor memory can be expensive.
Limited lifespan(for Flash memory): Flash memory has a set
number of compose cycles before it breaks down. As a result, flash
memory devices will eventually require replacement.
Security issues: Semiconductor memory can be helpless against
information breaks and hacking. This is due to the fact that the data
is stored electronically and can be accessed in the event that the
device is hacked.
Effect on the Environment: The process of manufacturing
semiconductor memory chips can be resource-intensive and harmful
to the environment. However, efforts are being made to develop
production methods that are more environmentally friendly.
Applications of Semiconductor Memory
Semiconductor memory is used in a wide variety of applications,
including:
Digital Cameras: Used for storing photographs and recordings.
Smartphones: Used for storing applications, music, photos and
other valuable information.
Computers: Used for storing program instruction and working data.
USB drivers: Used for storing potable data storage.
Solid state drive(SSD): Used for high-performance storage in
computers.
MP3 Player: Used to store music.
Solved Problem
Calculate the total storage capacity of a 8GB RAM chip with 8-bit
memory cells.
Solution:
1. 8GB=8 * 1024 * 1024 * 1024bytes
2. 1 byte=8 bits.
3. So, the total storage capacity is 8 * 1024 * 1024 * 1024 * 8 bits
=68719476736 bits.
Direct Memory Access (DMA) Controller in Computer Architecture
In modern computer systems, transferring data between input/output
devices and memory can be a slow process if the CPU is required to
manage every step. To address this, a Direct Memory Access (DMA)
Controller is utilized. A Direct Memory Access (DMA) Controller solves this
by allowing I/O devices to transfer data directly to memory, reducing CPU
involvement. This increases system efficiency and speeds up data
transfers, freeing the CPU to focus on other tasks. DMA controller needs
the same old circuits of an interface to communicate with the CPU and
Input/Output devices.
What is a DMA Controller?
Direct Memory Access (DMA) uses hardware for accessing the memory,
that hardware is called a DMA Controller. It has the work of transferring
the data between Input Output devices and main memory with very less
interaction with the processor. The direct Memory Access Controller is a
control unit, which has the work of transferring data.
DMA Controller in Computer Architecture
DMA Controller is a type of control unit that works as an interface for the
data bus and the I/O Devices. As mentioned, DMA Controller has the work
of transferring the data without the intervention of the processors,
processors can control the data transfer. DMA Controller also contains an
address unit, which generates the address and selects an I/O device for
the transfer of data. Here we are showing the block diagram of the DMA
Controller.
Block Diagram of DMA Controller
Types of Direct Memory Access (DMA)
There are four popular types of DMA.
Single-Ended DMA
Dual-Ended DMA
Arbitrated-Ended DMA
Interleaved DMA
Single-Ended DMA: Single-Ended DMA Controllers operate by reading
and writing from a single memory address. They are the simplest DMA.
Dual-Ended DMA: Dual-Ended DMA controllers can read and write from
two memory addresses. Dual-ended DMA is more advanced than single-
ended DMA.
Arbitrated-Ended DMA: Arbitrated-Ended DMA works by reading and
writing to several memory addresses. It is more advanced than Dual-
Ended DMA.
Interleaved DMA: Interleaved DMA are those DMA that read from one
memory address and write from another memory address.
Working of DMA Controller
The DMA controller registers have three registers as follows.
Address register – It contains the address to specify the desired
location in memory.
Word count register – It contains the number of words to be
transferred.
Control register – It specifies the transfer mode.
Note: All registers in the DMA appear to the CPU as I/O interface
registers. Therefore, the CPU can both read and write into the DMA
registers under program control via the data bus.
The figure below shows the block diagram of the DMA controller. The unit
communicates with the CPU through the data bus and control lines.
Through the use of the address bus and allowing the DMA and RS register
to select inputs, the register within the DMA is chosen by the CPU. RD and
WR are two-way inputs. When BG (bus grant) input is 0, the CPU can
communicate with DMA registers. When BG (bus grant) input is 1, the CPU
has relinquished the buses and DMA can communicate directly with the
memory.
Working Diagram of DMA Controller
Explanation: The CPU initializes the DMA by sending the given
information through the data bus.
The starting address of the memory block where the data is
available (to read) or where data are to be stored (to write).
It also sends word count which is the number of words in the
memory block to be read or written.
Control to define the mode of transfer such as read or write.
A control to begin the DMA transfer
Modes of Data Transfer in DMA
There are 3 modes of data transfer in DMA that are described below.
Burst Mode: In Burst Mode, buses are handed over to the CPU by
the DMA if the whole data is completely transferred, not before that.
Cycle Stealing Mode: In Cycle Stealing Mode, buses are handed
over to the CPU by the DMA after the transfer of each byte.
Continuous request for bus control is generated by this Data
Transfer Mode. It works more easily for higher-priority tasks.
Transparent Mode: Transparent Mode in DMA does not require any
bus in the transfer of the data as it works when the CPU is executing
the transaction.
What is 8237 DMA Controller?
8237 DMA Controller is a type of DMA Controller which has a flexible
number of channels but generally works on 4 Input-Output channels. In
these present channels, the channel has to be given the highest priority to
be decided by the Priority Encoder. Each channel in the 8237 DMA
Controller has to be programmed separately.
What is 8257 DMA Controller?
8257 DMA Controller is a type of DMA Controller, that when a single Intel
8212 I/O device is paired with it, becomes 4 channel DMA Controller. In
8257 DMA Controller, the highest priority channel is acknowledged. It
contains two 16-bit registers, one is DMA Address Register and the other
one is Terminal Count Register.
Advantages of DMA Controller
Data Memory Access speeds up memory operations and data
transfer.
CPU is not involved while transferring data.
DMA requires very few clock cycles while transferring data.
DMA distributes workload very appropriately.
DMA helps the CPU in decreasing its load.
Disadvantages of DMA Controller
Direct Memory Access is a costly operation because of additional
operations.
DMA suffers from Cache-Coherence Problems.
DMA Controller increases the overall cost of the system.
DMA Controller increases the complexity of the software.
In the Computer System Design, Memory Hierarchy is an enhancement to
organize the memory such that it can minimize the access time. The
Memory Hierarchy was developed based on a program behavior known as
locality of references. The figure below clearly demonstrates the different
levels of the memory hierarchy.
Why Memory Hierarchy is Required in the System?
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.
Types of Memory Hierarchy
This Memory Hierarchy Design is divided into 2 main types:
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.
Memory Hierarchy Design
Memory Hierarchy Design
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.
Types of Main Memory
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.
Characteristics of Memory Hierarchy
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.
It helps in spreading the data all over the computer system.
It saves the consumer’s price and time.
Cache memory is a small, high-speed storage area in a computer. The
cache is a smaller and faster memory that stores copies of the data from
frequently used main memory locations. There are various independent
caches in a CPU, which store instructions and data. The most important
use of cache memory is that it is used to reduce the average time to
access data from the main memory.
By storing this information closer to the CPU, cache memory helps speed
up the overall processing time. Cache memory is much faster than the
main memory (RAM). When the CPU needs data, it first checks the cache.
If the data is there, the CPU can access it quickly. If not, it must fetch the
data from the slower main memory.
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.
Cache Memory
Levels of Memory
Level 1 or Register: It is a type of memory in which data is stored
and accepted that are immediately stored in the CPU. The most
commonly used register is Accumulator, Program counter , Address
Register, etc.
Level 2 or Cache memory: It is the fastest memory that has faster
access time where data is temporarily stored for faster access.
Level 3 or Main Memory: It is the memory on which the computer
works currently. It is small in size and once power is off data no
longer stays in this memory.
Level 4 or Secondary Memory: It is external memory that is not
as fast as the main memory but data stays permanently in this
memory.
Cache Performance
When the processor needs to read or write a location in the main memory,
it first checks for a corresponding entry in the cache.
If the processor finds that the memory location is in the cache,
a Cache Hit has occurred and data is read from the cache.
If the processor does not find the memory location in the cache,
a cache miss has occurred. For a cache miss, the cache allocates a
new entry and copies in data from the main memory, then the
request is fulfilled from the contents of the cache.
The performance of cache memory is frequently measured in terms of a
quantity called Hit ratio.
Hit Ratio(H) = hit / (hit + miss) = no. of hits/total accesses
Miss Ratio = miss / (hit + miss) = no. of miss/total accesses = 1 - hit
ratio(H)
We can improve Cache performance using higher cache block size, and
higher associativity, reduce miss rate, reduce miss penalty, and reduce
the time to hit in the cache.
Cache Mapping
There are three different types of mapping used for the purpose of cache
memory which is as follows:
Direct Mapping
Associative Mapping
Set-Associative Mapping
1. Direct Mapping
The simplest technique, known as direct mapping, maps each block of
main memory into only one possible cache line. or In Direct mapping,
assign each memory block to a specific line in the cache. If a line is
previously taken up by a memory block when a new block needs to be
loaded, the old block is trashed. An address space is split into two parts
index field and a tag field. The cache is used to store the tag field whereas
the rest is stored in the main memory. Direct mapping`s performance is
directly proportional to the Hit ratio.
i = j modulo m
where
i = cache line number
j = main memory block number
m = number of lines in the cache
Direct Mapping
For purposes of cache access, each main memory address can be viewed
as consisting of three fields. The least significant w bits identify a unique
word or byte within a block of main memory. In most contemporary
machines, the address is at the byte level. The remaining s bits specify
one of the 2 s blocks of main memory. The cache logic interprets these s
bits as a tag of s-r bits (the most significant portion) and a line field of r
bits. This latter field identifies one of the m=2 r lines of the cache. Line
offset is index bits in the direct mapping.
Direct Mapping – Structure
2. Associative Mapping
In this type of mapping, associative memory is used to store the content
and addresses of the memory word. Any block can go into any line of the
cache. This means that the word id bits are used to identify which word in
the block is needed, but the tag becomes all of the remaining bits. This
enables the placement of any word at any place in the cache memory. It is
considered to be the fastest and most flexible mapping form. In
associative mapping, the index bits are zero.
Associative Mapping – Structure
3. Set-Associative Mapping
This form of mapping is an enhanced form of direct mapping where the
drawbacks of direct mapping are removed. Set associative addresses the
problem of possible thrashing in the direct mapping method. It does this
by saying that instead of having exactly one line that a block can map to
in the cache, we will group a few lines together creating a set . Then a
block in memory can map to any one of the lines of a specific set. Set-
associative mapping allows each word that is present in the cache can
have two or more words in the main memory for the same index address.
Set associative cache mapping combines the best of direct and
associative cache mapping techniques. In set associative mapping the
index bits are given by the set offset bits. In this case, the cache consists
of a number of sets, each of which consists of a number of lines.
Set-Associative Mapping
Relationships in the Set-Associative Mapping can be defined as:
m=v*k
i= j mod v
where
i = cache set number
j = main memory block number
v = number of sets
m = number of lines in the cache number of sets
k = number of lines in each set
Set-Associative Mapping – Structure
For more, you can refer to the Difference between Types of Cache
Mapping .
Application of Cache Memory
Here are some of the applications of Cache Memory.
Primary Cache: A primary cache is always located on the
processor chip. This cache is small and its access time is
comparable to that of processor registers.
Secondary Cache: Secondary cache is placed between the primary
cache and the rest of the memory. It is referred to as the level 2 (L2)
cache. Often, the Level 2 cache is also housed on the processor
chip.
Spatial Locality of Reference: Spatial Locality of Reference says
that there is a chance that the element will be present in close
proximity to the reference point and next time if again searched
then more close proximity to the point of reference.
Temporal Locality of Reference: Temporal Locality of
Reference uses the Least recently used algorithm will be used.
Whenever there is page fault occurs within a word will not only load
the word in the main memory but the complete page fault will be
loaded because the spatial locality of reference rule says that if you
are referring to any word next word will be referred to in its register
that’s why we load complete page table so the complete block will
be loaded.
Advantages
Cache Memory is faster in comparison to main memory and
secondary memory.
Programs stored by Cache Memory can be executed in less time.
The data access time of Cache Memory is less than that of the main
memory.
Cache Memory stored data and instructions that are regularly used
by the CPU, therefore it increases the performance of the CPU.
Disadvantages
Cache Memory is costlier than primary memory and secondary
memory .
Data is stored on a temporary basis in Cache Memory.
Whenever the system is turned off, data and instructions stored in
cache memory get destroyed.
The high cost of cache memory increases the price of the Computer
System.
Virtual Memory in Operating System
Last Updated : 30 Oct, 2024
Virtual Memory is a storage allocation scheme in which
secondary memory can be addressed as though it were part of the
main memory. The addresses a program may use to reference
memory are distinguished from the addresses the memory system
uses to identify physical storage sites and program-generated
addresses are translated automatically to the corresponding
machine addresses.
What is 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 the system to compensate for physical memory
shortages, enabling larger applications to run on systems with less
RAM.
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 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.
The size of virtual storage is limited by the addressing scheme of
the computer system and the amount of secondary memory
available not by the actual number of main storage locations.
The History of Virtual Memory
Before virtual memory, computers used RAM and secondary
memory for data storage. Early computers used magnetic core in
place of main memory and magnetic drums in place of secondary
memory. In the 1940s and 1950s, computer memory was very
expensive and limited in size. As programs became larger and more
complex, developers had to worry that their programs might use up
all the available memory and cause the computer to run out of
space to work.
In those early days, if program was larger than available space then
programmers use the concept of overlaying. If some portion of the
code that is not currently used move to overlying if needed it back
overwritten to memory this cause extensive programming. This is
the reason for developing virtual memory.
In 1956, German physicist Fritz-Rudolf Güntsch develop virtual
memory. The first real example of a virtual memory system was
created at the University of Manchester in England while developing
the Atlas computer. This system used a method called paging, which
allowed virtual addresses (used by programs) to be mapped to the
computer’s main memory. The Atlas computer was built in 1959 and
started working in 1962.
The first computer with virtual memory was released by Burroughs
Corp in 1961. This version of virtual memory do not using paging it
oppose paging but support segmentation.
How Virtual Memory Works?
Virtual Memory is a technique that is implemented using both
hardware and software. It maps memory addresses used by a
program, called virtual addresses, into physical addresses in
computer memory.
All memory references within a process are logical addresses that
are dynamically translated into physical addresses at run time. This
means that a process can be swapped in and out of the main
memory such that it occupies different places in the main memory
at different times during the course of execution.
A process may be broken into a number of pieces and these pieces
need not be continuously located in the main memory during
execution. The combination of dynamic run-time address translation
and the use of a page or segment table permits this.
If these characteristics are present then, it is not necessary that all
the pages or segments are present in the main memory during
execution. This means that the required pages need to be loaded
into memory whenever required. Virtual memory is implemented
using Demand Paging or Demand Segmentation.
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.
Demand Paging: The process of loading the page into memory on
demand (whenever a page fault occurs) is known as demand
paging. The process includes the following steps are as follows:
Demand Paging
If the CPU tries to refer to a page that is currently not available in
the main memory, it generates an interrupt indicating a memory
access fault.
The OS puts the interrupted process in a blocking state. For the
execution to proceed the OS must bring the required page into the
memory.
The OS will search for the required page in the logical address
space.
The required page will be brought from logical address space to
physical address space. The page replacement algorithms are used
for the decision-making of replacing the page in physical address
space.
The page table will be updated accordingly.
The signal will be sent to the CPU to continue the program execution
and it will place the process back into the ready state.
Hence whenever a page fault occurs these steps are followed by the
operating system and the required page is brought into memory.
What is Page Fault Service Time?
The time taken to service the page fault is called page fault service
time. The page fault service time includes the time taken to perform
all the above six steps.
Let Main memory access time is: m
Page fault service time is: s
Page fault rate is : p
Then, Effective memory access time = (p*s) + (1-p)*m
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.
Combining Paging and Segmentation
Sometimes, both paging and segmentation are used together. In this
case, memory is divided into pages, and segments are made up of
multiple pages. The virtual address includes both a segment number
and a page number.
Virtual Memory vs Physical Memory
Physical Memory
Feature Virtual Memory (RAM)
An abstraction The actual hardware
that extends the (RAM) that stores
Definiti
available memory data and instructions
on
by using disk currently being used
storage by the CPU
Physical Memory
Feature Virtual Memory (RAM)
Locatio On the hard drive On the computer’s
n or SSD motherboard
Slower (due to
Faster (accessed
Speed disk I/O
directly by the CPU)
operations)
Smaller, limited by
Capacit Larger, limited by
the amount of RAM
y disk space
installed
Lower (cost of
Higher (cost of RAM
Cost additional disk
modules)
storage)
Indirect (via
Data Direct (CPU can
paging and
Access access data directly)
swapping)
Volatilit Non-volatile (data Volatile (data is lost
y persists on disk) when power is off)
What is Swapping?
Swapping is a process out means removing all of its pages from
memory, or marking them so that they will be removed by the
normal page replacement process. Suspending a process ensures
that it is not runnable while it is swapped out. At some later time,
the system swaps back the process from the secondary storage to
the main memory. When a process is busy swapping pages in and
out then this situation is called thrashing.
Swappinghierar
What is Thrashing?
At any given time, only a few pages of any process are in the main
memory, and therefore more processes can be maintained in
memory. Furthermore, time is saved because unused pages are not
swapped in and out of memory. However, the OS must be clever
about how it manages this scheme. In the steady state practically,
all of the main memory will be occupied with process pages, so that
the processor and OS have direct access to as many processes as
possible. Thus when the OS brings one page in, it must throw
another out. If it throws out a page just before it is used, then it will
just have to get that page again almost immediately. Too much of
this leads to a condition called Thrashing. The system spends most
of its time swapping pages rather than executing instructions. So a
good page replacement algorithm is required.
In the given diagram, the initial degree of multiprogramming up to
some extent of point(lambda), the CPU utilization is very high and
the system resources are utilized 100%. But if we further increase
the degree of multiprogramming the CPU utilization will drastically
fall down and the system will spend more time only on the page
replacement and the time taken to complete the execution of the
process will increase. This situation in the system is called
thrashing.
Causes of Thrashing
Thrashing occurs in a computer system when the CPU spends more
time swapping pages in and out of memory than executing actual
processes. This happens when there is insufficient physical memory,
causing frequent page faults and excessive paging activity.
Thrashing reduces system performance and makes processes run
very slowly. There are many cause of thrashing as discussed below.
1. High Degree of Multiprogramming: If the number of
processes keeps on increasing in the memory then the number of
frames allocated to each process will be decreased. So, fewer
frames will be available for each process. Due to this, a page
fault will occur more frequently and more CPU time will be wasted in
just swapping in and out of pages and the utilization will keep on
decreasing.
For example:
Let free frames = 400
Case 1: Number of processes = 100
Then, each process will get 4 frames.
Case 2: Number of processes = 400
Each process will get 1 frame.
Case 2 is a condition of thrashing, as the number of processes is
increased, frames per process are decreased. Hence CPU time will
be consumed just by swapping pages.
2. Lacks of Frames: If a process has fewer frames then fewer
pages of that process will be able to reside in memory and hence
more frequent swapping in and out will be required. This may lead
to thrashing. Hence a sufficient amount of frames must be allocated
to each process in order to prevent thrashing.
Recovery of Thrashing
Do not allow the system to go into thrashing by instructing the long-
term scheduler not to bring the processes into memory after the
threshold.
If the system is already thrashing then instruct the mid-term
scheduler to suspend some of the processes so that we can recover
the system from thrashing.
Performance in Virtual Memory
Let p be the page fault rate( 0 <= p <= 1).
if p = 0 no page faults
if p =1, every reference is a fault.
Effective access time (EAT) = (1-p)* Memory Access Time + p *
Page fault time.
Page fault time = page fault overhead + swap out + swap in
+restart overhead
The performance of a virtual memory management system depends
on the total number of page faults, which depend on “paging
policies” and “frame allocation“
Frame Allocation
A number of frames allocated to each process in either static or
dynamic.
Static Allocation: The number of frame allocations to a process is
fixed.
Dynamic Allocation: The number of frames allocated to a process
changes.
Paging Policies
Fetch Policy: It decides when a page should be loaded into
memory.
Replacement Policy: It decides which page in memory should be
replaced.
Placement Policy: It decides where in memory should a page be
loaded.
What are the Applications of Virtual memory?
Virtual memory has the following important characteristics that
increase the capabilities of the computer system. The following are
five significant characteristics of Lean.
Increased Effective Memory: One major practical application of
virtual memory is, virtual memory enables a computer to have more
memory than the physical memory using the disk space. This allows
for the running of larger applications and numerous programs at one
time while not necessarily needing an equivalent amount of DRAM.
Memory Isolation: Virtual memory allocates a unique address
space to each process and that also plays a role in process
segmentation. Such separation increases safety and reliability based
on the fact that one process cannot interact with and or modify
another’s memory space through a mistake, or even a deliberate act
of vandalism.
Efficient Memory Management: Virtual memory also helps in
better utilization of the physical memories through methods that
include paging and segmentation. It can transfer some of the
memory pages that are not frequently used to disk allowing RAM to
be used by active processes when required in a way that assists in
efficient use of memory as well as system performance.
Simplified Program Development: For case of programmers,
they don’t have to consider physical memory available in a system
in case of having virtual memory. They can program ‘as if’ there is
one big block of memory and this makes the programming easier
and more efficient in delivering more complex applications.
How to Manage Virtual Memory?
Here are 5 key points on how to manage virtual memory:
1. Adjust the Page File Size
Automatic Management: All contemporary operating systems
including Windows contain the auto-configuration option for the size
of the empirical page file. But depending on the size of the RAM,
they are set automatically, although the user can manually adjust
the page file size if required.
Manual Configuration: For tuned up users, the setting of the
custom size can sometimes boost up the performance of the
system. The initial size is usually advised to be set to the minimum
value of 1. To set the size of the swap space equal to 5 times the
amount of physical RAM and the maximum size 3 times the physical
RAM.
2. Place the Page File on a Fast Drive
SSD Placement: If this is feasible, the page file should be stored in
the SSD instead of the HDD as a storage device. It has better read
and write times, and the virtual memory may prove benefecial in an
SSD.
Separate Drive: Regarding systems having multiple drives
involved, the page file needs to be placed on a different drive than
the os and that shall in turn improve its performance.
3. Monitor and Optimize Usage
Performance Monitoring: Employ the software tools used in
monitoring the performance of the system in tracking the amounts
of virtual memory. High page file usage may signify that there is a
lack of physical RAM or that virtual memory needs a change of
settings or addition in physical RAM.
Regular Maintenance: Make sure there is no toolbar or other
application running in the background, take time and uninstall all
the tool bars to free virtual memory.
4. Disable Virtual Memory for SSD
Sufficient RAM: If for instance your system has a big physical
memory, for example 16GB and above then it would be advised to
freeze the page file in order to minimize SSD usage. But it should be
done, in my opinion, carefully and only if the additional signals that
one decides to feed into his applications should not likely use all the
available RAM.
5. Optimize System Settings
System Configuration: Change some general properties of the
system concerning virtual memory efficiency. This also involves
enabling additional control options in Windows such as adjusting
additional system setting option on the operating system, or using
other options in different operating systems such as Linux that
provides different tools and commands to help in adjusting how
virtual memory is utilized.
Regular Updates: Ensure that your drivers are run in their newest
version because new releases contain some enhancements and
issues regarding memory management.
What are the Benifits of Using Virtual Memory?
Many processes maintained in the main memory.
A process larger than the main memory can be executed because of
demand paging. The OS itself loads pages of a process in the main
memory as required.
It allows greater multiprogramming levels by using less of the
available (primary) memory for each process.
It has twice the capacity for addresses as main memory.
It makes it possible to run more applications at once.
Users are spared from having to add memory modules when RAM
space runs out, and applications are liberated from shared memory
management.
When only a portion of a program is required for execution, speed
has increased.
Memory isolation has increased security.
It makes it possible for several larger applications to run at once.
Memory allocation is comparatively cheap.
It doesn’t require outside fragmentation.
It is efficient to manage logical partition workloads using the CPU.
Automatic data movement is possible.
What are the Limitation of Virtual Memory?
It can slow down the system performance, as data needs to be
constantly transferred between the physical memory and the hard
disk.
It can increase the risk of data loss or corruption, as data can be lost
if the hard disk fails or if there is a power outage while data is being
transferred to or from the hard disk.
It can increase the complexity of the memory management system,
as the operating system needs to manage both physical and virtual
memory.
Conclusion
In conclusion, virtual memory is a crucial feature in operating
systems that allows computers to run larger applications and handle
more processes than the physical RAM alone can support. By using
techniques like paging and segmentation, the system extends the
available memory onto the hard drive, ensuring that the operating
system and applications can operate smoothly. Although virtual
memory can introduce some performance overhead due to the
slower speed of hard drives compared to RAM, it provides significant
benefits in terms of memory management, efficiency, and
multitasking capabilities.
Frequently Asked Questions on Virtual Memory – FAQs
Why is virtual memory important?
Virtual memory is important because it allows the system to handle
larger applications and multiple applications simultaneously without
running out of physical memory. It helps in optimizing the use of
available RAM and provides a buffer against memory shortages.
What is a page file or swap space in virtual memory?
Page file is also known as Virtual memory file in windows while
Swap space is known as page file in Unix/Linux It is a disk area
assigned by the operating system to act as extension of physical
memory. If RAM is saturated, then finally inactive page of memory is
swapped to this area, to provide the occupied RAM for more active
processes. This process is known as paging or swapping.
Can virtual memory affect system performance?
Virtual memory may affect the efficiency of the operation of the
computer. Too much usage of the virtual memory will result in what
is referred to as a thrashing where the system spends most of its
time swapping data between the RAM and the disk with less time
executing applications thus, slows down the system. This can be
solved by having enough physical RAM and to correctly setup the
page file or swap space.
Requirements of Memory Management System
Last Updated : 20 Dec, 2022
Memory management keeps track of the status of each memory
location, whether it is allocated or free. It allocates the memory
dynamically to the programs at their request and frees it for reuse
when it is no longer needed. Memory management meant to satisfy
some requirements that we should keep in mind.
These Requirements of memory management are:
1. Relocation – The available memory is generally shared among a
number of processes in a multiprogramming system, so it is not
possible to know in advance which other programs will be resident
in main memory at the time of execution of this program. Swapping
the active processes in and out of the main memory enables the
operating system to have a larger pool of ready-to-execute process.
When a program gets swapped out to a disk memory, then it is not
always possible that when it is swapped back into main memory
then it occupies the previous memory location, since the location
may still be occupied by another process. We may need
to relocate the process to a different area of memory. Thus there is
a possibility that program may be moved in main memory due to
swapping.
The figure depicts a process image. The process image is occupying
a continuous region of main memory. The operating system will
need to know many things including the location of process control
information, the execution stack, and the code entry. Within a
program, there are memory references in various instructions and
these are called logical addresses.
After loading of the program into main memory, the processor and
the operating system must be able to translate logical addresses
into physical addresses. Branch instructions contain the address of
the next instruction to be executed. Data reference instructions
contain the address of byte or word of data referenced.
2. Protection – There is always a danger when we have multiple
programs at the same time as one program may write to the
address space of another program. So every process must be
protected against unwanted interference when other process tries to
write in a process whether accidental or incidental. Between
relocation and protection requirement a trade-off occurs as the
satisfaction of relocation requirement increases the difficulty of
satisfying the protection requirement.
Prediction of the location of a program in main memory is not
possible, that’s why it is impossible to check the absolute address at
compile time to assure protection. Most of the programming
language allows the dynamic calculation of address at run time. The
memory protection requirement must be satisfied by the processor
rather than the operating system because the operating system can
hardly control a process when it occupies the processor. Thus it is
possible to check the validity of memory references.
3. Sharing – A protection mechanism must have to allow several
processes to access the same portion of main memory. Allowing
each processes access to the same copy of the program rather than
have their own separate copy has an advantage.
For example, multiple processes may use the same system file and
it is natural to load one copy of the file in main memory and let it
shared by those processes. It is the task of Memory management to
allow controlled access to the shared areas of memory without
compromising the protection. Mechanisms are used to support
relocation supported sharing capabilities.
4. Logical organization – Main memory is organized as linear or it
can be a one-dimensional address space which consists of a
sequence of bytes or words. Most of the programs can be organized
into modules, some of those are unmodifiable (read-only, execute
only) and some of those contain data that can be modified. To
effectively deal with a user program, the operating system and
computer hardware must support a basic module to provide the
required protection and sharing. It has the following advantages:
Modules are written and compiled independently and all the
references from one module to another module are resolved
by `the system at run time.
Different modules are provided with different degrees of
protection.
There are mechanisms by which modules can be shared
among processes. Sharing can be provided on a module level
that lets the user specify the sharing that is desired.
5. Physical organization – The structure of computer memory has
two levels referred to as main memory and secondary memory. Main
memory is relatively very fast and costly as compared to the
secondary memory. Main memory is volatile. Thus secondary
memory is provided for storage of data on a long-term basis while
the main memory holds currently used programs. The major system
concern between main memory and secondary memory is the flow
of information and it is impractical for programmers to understand
this for two reasons:
The programmer may engage in a practice known as
overlaying when the main memory available for a program
and its data may be insufficient. It allows different modules to
be assigned to the same region of memory. One disadvantage
is that it is time-consuming for the programmer.
In a multiprogramming environment, the programmer does
not know how much space will be available at the time of
coding and where that space will be located inside the
memory.
Secondary Storage Devices in Computer Organization
You know that processor or primary memory is very expensive and
has limited storage capacity because of its volatile nature. If we
need to store large amounts of data or programs permanently, we
need a cheaper and permanent memory. Secondary
memory overcomes this limitation by providing permanent storage
of data in bulk quantity.
A secondary storage device refers to any non-volatile storage
device that is internal or external to the computer. It can be any
storage device beyond the primary storage that enables permanent
data storage. A secondary storage device is also known as an
auxiliary storage device, backup storage device, tier 2 storage, or
external storage. These devices store virtually all programs and
applications on a computer, including the operating system, device
drivers, applications and general user data.
The Secondary storage media can be fixed or removable. Fixed
Storage media is an internal storage medium like a hard disk that is
fixed inside the computer. A storage medium that is portable and
can be taken outside the computer is termed removable storage
media. The main advantage of using secondary storage devices is:
o In Secondary storage devices, the stored data might not be under
the direct control of the operating system. For example, many
organizations store their archival data or critical documents on
secondary storage drives, which their main network cannot access
to ensure their preservation whenever a data breach occurs.
o Since these drives do not interact directly with the main
infrastructure and can be situated in a remote or secure site, it is
unlikely that a hacker may access these drives unless they're
physically stolen.
Why do we need Secondary Storage?
Computers use main memory such as random access memory
(RAM) and cache to hold data that is being processed. However, this
type of memory is volatile, and it loses its data when the computer
is switched off. General-purpose computers, such as personal
computers and tablets, need to store programs and data for later
use.
That's why secondary storage is needed to keep programs and data
long term. Secondary storage is non-volatile and able to keep data
as long term storage. They are used for various purposes such as
backup data used for future restores or disaster recovery, long-term
archiving of data that is not frequently accessed, and storage of
non-critical data in lower-performing, less expensive drives.
Without secondary storage, all programs and data would be lost
when the computer is switched off.
AD
Characteristics of Secondary Storage Devices
These are some characteristics of secondary memory, which
distinguish it from primary memory, such as:
o It is non-volatile, which means it retains data when power is
switched off
o It allows for the storage of data ranging from a few megabytes to
petabytes.
o It is cheaper as compared to primary memory.
o Secondary storage devices like CDs and flash drives can transfer the
data from one device to another.
AD
Types of Secondary Storage Device
Here are the two types of secondary storage devices, i.e., fixed
storage and removable storage.
1. Fixed Storage
Fixed storage is an internal media device used by a computer
system to store data. Usually, these are referred to as the fixed disk
drives or Hard Drives.
Fixed storage devices are not fixed. These can be removed from the
system for repairing work, maintenance purposes, and also for an
upgrade, etc. But in general, this can not be done without a proper
toolkit to open up the computer system to provide physical access,
which needs to be done by an engineer.
Technically, almost all data, i.e. being processed on a computer
system, is stored on some built-in fixed storage device. We have the
following types of fixed storage:
o Internal flash memory (rare)
o SSD (solid-state disk) units
o Hard disk drives (HDD)
2. Removable Storage
Removable storage is an external media device that is used by a
computer system to store data. Usually, these are referred to as the
Removable Disks drives or the External Drives. Removable storage
is any storage device that can be removed from a computer system
while the system is running. Examples of external devices include
CDs, DVDs, Blu-ray disk drives, and diskettes and USB drives.
Removable storage makes it easier for a user to transfer data from
one computer system to another.
The main benefit of removable disks in storage factors is that they
can provide the fast data transfer rates associated with storage area
networks (SANs). We have the following types of Removable
Storage:
o Optical discs (CDs, DVDs, Blu-ray discs)
o Memory cards
o Floppy disks
o Magnetic tapes
o Disk packs
o Paper storage (punched tapes, punched cards)
Classification of Secondary Storage Devices
The following image shows the classification of commonly used
secondary storage devices.
Sequential Access Storage Device
It is a class of data storage devices that read stored data in a
sequence. This is in contrast to random access memory (RAM),
where data can access in any order, and magnetic tape is the
common sequential access storage device.
AD
i. Magnetic tape: It is a medium for magnetic recording, made of a
thin, magnetizable coating on a long, narrow strip of plastic film.
Devices that record and play audio and video using magnetic tape
are tape recorders and videotape recorders. A device that stores
computer data on magnetic tape is known as a tape drive.
It was a key technology in early computer development, allowing
unparalleled amounts of data to be mechanically created, stored for
long periods, and rapidly accessed.
AD
Direct Access Storage Devices
A direct-access storage device (DASD) is another name for
secondary storage devices that store data in discrete locations with
a unique address, such as hard disk drives, optical drives and most
magnetic storage devices.
1. Magnetic disks: A magnetic disk is a storage device that uses a
magnetization process to write, rewrite and access data. It is
covered with a magnetic coating and stores data in the form of
tracks, spots and sectors. Hard disks, zip disks and floppy disks are
common examples of magnetic disks.
i. Floppy Disk: A floppy disk is a flexible disk with a magnetic coating
on it, and it is packaged inside a protective plastic envelope. These
are among the oldest portable storage devices that could store up
to 1.44 MB of data, but now they are not used due to very little
memory storage.
ii. Hard Disk Drive (HDD): Hard disk drive comprises a series of
circular disks called platters arranged one over the other almost ½
inches apart around a spindle. Disks are made of non-magnetic
material like aluminium alloy and coated with 10-20 nm magnetic
material. The standard diameter of these disks is 14 inches, and
they rotate with speeds varying from 4200 rpm (rotations per
minute) for personal computers to 15000 rpm for servers.
Data is stored by magnetizing or demagnetizing the magnetic
coating. A magnetic reader arm is used to read data from and write
data to the disks. A typical modern HDD has a capacity in terabytes
(TB).
2. Optical Disk: An optical disk is any computer disk that uses
optical storage techniques and technology to read and write data. It
is a computer storage disk that stores data digitally and uses laser
beams to read and write data.
i. CD Drive: CD stands for Compact Disk. CDs are circular disks that
use optical rays, usually lasers, to read and write data. They are
very cheap as you can get 700 MB of storage space for less than a
dollar. CDs are inserted in CD drives built into the CPU cabinet. They
are portable as you can eject the drive, remove the CD and carry it
with you. There are three types of CDs:
o CD-ROM (Compact Disk - Read Only Memory): The
manufacturer recorded the data on these CDs. Proprietary
Software, audio or video are released on CD-ROMs.
o CD-R (Compact Disk - Recordable): The user can write
data once on the CD-R. It cannot be deleted or modified later.
o CD-RW (Compact Disk - Rewritable): Data can repeatedly
be written and deleted on these optical disks.
ii. DVD Drive: DVD stands for digital video display. DVD is an optical
device that can store 15 times the data held by CDs. They are
usually used to store rich multimedia files that need high storage
capacity. DVDs also come in three varieties - read-only, recordable
and rewritable.
iii. Blu Ray Disk: Blu Ray Disk (BD) is an optical storage media that
stores high definition (HD) video and other multimedia files. BD uses
a shorter wavelength laser than CD/DVD, enabling the writing arm
to focus more tightly on the disk and pack in more data. BDs can
store up to 128 GB of data.
3. Memory Storage Devices: A memory device contains trillions
of interconnected memory cells that store data. When switched on
or off, these cells hold millions of transistors representing 1s and 0s
in binary code, allowing a computer to read and write information. It
includes USB drives, flash memory devices, SD and memory cards,
which you'll recognize as the storage medium used in digital
cameras.
i. Flash Drive: A flash drive is a small, ultra-portable storage device.
USB flash drives were essential for easily moving files from one
device to another. Flash drives connect to computers and other
devices via a built-in USB Type-Aor USB-C plug, making one a USB
device and cable combination.
Flash drives are often referred to as pen drives, thumb drives, or
jump drives. The terms USB drive and solid-state drive (SSD) are
also sometimes used, but most of the time, those refer to larger,
not-so-mobile USB-based storage devices like external hard drives.
These days, a USB flash drive can hold up to 2 TB of storage.
They're more expensive per gigabyte than an external hard drive,
but they have prevailed as a simple, convenient solution for storing
and transferring smaller files.
Pen drive has the following advantages in computer organization,
such as:
o Transfer Files: A pen drive is a device plugged into a USB
port of the system that is used to transfer files, documents,
and photos to a PC and vice versa.
o Portability: The lightweight nature and smaller size of a pen
drive make it possible to carry it from place to place, making
data transportation an easier task.
o Backup Storage:Most of the pen drives now come with the
feature of having password encryption, important information
related to family, medical records, and photos can be stored
on them as a backup.
o Transport Data: Professionals or Students can now easily
transport large data files and video, audio lectures on a pen
drive and access them from anywhere. Independent PC
technicians can store work-related utility tools, various
programs, and files on a high-speed 64 GB pen drive and
move from one site to another.
ii. Memory card: A memory cardor memory cartridge is an electronic
data storage device used for storing digital information, typically
using flash memory. These are commonly used in portable electronic
devices, such as digital cameras, mobile phones, laptop computers,
tablets, PDAs, portable media players, video game consoles,
synthesizers, electronic keyboards and digital pianos, and allow
adding memory to such devices without compromising ergonomy,
as the card is usually contained within the device rather than
protruding like USB flash drives.
Difference between Primary and Secondary Memory
Below are some main differences between primary and secondary
memory in computer organization.
AD
Primary Memory Secondary Memory
Secondary memory is not accessed
directly by the Central Processing Unit
Primary memory is directly accessed (CPU). Instead, data accessed from a
by the Central Processing Unit (CPU). secondary memory is first loaded into
Random Access Memory (RAM) and
then sent to the Processing Unit.
RAM provides a much faster-accessing
speed to data than secondary memory. Secondary memory is slower in data
Computers can quickly process data by accessing. Typically primary memory is
loading software programs and six times faster than secondary
required files into primary memory memory.
(RAM).
Primary memory is volatile and gets Secondary memory provides a feature
completely erased when a computer is of being non-volatile, which means it
can hold on to its data with or without
shut down.
an electrical power supply.