Unit 2
Unit 2
UNIT-2
COMPUTER MEMORY
Prepared By: Javed Ahmad SSIT GHSS DHAKKI D.I.Khan
2.1 INTRODUCTION
• It is one of the important and compulsory
components of every computer system. 2
• Used to store data or programs on a temporary or
permanent basis for use in a computer.
• From the moment user turn the computer on until
the time it is shut down, the CPU of the computer
is constantly using memory.
Types:
• Primary Memory
• Secondary Memory
TYPES:
It has two main types. 3
• Primary or Main or Internal Memory which
holds instructions and data when a program is
executed,
• Secondary or Auxiliary or Backing Storage
Memory holds data and programs not
currently in use and provides long-term
storage.
2.1.1 Units of Memory
a. Bit: 4
• A bit or binary digit is the basic unit of
information in computing.
• A bit is the smallest amount of memory
a computer can recognize.
• A bit can hold only one of two values,
either 'O' or '1’.
• Computers represent information in
binary code, written as sequences of Os
• A bit has two stable states, to represent 0
and 1. Such a system is called bi-stable. 5
• Eight bits make up a byte.
b. Byte
• A byte is a unit of data that is eight bits 6
long.
• Used to represent a character such as an
alphabet, a number, or a special symbol.
For example.A, h, 6, 4, #, @, *, etc.
• Computer storage is measured in byte
multiples. For example, a 500 Gigabyte
(GB) hard drive holds 500 billion bytes of
data.
Higher units of memory
Kilobyte: 7
• Kilo means one thousand (1000) but in
digital computer as information is stored
in binary digits (0, 1) and its units are
power of 2 and the most nearest number
near thousand is 2 ^10 = 1024.
• It is commonly abbreviated as KB (for
Kilo Bytes).
• Megabyte:
• Mega means one Million (2^20 = 8
1048576).
• It is commonly abbreviated as MB.
• 1MB = 1024 KB
• Gigabyte:
• The prefix Giga means 2^30.
• The unit symbol for the Gigabyte is GB.
• 1GB = 1024 MB
• Terabyte: The prefix Tera means 2^40.
• The unit symbol for the Terabyte is TB. 9
• 1TB = 1024 GB
10
c. Memory Word
• A word is simply a fixed sized group of bits 11
that are handled together by the system.
• Modern computers usually have a word
size of 16, 32 or 64 bits.
• A computer that has a bigger word size
can transfer more bits into the processor
at a time for processing and this improves
the processing speed of the computer.
2.2 PRIMARY MEMORY
12
• Used to store data that is used by the system at
startup and to run various types of programs
such as the operating system.
• Can range up to several gigabytes.
• When users load software from hard disk, it is
stored in the main memory first and then it is
executed.
• CPU gets programs from the main memory for
2.2.1 Chip memory and Magnetic
memory 13
Two types:
a. Chip memory
• Chip or microchip is a small piece of semi-
conducting material (usually silicon).
• A small circuit called IC (Integrated
Circuit) is embedded in it.
• Made out of millions of capacitors and
• Chip memories are very fast as compared
to other memories as there are no 14
mechanical moving parts in them but on
the other hand chips rely on electric
currents.
• Examples RAM, ROM and Cache, Flash
memory drives, memory cards and
registers.
•
15
b. Magnetic memory
• Used since 1950s until the era of Chip memory
• Began in the early 1970s. 16
• Extremely reliable.
• Provides non-volatile storage.
• Needs no continuous power to retain its data.
• Used in the hard drives of computers as well as in
magnetic tape.
17
2.2:2 Volatile and Non-Volatile memory
a. Volatile memory
• It retains the information as long as power 18
supply remains on, but when power supply
goes off or interrupted, the stored data is
lost.
• Also known as temporary memory.
• Examples: RAM and Registers.
b. Non-Volatile memory
• It is a permanent memory that can retain 19
the stored information even if power
supply is off.
• Examples: ROM, flash memory, magnetic
storage devices (e.g. hard disks and
magnetic tape), optical disks, and blue-ray
disk.
• Typically used for secondary storage, or
long-term storage for future use.
2.2.3 Fundamental types of Main
Memory
a. Internal processor memory 20
b. RAM
c. ROM
a. Internal processor memory
Directly accessible to the CPU and are
extremely fast.
Has two main types.
i. Cache memory
ii. Registers
21
i. Cache Memory
• Cache (pronounced as cash) memory is 22
extremely fast Static RAM (SRAM) that is
built into a computer's central processing
unit (CPU).
• The CPU uses cache memory to store
instructions that are repeatedly required
to run programs.
• When any information is required by the
processor, first it will look up in the cache
23
memory, and if it is not available in the
cache then it will fetch it from the RAM.
There are three levels of cache memory.
• L1 (Level 1) Cache
• L2 (Level 2) Cache
• L3 (Level 3) Cache
L1 cache
• Built into the actual processor core.
24
• High speed memory, which operates at
the same speed as the CPU.
• It is the fastest memory and closest to
the CPU but very expensive and small in
size (typically 8, 16, 20, 32, 64 or 128
Kbytes).
L2 cache
• Pulls information from the system's main
25
memory (RAM), which is then accessed by
the L1 cache.
• Reasonably fast memory, bigger in size
and less expensive than L1 cache.
• Normally 64 KB to 16 MB.
L3 cache
• Biggest cache memory that caters to the
needs of the microprocessor by 26
anticipating data requests so that
processing instructions are provided
without delay.
• Faster than RAM.
• CPU first looks for the instructions in L1
cache, then it checks L2 and L3 cache
respectively.
•
27
ii. Registers
• Registers are small memory units.
• There are a large number of registers 28
inside the processor.
• Their function is to temporarily store
binary information and pass it to the other
parts of the processor or main memory
during the execution of program
instructions.
• Examples: accumulator, instruction
register, program counter and memory
address registers.
The main registers are:
• Accumulator register (AC), stores the
results of arithmetic and logical 29
operations.
• Status register holds system status
indicators (carry digits, overflow).
• Instruction register (IR), contains the
current instruction being processed.
• Program counter (PC), contains the
address of the next instruction to process.
• Buffer register, temporarily stores data from the
memory.
30
31
b.RAM (Random Access Memory)
• Most common type of computer memory. 32
• It is the Read and Write (R/W) memory.
• Volatile memory
• Holds data and processing instructions
temporarily until the CPU needs them.
• Consists of small electronic chips which
are mounted in modules (small printed
circuit boards).
• These modules are installed in the
Computer's motherboard using sockets.
Different types of RAM modules are shown in Figure
2.4.
33
34
35
Types of RAM
i.Static RAM (SRAM) ii. Dynamic RAM (DRAM)
i. Static RAM (SRAM) 36
• A type of semiconductor memory where the
word “Static" indicates that it does not need to
be periodically refreshed to retain its data.
• More expensive, but faster and significantly
less power hungry than DRAM.
• Mainly used to make the CPU's cache.
ii. Dynamic RAM
• A semiconductor memory where the word
"Dynamic” indicates that it needs to be 37
periodically refreshed to retain its data.
• Used as internal memory
• Higher storage capacity and low cost as
compared to SRAM.
Types of Dynamic RAM:
a. SDRAM
38
b. DDR SDRAM
a. SDRAM
• Stands for Synchronous Dynamic Random Access
Memory.
• A high speed semiconductor memory.
• It is an improved form of the older DRAM
(Dynamic Random Access Memory).
• SDRAM operates synchronously, which means
that it operates in sync with the system data
bus.
• Therefore, can operate at much greater speeds
b. DDR SDRAM (Double Data Rate SDRAM)
• An improved SDRAM which allows a computer to
transfer data at twice the speed. 39
• It has improved memory clock speed as compared to
simple
SDRAM.
• Can reads or writes two consecutive words per clock
cycle.
• There are many types of DDR SDRAMs used for
computers
today, including DDR1 RAM (Double Data Rate), DDR2
RAM and DDR3 RAM ranging in speed from 100 MHz to
2000 MHz.
• C. ROM (Read Only Memory)
• A non volatile memory, i.e., the information
stored in it, is not lost even if the power supply 40
goes off.
• Used for the permanent storage of information.
• Also possesses random access property.
• Information cannot be written into it by the users.
• In other words the contents of ROMs are decided
by the manufactures.
Types
i. Programmable Read Only Memory (PROM)
ii. Erasable Programmable Read Only Memory 41
(EPROM)
iii. Electrically Erasable Programmable Read Only
Memory EEPROM
i. PROM
• It is a type of ROM which can be programmed
once and then can never be changed.
• Manufactured blank and then it is programmed
just once by “blowing” its fuses.
• This process is irreversible.
• Once a bit position is blown, it can never be un-
ii. EPROM
• An erasable PROM.
• The stored data in EPROM can be erased by 42
exposing it to Ultra Violet (UV) light for about 20
minutes.
• When it is exposed to UV light, the entire data is
erased.
iii. EEPROM EEPROM (Electrically Erasable
PROM)
• A chip that can be erased and reprogrammed
on the board.
• It can be erased within a few milliseconds.
• There is a limit on the number of times the
2.3 SECONDARY STORAGE
• Used to hold data permanently.
• Also called external storage or backing storage. 43
• Lies outside the CPU.
• it is non-volatile.
• Examples: Hard Disk drive, CD, DVD, Blue Ray
Disk, Flash memory and Memory cards.
2.3.1 Characteristics of Secondary Storage
Devices
• Non-volatile. 44
• High capacity.
• Less expensive.
• Erasable.
• May be sequential and random.
2.3.2 Sequential Access and Direct Access
Storage
a. Sequential Access Storage 45
• Data is stored and read in a linear order.
• This order is pre-determined and follows a
logical progression.
• Common example: audio or video cassette.
• Much cheaper to produce than Random Acess.
• The main drawback is that it usually takes
longer to physically access particular piece of
data.
• Example: Magnetic Tape
b. Direct Access Storage
• Also called Random access.
• Data is stored at precise locations, enabling the 46
computer to retrieve information directly
without having to scan a series of records.
• Examples: Magnetic disks, Compact disks
• Efficient as compared to sequential access.
• The only drawback is that these devices are
costly as compared to sequential access
devices.
• Types of Secondary Storage Devices
• a. Magnetic Tapes b. Magnetic Disks
• c. Optical Disks d. Chip Memory 47
• a. Magnetic Tapes
• Used for data storage for over 50 years.
• Sequential access storage device used for data
collection and backup.
• It consists of a thin tape with a coating of a fine
magnetic material, used for recording analog or
digital data.
• A device that stores computer data on magnetic
tape is a tape drive.
• Cheaper and are more durable.
• Usually used for taking backup of data.
• The major drawback of tape is its sequential 48
format.
• Locating a specific record requires reading
every record before.
• Used for storing large amount of data.
• Modern tapes can store data up to 5 Terabytes.
49
b. Magnetic Disks
• The most common type of secondary storage
devices. Made of either flexible plastic material 50
(Old Floppy disks) or rigid metal (Hard Disks).
• Magnetic disks are coated with a magnetic
substance.
• Each surface of the disk is subdivided into
concentric rings called tracks.
• Disks with bigger capacity have more tracks.
• Examples: Floppy disks, Zip disks and Hard
disks.
i. Floppy disks and Zip disks
• Old type of magnetic storages.
• Flexible plastic disks coated with magnetic 51
material on both sides.
• Packed inside a plastic jacket for protection.
• Floppy disks are inserted in floppy disk drive
for reading and writing information.
• Due to their limited storage size these have
been obsolete now days.
• Maximum storage capacity is 1.44 MB.
• Zip disks are also old type of removable
storage devices.
• A zip disk is somewhat like floppy disk, only the 52
size and capacity of disks are different.
• A zip disk can hold around 100 MB to 250 MB of
data.
• Zip and Floppy disks are almost obsolete now a
days because other storage media like Flash
memory and CDs are becoming more popular
due to their large storage capacity and low
cost.
ii. Hard disks
• A non-volatile, random access storage device.
• It contains rotating platters on a motor-driven 53
spindle within a protective enclosure.
• Data is magnetically read from and written to
the platter by read/write heads.
• Dominant devices for secondary storage of
data in general purpose computers since the
early 1960s.
• A typical HDD design consists of a spindle that
holds flat circular disks, also called platters,
which hold the recorded data.
• Operate at a speed of 7,200 rpm.
• Information is written to and read from a platter
as it rotates. 54
• An actuator arm (or access arm) moves the heads
on an arc across the platters as they spin,
allowing each head to access almost the entire
surface of the platter as it spins.
• A typical HDD has two electric motors; a disk
motor that spins the disks and an actuator
(motor) that positions the read/write head
assembly across the spinning disks.
• The surface of the disk is divided into tracks and
sectors before writing data.
• Tracks are concentric circles (circles within 55
circles).
• The data is stored as tiny magnetic spots on the
tracks.
• Sectors are the further divisions of tracks, which
hold a block of data that is read or written at
one time.
iii. Optical disk
• It is a flat, usually circular disk which encodes
binary data in the form of pits (binary value of 0 56
or off, due to lack of reflection when read) and
lands (binary value of 1 or on, due to a
reflection when read) on a special material
(often aluminum) on one of its flat surfaces.
• The data is stored on the disc with a laser and
can be accessed when the data path is
illuminated with a laser diode in an optical disc
drive which spins the disc at speeds of about
200 rpm up to 4000 rpm.
• The one side of an optical disc usually has a
• The other side of the disc contains the actual
data and is typically coated with a transparent
material, usually lacquer. 57
• Unlike floppy disk, most optical discs do not
have an integrated protective casing and are
therefore susceptible to data transfer problems
due to scratches, fingerprints, and other
environmental problems.
• Types
• i. CD (Compact Disk)
• ii. DVD (Digital Versatile Disk)
• iii. Blue Ray Disk (BD)
i. CD (Compact Disk)
• A compact disk (CD) is a plastic-fabricated,
circular medium for recording, storing, and 58
playing back audio, video, and computer
data. Designed to support one of three
recording types: read-only (e.g. CD-ROM),
recordable (write-once, e.g. CD-R), and re-
recordable (re-writable, e.g. CD-RW).
• Can hold about 700 megabyte of data.
• Thickness: 2.1mm
• Size: 3.5 Inches.
• Track Pitch: 1.6 micro meter.
•
ii. DVD (Digital Versatile Disk)
• An optical disk technology with a 4 to 16
gigabyte storage for video, audio, or other 59
information.
• Very similar to CD but has larger data storage
capacity usually ten times more than a CD
• A DVD writer or player is used to read the data
stored on a DVD.
• DVD players are compatible with CD which
means they can play CDs also.
• Like CDs, DVDs are available as DVD-R and
DVD-RW. Disadvantage is that DVDs require
special drives to read/write data.
iii. Blu-Ray Disk (BD)
• Blu-ray is an optical disk format designed to
store large amount of data. 60
• It is the successor to DVD.
• Uses blue laser to read from and write to the
disk rather than the red laser of DVD players.
• Its main advantage over CD and DVD is that it
has storage capacity of 50 GB to 100 GB.
• It is also faster than CDs and DVDs.
• Another advantage of blu-ray disk is their
durability. They have a special coating that
helps to prevent scratches and marks that
degrade performance.
• Blu-ray disks cannot be used on the current CD
and DVD players, because those players lack
the blue-violet laser required to read the disks. 61
However, Blu-ray players can run CDs and
DVDs.
• It requires a special blue-ray drive for reading
and writing.
2.3.4 Chip Memory as Secondary storage
• A chip is a small piece of semi-conducting 62
material (usually silicon).
• A small circuit called IC (Integrated Circuit) is
embedded on it.
• A typical chip contains millions of electronic
components (transistors).
• Flash memory and memory cards are the two
common types of chip memories which are
used as portable secondary storage in
computers.
a.Flash Memory
• Non-volatile and can be electrically erased.
• Used in memory cards, USB flash drives etc. 63
• Also called as EEPROM.
• Example applications include laptop computers,
digital audio players, digital cameras and
mobile phones.
Advantages
• Highly portable.
64
Faster in read and write.
• Has smaller size.
• Less prone to damage.
• It is cheaper than traditional drives.
• It uses less power than traditional hard disk
drives.
• Durable.
• Fast read write speed.
•
Disadvantages
• It has a limited number of write and erase
cycles.
65
• Most flash drives do not have a write-
protection mechanism.
• Due to small in size, these devices can easily
be lost.
b. Flash Memory Cards
• A data storage device used for storing data 66
such as text, pictures, audio, and video.
• Used in digital cameras, mobile phones, laptops
etc.
• They are small, rerecordable, and able to retain
data without power.
Advantages
• Non-volatile memory.
67
• Data is not lost in power failure.
• They are solid state media hence free from
mechanical difficulties or damages.
• They require less amount of power.
• They are highly portable.
• They do not produce any noise while
reading/writing.
• They have large storage capacity.
• They can easily fit in memory card slot in
Disadvantages
• They can break easily. 68
• They can be lost, misplaced or smashed.
• May be corrupted and data become unreadable.
• Sometimes work slow.
69