Memory System
Memory System
MEMORY
PRIMARY
MEMORY
(MAIN HARD DISK
MEMORY 1TB
L1
(MAGENETIC)
CODE
CACHE DRAM FLOPPY DISK
4KB L2 CACHE (4 GB-8 GB) 1.44MB
(MEGNETIC)
PROCESSOR L3 CACHE
1 MB-8 MB
O OREGISTERS CD
700 MB
(SRAM) (OPTICAL)
141
DATA
CACHE DVD
4KB ROM 4.7 GB
(1 GB-4 MB (OPTICAL)
PEN DRIVES
1 GB-64 GB
(SEMI
CONDUCTOR)
SPEED COST STORAGE CAPACITYY
Microcontroller (MU-Sem 4-E&TC) (The Memory Systems)..Page no. (2-6)
Dynamic RAM
Static Ram
1 Stores data in Stores data in capacitors.
flip-flops.
2 Faster as no charging and discharging time Slower as time is wasted in charging and
wasted.
discharging.
3 Very expensive as each flip-flop that holds just Much cheaper as each capacitor that holds one bit
one bit, contains 4 or 6 transistors. needs only 1 transistor to let it charge or discharge.
4 For the same reason as above, each bit takes Each bit takes less surface area hence data density is
more surface area and hence the data density is much higher.
much lesser.
5 Power consumption is much higher due to the Power consumption is much lower due to much
large number of transistors. lesser transistors.
6 Gets very
very heated due to high power Much cooler operating temperature.
consumption.
7 Does not require any refreshing circuit. Capacitors discharge so requires constant refreshing.
8 Does not need an SRAM Controller. Needs a DRAM Controller like 8203.
9 Used in Cache memory. Used in Main memory.
10 Typical size: 1-4 MB Typical size: 4-8 GB
Paging Negmentation
Paging is a physical division of the memory. Segmentation is a logical division of the memory.
Pages are of a fixed size. Segments are of variable sizes.
3 Fragmentation (wastage of unused space) is high | Fragmentation is low as segments are of variable
as pages are of fixed size. size.
4 Completely hidden from programmer. Controlled by programmer.
5. Does not offer much control over protection As segments are controlled by the programmer, we
mechanism can different privilege levels to segments.
assign
Hence provides better control over protection
mechanism.
6. Does not differentiate between code and data. Code and data segments are treated differently.
7. Pages are loaded based onalgorithms such as Segments are loaded based on algorithms such as
FIFO, LRU, LFU etc. First Fit, Best Fit etc.
can be either global o r local. Global
8. Does not allow sharing of code or data between | Segments
different processes/ tasks. segments canbe shared among all tasks.
a2.1.1 Registers
1) Registers are presentinside the processor.
2) They are basically a set of flip-flops.
3) They store data and addresses and can directly take part in arithmetic and logic operations.
4) They are very small in size typically just a few bytes.
2.1.2 Primary Memory
1) lt is the original torm of memory also called as Main memory.
2) It conmprises of RAM and ROM, both are Semi-Conductor memories. (chip memories)
3) ROM is non-volatile.
It is used is storing permanent information like the BIOS program.
It is typically of2 MB 4 MB in size.
4) RAM is writable and hence is used for day-to-day operations.
Every file that we access from secondary memory, is first loaded into RAM.
To provide large amount of working space RAM is typically 4 GB -8 GB.
2.1.3 Secondary Memory
1) The main purpose of Secondary Memory is to increase the storage capacity, at low cost.
2)
2) Its biggest component is the Hard Disk.
3) This is where all the files inside a computer are stored.
4) It is writeable as well as non-volatile.
5) Typical size of a HD is 1 TB.
Disk memories are much slower than chip memories but are also much cheaper.
6)
a2.1.5 Cache Memories
1) It is the fastest form of memory as it uses SRAM (Static RAM)
2) The Main Memory uses DRAM (Dynamic RAM).
)SRAM uses flip-flops and hence is much faster than DRAM which uses capacitors.
4) But SRAM is also very
expensive as compared to DRAM.
5) Hence only the current portion of the file we need to access is copied from Main Memory (DRAM)
Cache memory (SRAM), to bedirectly accessed by the processor.
6)
6) This gives maximum performance and yet keeps the cost low.
7) Typical size of Cache is around 2 MB-8MB.
8) If code and data are in the same cache then it is unified cache else its called split cache.
9) Depending upon the location of cache, it is of three types: L1, L2 and L3.
10) LI cache is present inside the processor and is a split cache typically 4-8 KB.
11) L2 is present on the same die as the processor and is a unitied cache typicaly 1 MB.
and is typically of 2-8 MB.
12) L3 is present outside the processor. It is also unified
2.2 Semiconductor Memories / Primary Memory
Semiconductor memories are mainly used to implement Physical Memory (Primary Memory).
They are of two main
types: Non-Volatile memory (ROM) and Volatile memory (RAM)
2.2.1 Non-Volatile Memories
ROM is non-volatile memory.
The contents of ROM retained when power
are even supply is cut off.
It is used to store permanent information in a computer like the BIOS program (booting program).
There are several types of ROMs
1. ROM
This is the original form of ROM.
It is purely read-only.
2. PROM
This is
Programmable ROM.
Iitially it is blank. It can be written by the programmer but only once
Thereafter it becomes
read-only.
Hence it 1s also called OTPROM -
One Time Programmable ROM.
3. EPROM
This is Erasable
Programmable ROM.
It can be erased and
re-written by the programmer as many times as desired.
Erasure is done by exposure to ultra violet light.
On exposure to u-V rays, the entire chip is erased and can be then re-Written.
4. EEPROM
This is Electrically Erasable Programmable form of ROM.
It can be erased and re-written by the programmer as many times as desired.
Erasure is done electrically by increasing the voltage to a higher level, generally 12.5 V.
Erasure is byte wise and hence only a desired section can be erased instead of total erasure.
5. FLASH ROM
It is a modified form of EEPROM.
EEPROM does byte wise erasure, which is good for precision but very
bad for performance.
Flash ROM does block-wise erasure.
be varied.
The block size is generally 512 bytes but can
traditional EPROM.
This makes it much faster than
used in Pen Drives, Memory
Cards, Solid State Drives etc.
It is the one
EVolatcileMemories
RAM is volatile memory.
The contents of RAM are lost when
power supply is cut off.
It forms the major component of
Primary Memory.
It is extremely fast as compared to
secondary storage devices, hence all programs and data from
secondary storage is first loaded into RAM and then accessed by the processor.
There are two main types of RAMs, SRAM and DRAM.
2.3 Cache Memory
1) Cache memory is implemented using Static RAM.
SRAM is much faster than DRAM as it uses flip-flops.
2) SRAM is also much more expensive, power-consuming and large in size.
Hence only a small amount of SRAM is used in the system.
3) Typically the size of cache memory is 2-4 MB.
4)
4) Since Cache Memory is very fast it does not make the processor enter "wait-states".
Hence, whenever the processor needs data, it first tries to find it in the Cache Memory.
If found it is called a Cache Hit or simply Hit. Else it's a Miss.
5) On a miss, processor copies a block containing that data from Main Memory to Cache Memory.
Typical block size is 32 bytes. (P.S.: Block is also referred to as "Line" in some books).
6) Advantage of copying a block is that further access to the block will result into hits.
This gives a sufficiently high Hit ratio, generally around 98%.
7) Hit ratio is calculated as the number of hits/ total number of accesses.
8) Once the entire cache is full, and more blocks have to be brought in from the Main Memory, old blocks aree
replaced by new ones. Similar replacement policies like those in Main Memory are used.
9) lf code and data are in the same cache it is said to be Unified cache, else it is called Split cache.
Main
Word Cache Memory
Memory Block
Processor
Transfer Transfer
4-8 GB
2-4 MB DRAM
SRAM
Fig. 2.3.1