Lecture 6
Lecture 6
Lecture 6
AND PROGRAMMING
Lecture # 6
Computer Memory CLO-1
Batch 20EL
Year: 1st Semester: 1st
Contents
1) Computer Memory
2) Computer Memory Hierarchy
3) Computer Memory Classification
4) Primary Memory
5) Secondary Memory
6) Cache
7) Units of Memory Measurement
Computer Memory
Computer Memory
• Computer memory is the physical device used to store
data and programs (set of instructions) temporarily
or permanently.
Data
+
Programs
Computer Memory Hierarchy
Computer Memory Classification
Memory
Primary Secondary
Memory
Cache
Memory
Holds Data
Holds Data
and Programs Holds Data
and Programs
that are and Programs
that are not that are most
currently
currently used frequently
being
by processor used by the
processed by
processor
the processor
Primary Memory
Primary Memory
Set of Instructions
MEMORY
Random Access Memory (RAM)
RAM is used to store programs and data that are being used by the computer.
Data and programs can be put into RAM from either an input device or
backing store.
The data in RAM is lost when the computer is turned off so it is known as
Volatile Memory.
The term dynamic indicates that the memory must be constantly refreshed
(reenergized) or it will lose its contents.
SRAM is a type of memory that is faster and less volatile than DRAM (dynamic
RAM), but it is more expensive.
The term static is derived from the fact that it doesn't need to be refreshed like
dynamic RAM.
ROM (Read Only Memory)
• It stands for Read Only Memory.
• ROM is physical memory chip which stores special program called BIOS
(Basic Input Output System).
ROM (Read Only Memory)
• BIOS is required to start the computer.
• When ever you turn on/ restart the computer, the very first program that
starts is the BIOS (Stored in ROM).
• POST checks whether all the required hardware is present or not? And all
the hardware attached, is working properly or not?
ROM (Read Only Memory)
• ROM is Read Only, we can only read but can not easily change/update the
contents.
2. Read Only Memory (ROM)
The contents of ROM are permanent. It cannot be altered by the user.
The contents are written onto the ROM when it is first made.
ROM keeps its contents even when the computer is turned off and so is known as
Non-Volatile Memory.
ROM is also often used in embedded systems where a small built-in computer is
used to control a device such as a washing machine.
PROM
PROMs are manufactured as blank chips on which data or programs can be
written with a special device called a PROM programmer.
EROM/EPROM
A type of ROM chip which can be erased and programmed with new data.
EROM chips are used for flash memory. EROM is also called EPROM.
EEROM/EEPROM
EEPROM, with the help of an electric field, is eraseable and reprogrammable,
but with a shorter lifetime. This means that it only may be reprogrammed tens to
hundreds of thousands of times.
RAM VS ROM
Secondary Memory
Secondary Memory
• This type of memory is also known as auxiliary/external memory.
• It is slower than main memory.
• These are used for storing data/Information permanently.
• CPU directly does not access these memories. Contents of secondary
memories are first transferred to main memory, and then CPU can access it.
For example : disk, CD-ROM, DVD etc.
• It is known as backup memory.
• It is non-volatile memory.
• Computer may run without secondary memory.
• Slower than primary memories.
Cache Memory
Cache Memory
• Cache memory is a very high speed semiconductor memory which can speed
up CPU.
• It acts as a buffer between the CPU and main memory.
• It is used to hold those parts of data and program which are most frequently
used by CPU.
• The parts of data and programs are transferred from disk to cache memory
by operating system, from where CPU can access them.
• Cache memory is faster than main memory.
• It consumes less access time as compared to main memory.
• It stores the program that can be executed within a short period of time.
• It stores data for temporary use.
Cache Memory
• Cache memory has limited capacity.
• It is very expensive.
• Most processors have L1, L2 and L3 (Level 1, Level 2 and Level
3) Cache.
• L1 cache is built inside the microprocessor.
• L2 and L3 cache are located on the microprocessor chip.
• First, microprocessor finds data in cache memory.
• If data is found in cache, it is called as HIT.
• If data is not found in cache, it is called as MISS.
• In case of MISS, microprocessor requests data from RAM.
Cache Memory
CPU HIT
1. First look in cache for data 3. If data is in cache send it to CPU
Cache
2. If data is not in cache fetch from RAM 4. Send data from RAM, write it to cache
and send it to CPU
RAM MISS
Cache Levels
There are different levels of cache, usually L1, L2 and L3 cache, with L1 cache
being the fastest memory.
Memory Units
Units of Memory Measurement