Lecture 6

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 36

INTRODUCTION TO COMPUTING

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 / Main / Working Secondary / Auxiliary


Cache
Memory Memory

RAM ROM Magnetic Optical Solid State


Computer 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

• It is known as main memory or working memory.


• Primary memory holds only those data and instructions on which computer
is currently working on.
• It is generally made up of semiconductor material.
• The data and instruction required to be processed reside in main memory.
• It is divided into two subcategories RAM and ROM.
• Faster than secondary memories.
• A computer cannot run without primary memory.
Types of Primary Memory

• There are two types of primary memory:


RAM (Random Access Memory)
• RAM stands for Random Access Memory.
• It stores the data and programs temporarily.
• It is volatile, means it does not retain its contents when power is turned off.
• It provides the data and programs to the processor so that it can process the
data on the basis of given set of instructions.

Set of Instructions

Data Process Information


RAM (Random Access Memory)

• RAM is a physical chip (collection of chips).


RAM (Random Access Memory)

• It is Read and Write memory.


RAM (Random Access Memory)

• The access mechanism is random (non sequential), means we can directly


access any byte of RAM with out touching any other byte.

• The Memory (RAM + ROM) is divided in to pieces of bytes (8-bits).

• Every byte has got address defined in Hexadecimal.

• Say: ROM = 4 bytes, RAM = 8 bytes, Memory = 8 + 4 = 12 bytes


RAM (Random Access Memory)
200BH 16
200AH 8
2009H 0
2008H 49
2007H 64
RAM
2006H 85
2005H -58
2004H -1
2003H 54
2002H 96
2001H 5 ROM
2000H 25

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.

RAM is further divided in to two types

a) DRAM (Dynamic Random access Memory)


b) SRAM (Static Random access Memory)
DRAM
DRAM stands for Dynamic RAM. A type of physical memory used in most
personal computers.

The term dynamic indicates that the memory must be constantly refreshed
(reenergized) or it will lose its contents.

RAM is sometimes referred to as DRAM.


SRAM
SRAM stands for Static RAM.

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.

• It stores the special program permanently.

• It is non-volatile, means it retains its contents even when the power is


turned off.

• 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).

• The job of BIOS is to execute POST operation (Power On Self Test).

• 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)

• The access mechanism is Random like RAM.

• ROM is hardware chip.

• BIOS is the set of instruction (Program)

• ROM + BIOS = Firmware


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.

The program that controls the machine is stored on ROM.

ROM is further divided in to three types

a) PROM (Programmable Read-Only Memory)


b) EROM/EPROM (Erasable Programmable Read-Only Memory)
c) EEROM/EEPROM (Electrically Erasable Programmable Read-Only Memory)
Read Only Memory (ROM)

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

You might also like