Lectures - 5-6 SW
Lectures - 5-6 SW
Computer Fundamentals
Lecture # 05-06
Computer Memory
• Computer memory is the physical device used to store
data and programs (set of instructions) temporarily
or permanently.
Data
+
Programs
3
Computer Memory
Memory
4
Computer Memory
Primary Memory
Holds Data
and Programs
that are
currently
being
processed by
the processor 5
Types of Primary Memory
• There are two types of primary memory:
6
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
(from RAM)
8
RAM (Random Access Memory)
• It is Read and Write memory.
9
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.
10
ROM (Read Only Memory)
• It stands for Read Only Memory.
12
POST (Power On Self Test)
13
ROM (Read Only Memory)
• The access mechanism is Random like RAM.
14
ROM (Read Only Memory)
• ROM is Read Only, we can only read but can not easily
change/update the contents.
15
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 non-volatile memory.
• Computer may run without secondary memory.
16
Secondary Memory
• Stores data and programs permanently
• its retained after the power is turned off
• Main Examples
1. Hard Disk
2. Optical Disk
3. Flash memory
17
Secondary Memory: Hard Disk
• Called Disk drive or HDD
• stores and provides relatively quick access to large amounts of
data.
• Stores data on an electromagnetically charged surface or set of
surfaces.
18
Inside Hard Disk
track
sector
head
19
Secondary Memory: Optical Disk & Flash
• an optical disc drive (ODD) is a disk drive that uses laser light to store data.
• There are three main types of optical media: CD, DVD, and Blu-ray disc
20
Secondary Memory: Flash Disk
• A storage module made of flash memory chips. A Flash disks have no mechanical
platters or access arms, but the term "disk" is used because the data are accessed as
if they were on a hard drive. The disk storage structure is emulated.
21
RAM V/s Hard Disk
22
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.
23
Cache Memory
• Cache memory has limited capacity.
• Most processors have L1, L2 and L3 (Level 1, Level 2 and
Level 3) Cache.
• L1 cache is built inside the microprocessor
• 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.
24
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
25
Memory Measurement Units
– BIT
– Nibble
– Byte
– Word
26
Units of Memory Measurement
• Memory stores the data temporarily or permanently.
• The basic unit of memory is BIT.
0 OR 1
27
Units of Memory Measurement
• If we combine two bits, they can store one of 4 possible values.
• Example: 10
00
01
10
11
28
Units of Memory Measurement
• If we combine three bits, they can store one of 8 possible values.
• Example: 110
000
001
010
011
100
101
110
111
29
Units of Memory Measurement
30
BIT
Bit
Single binary digit.
Example 1: 0
Example 2: 1
31
Nibble
Nibble
Combination of 4 bits.
Example 1: 1101
Example 2: 1111
Example 3: 1001
32
Byte
Byte
Combination of 8 bits.
Example 1: 11011101
Example 2: 11111101
Example 3: 10010100
33
Word
Word
Combination of 2 bytes (16 bits).
Example 1: 1101110100101101
Example 2: 1111110110110101
Example 3: 1001010000001011
34
Unit of Measurements - Storage
Storage Units
Bit BIT 0 or 1
Byte B 8 bits
35
Units of Memory Measurement
1 Byte = 8 Bits
• 1 bit Contain (1 or 0)
• 8 bits Byte
• 16 bits
• 32 bits
• 64 bits
Size Example
• 1 bit - answer to a yes/no question
• 1 byte - a number from 0 to 255.
• 90 bytes: enough to store a typical line of text from a book.
• 4 KB: about one page of text.
• 120 KB: the text of a typical pocket book
• 3 MB - a three minute song (128k bitrate)
• 650-900 MB - a CD-ROM
• 1 GB -114 minutes of uncompressed CD-quality audio at 1.4 Mbit/s
• 8 -16 GB - size of a normal flash drive
38
• 10B is equivalent 10 * 8 = 80 bits
• 3MB is equivalent to how many Bits?
• Answer:
• 3 *1024 = 3072 KB
• 3072*1024 = 3145728 B
• 3145728 * 8 = 25165824 bits
39
40