0% found this document useful (0 votes)
21 views93 pages

Chapter IV CAO

Chapter 4 of the document discusses memory system design, covering characteristics, hierarchy, and types of memory including SRAM, DRAM, and cache memory. It explains access methods, performance metrics, and the organization of memory, highlighting the differences between volatile and non-volatile memory. The chapter concludes with an overview of various types of read-only memory and their applications.

Uploaded by

murtessaahmed9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views93 pages

Chapter IV CAO

Chapter 4 of the document discusses memory system design, covering characteristics, hierarchy, and types of memory including SRAM, DRAM, and cache memory. It explains access methods, performance metrics, and the organization of memory, highlighting the differences between volatile and non-volatile memory. The chapter concludes with an overview of various types of read-only memory and their applications.

Uploaded by

murtessaahmed9
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 93

Agro-Technical and Technology

College (ATTC)
Menschen fuer Menschen Foundation

CHAPTER 4
MEMORY SYSTEM DESIGN
BY
Mr. Chala Tesfaye

EET 4216 - Computer Architecture and Organization


OUT LINE
❑ Characteristicsof a Memory System
❑ Memory Hierarchy

❑ Main Memory

❖ SRAM
❖ DRAM
❑ Organization of a Memory Chip

❑ Memory Module Organization

❑ Cache Memory

❖ Elements of Cache Design


❑ Secondary Memory
OUT LINE

Assignment (20%): Chapter 5


Advanced Concepts
5.1. Pipelining
5.2. Introduction to parallel processing,
5.3. Introduction to Operating Systems
1. CHARACTERISTICS OF A MEMORY SYSTEM
❑ Location (Where the Memory is Found)
❖ Processor Memory → Small, very fast memory inside the CPU (e.g., registers, cache).
❖ Internal (Main) Memory → RAM and ROM, used for running programs and storing
temporary data.
❖ External (Secondary) Memory → Hard drives, SSDs, USB drives, used for long-
term storage.
❑ Capacity (How Much Data Memory Can Store)
❖ Word Size → The number of bits processed at once (e.g., 8-bit, 16-bit, 32-bit, 64-bit).
❖ Number of Words → Total number of words that can be stored in memory.
❑ Unit of Transfer (How Data Moves in Memory)
❖ Word → The smallest data unit moved at a time (e.g., a single instruction or value).
❖ Block → A larger group of words transferred together, used in caching and disk storage.
1. CHARACTERISTICS OF A MEMORY SYSTEM
❑ Access Methods in a Memory System
❖ Sequential Access (e.g., Magnetic Tape)
▪ Data is read in order, starting from the beginning.
▪ Access time depends on how far the required data is from the starting point.
▪ Example: Cassette tapes or backup tapes require reading from start to find specific
data.
❖ Direct Access (e.g., Hard Disk, SSD)
▪ Data is divided into blocks, each with a unique address.
▪ The system moves to the general area (seek time) and then finds the exact data.
▪ Access time depends on data location and previous access.
▪ Example: Hard drives (HDDs) and SSDs access files by jumping to the correct
sector.
1. CHARACTERISTICS OF A MEMORY SYSTEM
❑ Access Methods in a Memory System
❖ Random Access (e.g., RAM & ROM)
▪ Every location has a unique address for direct access.
▪ Access time is constant, regardless of previous access or location.
▪ Example: RAM allows instant retrieval of any stored data.
❖ Associative Access (e.g., Cache Memory)
▪ Data is located by comparing stored content rather than using a specific address.

▪ The system searches for a match within a portion of memory.

▪ Access time is constant and does not depend on location or previous access.

▪ Example: Cache memory in CPUs quickly finds frequently used data without
searching by address.
1. CHARACTERISTICS OF A MEMORY SYSTEM
❑ Performance of Memory Systems
▪ Access Time: The time taken from the moment a request is made until the memory
provides valid data.
• Example: How long it takes for a computer to find and open a file when you search for
it.
• Cycle Time: The total time it takes for the memory to complete one operation, which
includes the time to access the data and the time needed to get ready for the next operation.
• Formula: Cycle Time = Access Time + Recovery Time
• Example: How long it takes for a memory chip to give data and then be ready to give
more.
• Transfer Rate: The speed at which data can be moved or transferred from one place to
another within the system.
• Example: The speed at which data is transferred from your computer to a USB drive.
1. CHARACTERISTICS OF A MEMORY SYSTEM
❑ Physical Types of Memory
• Semiconductor Memory: Uses electronic circuits to store data.

• Includes RAM (Random Access Memory) and ROM (Read-Only Memory).


• Magnetic Memory: Stores data using magnetic fields.
• Includes Disk (e.g., hard drives) and Tape (e.g., magnetic tape).
• Optical Memory: Uses light (laser) to read and write data.
• Includes CD (Compact Disc) and DVD (Digital Versatile Disc).

• Magneto-Optical Memory: Combines magnetic and optical methods to store data.


• Example: CD-RW (Compact Disc-Rewritable), which can be rewritten using both
magnetic and optical techniques.
1. CHARACTERISTICS OF A MEMORY SYSTEM
❑ Physical Characteristics of Memory
• Volatile / Non-Volatile
• Volatile: Memory that loses its data when the power is turned off (e.g., RAM).

• Non-Volatile: Memory that retains its data even when the power is turned off
(e.g., ROM, Hard Drives).
• Erasable / Non-Erasable
• Erasable: Memory that can have its data erased and rewritten (e.g., RAM, CD-RW).

• Non-Erasable: Memory that cannot be easily erased or rewritten (e.g., ROM,


PROM).
• Power Consumption
• Refers to the amount of electrical energy the memory uses during operation.

• Low Power: Memory that uses less electricity (e.g., Flash memory).

• High Power: Memory that requires more electricity (e.g., RAM).


1. CHARACTERISTICS OF A MEMORY SYSTEM
❑ Organization of Memory
• Physical Arrangement of Bits into Words

• Memory is organized into bits (the smallest units of data) grouped together into
words (larger units of data).

• The way these bits and words are organized can affect how the memory is accessed
and used, but the organization is not always obvious or straightforward.
2. MEMORY HIERARCHY
❑ Memory design is governed by three questions:
 How Large? How much data does the memory need to store?
 How Fast? How quickly does the memory need to provide data to the system?
 How Much? How much should the memory cost to implement?

❑ Three Rules of Memory Design:


 Faster access time, greater cost per bit.
 Greater capacity, slower access time.
 Greater capacity, smaller cost per bit.

❑ To balance speed, size, and cost, memory systems are arranged in levels, with each type
of memory serving a different purpose.
• Fast and Small: Cache memory (expensive, quick).
• Large and Slow: Hard drives (inexpensive, slower).
• Balanced: RAM (middle ground between speed and size).
2. MEMORY HIERARCHY
❑ Memory hierarchy is the organization of memory in a computer system based on speed,
cost, and capacity.
❑ Faster memory is expensive but small in size, while slower memory is cheaper and larger.

• Registers – Super-fast, inside CPU,


holds tiny bits of data.
• Cache – Small, very fast memory
that stores frequently used data.
• RAM (Main Memory) – Bigger, fast
memory that holds running programs.
• Storage (HDD/SSD) – Large, slower
memory for saving files.
• Backup (Tapes/CDs) – Very slow,
used for long-term storage.
2. MEMORY HIERARCHY
❑ Locality of Reference

❖ The memory hierarchy is effective due to a natural phenomenon called “locality of


reference”.

❖ Locality of reference refers to the tendency of a program to access the same


memory locations or related storage locations repeatedly over a short period, based
on its memory access patterns.

❖ During the execution of a program, memory references for instructions and data tend
to cluster.

❖ Keeping the current cluster in the faster memory level allows faster memory access.
3. MAIN MEMORY
❑ Relatively Large and Fast: Main memory is large enough to store the programs and data the
CPU is currently using, and it provides quick access to this information.
❑ Used for Program and Data Storage During Operation: It temporarily holds the operating
system, applications, and data that are actively being used by the computer.
❑ Based on Semiconductor ICs: The technology behind main memory relies on semiconductor
integrated circuits (ICs), which make it small, fast, and reliable.
❑ Usually Referred to as RAM (Random Access Memory): Main memory is often called
RAM because it allows random access to any memory location, meaning the CPU can
directly access data from any location without needing to follow a sequence.
❑ More Accurate Name – Read/Write Memory (R/W Memory): A more precise description
of this memory type would be Read/Write Memory because data can both be read from and
written to main memory
3. MAIN MEMORY
❑ RAM (Random Access Memory)
• Read and Write Operations: RAM allows both reading data from and writing data to
memory, enabling the CPU to access and update data as needed.
• Performed Electrically: Both read and write operations in RAM are carried out using
electrical signals.
• Volatile: RAM is volatile, meaning it loses its stored data when the power is turned off.
• It is used only for temporary storage while the computer is running.

• Temporary Storage: Since RAM is volatile, it is used to store data and instructions
only while the computer is operating. Once the power is lost, all data in RAM is erased.
• Two Main Varieties:
• Static RAM (SRAM): Faster and more reliable.

• Stores data using flip-flops (no need to refresh), but is more expensive and consumes
more power.
• Dynamic RAM (DRAM): Slower than SRAM but cheaper and more common.
• Stores data in capacitors, which need to be periodically refreshed to retain the data.
3. MAIN MEMORY
Dynamic RAM (DRAM)

❖ Used for Main Memory: DRAM is the primary memory in most computer systems
due to its affordability and large capacity.
❖ Inexpensive: It is cheaper than Static RAM (SRAM), making it ideal for high-capacity
memory needs.
❖ Uses One Transistor per Bit: Data is stored as an electrical charge in capacitors.
• This design allows for high-density memory storage.
❖ Destructive Read:
▪ When data is read from DRAM, the charge in the capacitor is drained.
▪ The data must be rewritten immediately after reading to prevent loss.
3. MAIN MEMORY
❑ Dynamic RAM (DRAM)
❖ Charge Decay: The electrical charge stored in the capacitor naturally fades over time.
❖ Need for Refreshing: DRAM must be refreshed periodically, even when powered, to
prevent data loss.
❖ Refreshing Process: The memory controller reads and rewrites each word every few
milliseconds to restore the charge.
❖ Refresh Rate: The frequency at which DRAM is refreshed to maintain data integrity.
❖ Power Usage in Suspended Mode: In laptops, during standby mode, power is primarily
used for DRAM refresh to keep data intact.
3. MAIN MEMORY
❑ Static RAM (SRAM)
• Stores data using flip-flops, which are tiny circuits that hold binary information (0s
and 1s).
• No need for refreshing because the data stays as long as power is on.
• Non-destructive read, meaning reading the data doesn’t erase it.

• More complex design, making it larger in size and less dense (stores less data per
chip).
• More expensive than other types of memory.
• Faster than other types of RAM.
 Main Use: SRAM is mostly used for Cache Memory, which is a small, super-fast
memory that helps speed up processing.
3. MAIN MEMORY
Feature SRAM (Static RAM) DRAM (Dynamic RAM)
Storage Cell
More complex (flip-flop) Simpler (capacitor & transistor)
Complexity
Density Less dense Denser (more bits per unit area)
Cost More expensive Less expensive
Power Consumption Higher Lower
Speed Faster Slower
Retains data as long as power is
Data Retention Requires frequent refreshing
supplied
Extra Circuitry No need for refresh mechanism Needs refresh circuitry
Cache memory (CPU caches, Main memory (RAM in
Primary Use
high-speed applications) computers)
Key Takeaways:
• DRAM is preferred for main memory due to its higher density and lower cost.
• SRAM is used in cache memory where speed is critical despite its higher cost and larger cell size.
3. MAIN MEMORY

SRAM CHIP
ORGANIZATION
3. MAIN MEMORY
❑ Read-Only Memory (ROM)
• Can only be read, not written to (data is fixed).
• Non-volatile, meaning it keeps its data even when power is off.
• Used for:

• Microprogramming (small, low-level programs that control hardware).

• System programs (like BIOS, which helps start a computer).

• Embedded systems (like in washing machines, calculators, and cars).

• Library subroutines & function tables (pre-stored functions for programs).

• Constants (fixed values that never change).

 Manufactured with data permanently stored, so there’s no room for mistakes once
written, it cannot be changed.
3. MAIN MEMORY
ROM STRUCTURE
3. MAIN MEMORY
❑ Programmable ROM (PROM)
• Non-volatile → Data stays even when power is off.

• Write Once, Read Forever → Can be programmed only once; no changes allowed
afterward.

• Programmed After Manufacturing → Uses special equipment to write data.

• Uses Fuses Instead of Diodes → Programming burns specific fuses with a high-
voltage pulse (10–30V) to store data.

• Cannot Be Erased → Once written, the data is permanent.

❑ Used for permanent data storage in devices like firmware, security keys, and
hardware configurations.
3. MAIN MEMORY
❑ Erasable PROM (EPROM)
• Non-volatile → Data stays even when power is off.

• Uses floating-gate MOS transistors → These transistors store data that changes
behavior when exposed to ultraviolet (UV) light.
• Programmed electrically → Data is written electrically, but it can be erased and
reprogrammed using UV light.
• Erasing → Erasing takes about 20 minutes and can be done up to 100,000 times.
• Before writing → All cells must be erased first by exposure to UV light.

• More expensive than PROM → Because it allows erasing and reprogramming, it


costs more.

❑ Used in applications where you might need to update or modify data, like firmware
updates and development.
3. MAIN MEMORY
❑ Electrically Erasable PROM (EEPROM)
• Non-volatile → Data is retained even when power is off.
• Uses floating-gate transistors with thinner insulating material compared to EPROM.
• Inversion with voltage → Its operation can be reversed using electrical voltage,
allowing for writing and erasing.
• Can be written to anytime → You can modify data without erasing the existing
contents. Only the specific bytes addressed are changed.
• Write time → Writing data takes about 100 microseconds per byte.
• Erasing limit → Can be erased around 10,000 times.
• Updatable in place → Data can be updated without needing to remove the chip.
• More expensive and less dense than EPROM → Costs more and stores less data per
chip.
❑ Used in situations where data needs to be updated occasionally, like in BIOS, firmware,
and small data storage.
3. MAIN MEMORY
❑ Flash Memory
• Called "flash" because it can be re-programmed very quickly, with the whole chip
being erased in 1-2 seconds.

• Uses electrical erasure technology → The entire chip or specific blocks of data can be
erased quickly, but it doesn’t support erasing individual bytes.

• One transistor per bit → This allows for very high density, meaning it can store a lot
of data in a small space.
• Cost → Flash memory is less expensive than EEPROM but more expensive than
EPROM.
• Non-volatile → Data is retained even when the power is turned off.
❑ Used in USB drives, SSDs, memory cards, and devices that require fast, reliable, and high-
capacity storage.
4. ORGANIZATION OF A MEMORY CHIP
❑ The basic element of a semiconductor memory is the memory cell.

❖ There are different types, but they all share some common properties:

 Two states, 1 and 0.

 It is possible to write into the cell. (At least once).

 They can be read to sense the state.


4. ORGANIZATION OF A MEMORY CHIP
❑ How to organize a-16 Mbit chip?
❖ 1 Mega words of 16 bits each.
▪ Tall and narrow organization.

❖ Chips like to be square.


❖ Typical organization is:
▪ 2048 x 2048 x 4bit array.
▪ Organized internally as a square structure with decoders for row and column.

 Simplifies decoding logic.

 Reduces number of address pins.

 Row and column address bits are multiplexed.


4. ORGANIZATION OF THE MEMORY CHIP
5. MEMORY MODULE ORGANIZATION
❑ Most high-capacity RAM chips contain only a single bit per location.
 To build a multi-bit per location module, we will need multiple chips.

❑ Design a 256K Byte memory system using 8 256K X 1 chips.


 256K requires 18 address wires

 We will apply 9 wires to the row selectors and 9 to the column selectors

 The outputs of the chips are combined together to form the 8 bit output of the system.
ORGANIZATION OF THE 256 K
BYTE SYSTEM

❑ Each chip receives all 18 bits of the


address.

❑ Each chip produces/receives a single bit


of the data.
5. MEMORY MODULE ORGANIZATION

 What if the size of the system is not the same as the chips?

 Design a 1 M Byte system using 256K X 1 chips.


 We will have to arrange the chips themselves into columns and rows.

 There will be 4 columns of chips.

 Number of columns = system’s address space/chip’s address space.

 There will be 8 rows of chips.

 Number of rows = system’s word size/chip’s word size.

 Some of the address wires will have to be used for selecting different rows of chips.
ORGANIZATION OF THE 1 M BYTE SYSTEM
6. CACHE MEMORY
❑ Purpose of Cache Memory
• Provides high-speed access to frequently used data.
• Offers fast memory speed like the best available memory types.
• Helps achieve a large memory size at a lower cost by combining fast and slower
memory types efficiently.
❑ Characteristics of Cache Memory

• Small but very fast memory compared to main memory.


• Acts as a buffer between the CPU and main memory, reducing access time.
• Location:
• Can be inside the CPU chip (L1 cache).

• Can be on a separate module close to the CPU (L2/L3 cache).

❑ Cache memory improves processing speed by storing frequently accessed data, reducing
the need for slow main memory access.
CONCEPTUAL OPERATION
❑ Relatively large and slow main memory together with faster, smaller cache.
❑ Cache contains a copy of portions of main memory.

❑ When processor attempts to read a word from memory, a check is made to determine if
the word exists in cache.
 If it is, the word is delivered to the processor.
 If not, a block of main memory is read into the cache, then the word is delivered to
the processor.

Word Block
Transfer Transfer
CPU Cache
Memory
Main
Memory
HIT RATIO
❑ A measure of the efficiency of the cache structure.
 When the CPU refers to memory and the word is found in the cache, this called a hit.

 When the word is not found in cache, this is called a miss

❑ Hit ratio is the total number of hits divided by the total number of access
attempts (hits + misses).
 It has been shown practically that hit rations higher than 0.9 are possible.
CACHE VS. MAIN MEMORY STRUCTURE
0 ❑Main Memory consists of 2n addressable words.
1
❖ Each word has a unique n-bit address.
2 Block
(K words) ❑We can consider that main memory is made up of blocks of K words
each. Usually, K is about 16

Tag Block ❑ Cache consists of C lines of K


. 0
words each.
. 1
. 2 ❑ A block of main memory is
3
copied into a line of Cache.
❑ The “tag” field of the line
C-1
identifies which main memory
Main
block each cache line
Memory Block Length
2n - 1 (K Words)
represents
Word Length
Cache
ELEMENTS OF CACHE DESIGN
❑ Size

❑ Mapping function
❑ Replacement algorithm

❑ Write policy

❑ Line size

❑ Number of caches

❑Cache Size
❖Small enough ---not to be costly or expensive
❖Large enough so overall average access time is small
❖Affected by the available chip and board area
ELEMENTS OF CACHE DESIGN...
❑ Mapping Function
 Number of cache lines <<< Number of blocks in main memory
 Mapping function needed
 A method to map main memory blocks into cache lines

❑ Three mapping techniques used


 Direct
 Associative
 Set Associative
❑ Typical memory-cache organization
 Cache of 64kByte
 Organized as 16k lines of 4 bytes

 Cache block of 4 bytes

 16 MBytes main memory


 Byte addressable memory
 24 bit address

 (224=16M)
DIRECT MAPPING
❑ Each block of main memory maps to only one cache line
 i= j modulo m
 i = cache line number,

 j = main memory block number and

 m = number of lines in the cache

 i.e. if a block is in cache, it must be in one specific place


❑ Mapping function implemented using main memory address

❑ Map each block of memory into only one possible cache line.
❖ A block of main memory can only be brought into the same line of cache every time.
Cache Line Main memory blocks assigned
0 0, C, 2C, 3C, …
1 1, C+1, 2C+1, 3C+1, …

… …

C–1 C-1, 2C-1, 3C-1, 4C-1, …


DIRECT MAPPING...
❑ Address viewed as having three fields

▪ Word, line and tag identifier

❑ Least Significant w bits identify unique word in a block

❑ Most Significant s bits specify one of 2s memory block


 The MSBs are split into

 A tag of (s – r) bits (most significant)

 Stored in the cache along with the data words of the line

 A cache line field of r bits

 Identifies one of m = 2r lines of the cache


ELEMENTS OF CACHE DESIGN...
❑ Direct Mapping
❑ Address Structure
Field Purpose Calculation Size
(Bits)
Tag s-r Line or Slot r Word w Offset Identifies a byte log₂(4) 2 bits
8 14 2 within a block
Index/ Identifies the cache log₂(16K) 14 bits
Tag Line or Slot Word Slot line (determines the
line mapping)
 24 bit address
 2 bit word identifier (4 byte block) Tag Identifies which 24 − (14 + 2) 8 bits
block is in the
 22 bit block identifier cache line
 8 bit tag (=22-14)

 14 bit slot or line

 No two blocks in the same line have the same Tag field
READING FROM A DIRECT MAPPED SYSTEM
❑ The processor produces a 24 bit address.

❑ The cache uses the middle 14 bits to identify one of its 16 K lines.

❑ The upper 8 bits of the address are matched to the tag field of the cache entry.
 If they match, then the lowest order two bits of the address are used to access the word
in the cache line.

 If not, address is used to fetch the block containing the specified word from main
memory to the cache.
ELEMENTS OF CACHE DESIGN...
❑ Direct Mapping Cache Organization
ELEMENTS OF CACHE DESIGN...
❑ Direct Mapping Summary

 Address length = (s + w) bits

 Number of addressable units = 2(s+w) words / bytes

 Block size = line size = 2w words or bytes

 Number of blocks in main memory = 2(s+ w)/2w = 2s

 Number of lines in cache = m = 2r

 Size of tag = (s – r) bits


DIRECT MAPPING
❑ Advantages.

 Simple.

 Inexpensive to implement.

❑ Disadvantages.

 There is a fixed location for each block in the cache.

 If a program addresses words from two blocks mapped to the same line, the blocks
have to be swapped in and out of cache repeatedly.
ASSOCIATIVE MAPPING
❑ To improve the hit ratio of the cache, another mapping techniques is often utilized,
“associative mapping”.
❑ A block of main memory may be mapped into ANY line of the cache.
 A block of memory is no longer restricted to a single line of cache.
• A main memory address is considered to be made up of two pieces:
 Tag 22 2
 Upper bits of the address
Tag Word
 Word address within a block
 Lower 2 bits of the address

❑ 16 Mbytes of memory.
❖ 24 bits in address.
❑ 4-byte blocks.
❖ 2 bits.
❑ Rest is used to identify the block mapped to the line.
ASSOCIATIVE MAPPING CACHE ORGANIZATION
❑ The processor produces a 24 bit address.
❑ The upper 22 bits of the address are matched to the tag field of EACH cache entry.

 This matching must be done simultaneously to each of the entries.


 i.e. Associative memory.

Advantages.
❖ Improves hit ratio for certain
situations.
Disadvantages.
❖ Requires very complicated
matching hardware for matching
the tag and the entries for each
line.
❖ Expensive.
SET ASSOCIATIVE MAPPING
❑ Set Associative Mapping helps reduce the complexity of the matching hardware for an
associative mapped cache.
❑ Cache is divided into a number of sets.

 Each set contains a number of lines.


 A 2-way set associative cache has 2 lines per set.

 A block of memory is restricted to a SPECIFIC set of lines.

 A block of main memory may map to ANY line in the given set.
 A main memory address is considered to be made up of two pieces:

 Tag.
 Upper bits of the address.

 Set number.
 Middle bits of the address.

 Word address within a block.


 Lower 2 bits of the address.
SET ASSOCIATIVE MAPPING ADDRESS STRUCTURE
 16 Mbytes of memory.
 24 bits in address.
9 13 2
 4 byte blocks.
Tag Set Word
 Lowest order 2 bits.
 8K sets in a 2-way associative cache.

 13 bits.
❑ Rest is used to identify the block mapped to the line.

❑ The processor produces a 24 bit address.

❑ The cache uses the middle 13 bits to identify one of its 8 K sets.

❑ The upper 9 bits of the address are matched to the tag field of the cache entries that make
up the set.
 The number of lines to match to is very limited.
 Therefore, the matching hardware is much simpler.
SET ASSOCIATIVE MAPPING CACHE ORGANIZATION
SET ASSOCIATIVE MAPPING
❑ Advantages.

 Combines advantages of direct and associative mapping techniques.

❑ Disadvantages.

 Increasing the size of the set does not always improve the hit ratio.

 2-way set associative has a much higher hit ratio than direct mapping.

 Increasing it to 4-way improves the hit ratio slightly more.

 Beyond that no significant improvement has been seen.


REPLACEMENT ALGORITHMS
❑ What happens if there is a “miss” and the cache is already full?
 One of the items in the cache needs to be “replaced” with the new item.
 Which one??
 Depends on the mapping technique used.

❑ Direct mapping.
 No choice.
 Memory blocks map into certain cache lines.
 The entry occupying that line must be swapped out.
❑ Associative & Set Associative:
 Random.
 First-in First-out (FIFO).
 Least Recently Used (LRU).
 Least Frequently Used (LFU).
 The last three require additional bits for each entry to keep track of order, time or number of times used.
 Usually, these algorithms are implemented in hardware for speed.
WRITING INTO CACHE
❑ Cache entries are supposed to be exact “copies” of what is in main memory.
 What happens when the CPU wants to write into memory??

 Which memory does it write too???


❑ Two techniques are possible.
 Write-through.
 Write-back.
WRITING INTO CACHE
❑ Write-Through
 The simplest and most commonly used technique is to update both the cache and main
memory at the same time.
 Advantage.
 Memory and cache are always in sync.

 Disadvantage.
 Memory write becomes slow.

❑ Write-Back
 The update is done ONLY to the word in the cache and the block containing the word is
marked.
 When the block is to be swapped out of cache, the word is written back to main memory.
 Advantage.
 Reduces memory traffic because a word may be updated several times while in cache.

 Disadvantage.
 Cache and memory will be out of sync.
NUMBER OF CACHES
❑ When a cache miss occurs, the system suffers through a large delay while the block is
read from main memory into the cache.

 Two possible solutions.

 Speed up the transfer of information.

 The transfer rate is limited by issues that may not be under our control.

 Speed up the source of the information.

 Main memory is between 7X and 10X slower than cache.

 We can insert an intermediate level of memory between cache and main memory.
CACHE LEVELS
❑ In most of today’s designs, cache sits on the same chip as the CPU. “On-chip cache”
 Data travels a very short distance

 No need to use the very slow bus

 This is known as L1 cache

 Intel calls this level L0

❑ To reduce the penalty of a cache miss, a second level of cache is inserted between main
memory and the on-chip cache.

 L2 cache
CACHE LEVELS
Memory System
Data
On Bus Bus
Off-Chip
CPU Chip
Cache
Main
Bus Cache
Memory
MPU Chip

Pentium Pentium Pro


“L2” CACHE
 A very fast, SRAM based, cache is placed off-chip.
 Slower than the on-chip cache.

 Larger than the on-chip cache.

 On-Module Cache.

 CPU uses a dedicated, internal, fast, memory bus to access cache.

 On-Mother-Board Cache.

 The CPU has to use the system bus to get to it.

 Still much faster than DRAM based main memory.


CACHE STRATEGY
❑ On-Chip Cache is optimized to increase “hit rate”.

 Block size about 4 words

 Many blocks

❑ Off-Chip Cache is optimized to reduce “miss penalty”.

 Larger block size

 Smaller number of blocks.


SECONDARY MEMORY (TYPES OF EXTERNAL MEMORY)
❑Magnetic Disk: A storage device that uses magnetism to record data, typically in hard
drives.
❖RAID (Redundant Array of Independent Disks): A technology that combines multiple disk
drives to improve performance and/or data redundancy.
❖Removable: Storage media that can be easily taken out and replaced, like USB drives or
external hard drives.
❑Optical: Storage media that uses laser light to read and write data.
•CD-ROM: A compact disc used for storing data that can only be read, not written to.
•CD-Recordable (CD-R): A writable compact disc that can only be recorded once.
•CD-R/W: A compact disc that can be both recorded to and erased multiple times.
•DVD: A digital versatile disc used for storing larger amounts of data, including videos and
software.
❑Magnetic Tape: A data storage medium using a magnetic coating to store information on
a tape, typically used for backups.
MAGNETIC DISK
❑ A magnetic disk is a data storage device that uses magnetizable material to store information.
❖ It consists of a disk substrate coated with a thin layer of magnetizable material (such as iron
oxide or a cobalt-based alloy).
❑ Early Substrate Material: Aluminum
• Advantages: Lightweight, relatively durable, and easy to manufacture.
• Limitations: Susceptible to surface defects and mechanical limitations.
❑ Modern Substrate Material: Glass
❖ Advantages of Glass Substrates Over Aluminum:
• Improved Surface Uniformity – Provides a smoother and more even surface for better data
storage precision.
• Increased Reliability – More resistant to wear and mechanical stress.
• Reduction in Surface Defects – Fewer imperfections mean fewer read/write errors.
• Lower Flight Heights – Allows the read/write head to hover closer to the disk surface,
improving data density and accuracy.
• Better Shock and Damage Resistance – Glass substrates are less likely to warp or crack
compared to aluminum.
MAGNETIC DISK
❑ Metal or plastic disk coated, on one or both sides, with magnetizable material

❑ Data read and written through a magnetic head (coil) using induction
READ AND WRITE MECHANISMS
❑ Recording & retrieval via a conductive coil called ahead

❑ May be single read/write head or separate ones

❑ During read/write, the head is stationary, platter rotates

❑ Write Process

 Current through the coil produces a magnetic field

 Pulses sent to head

 Magnetic pattern recorded on the surface below

❑ Read Process (traditional)

 Magnetic field moving relative to coil produces current

 Coil is the same for reading and write


READ AND WRITE MECHANISMS
❑ Read Process (contemporary)

 Separate read head, close to write head

 Partially shielded magneto-resistive (MR) sensor

 Electrical resistance depends on the direction of the magnetic field

 High-frequency operation

 Higher storage density and speed


INDUCTIVE WRITE MR READ
Inductive Write
❖ Write Current → Electric current flows through a coil, creating a magnetic field.
❖ Inductive Write Element → A part of the head that generates the magnetic field to store data.
❖ Magnetization → The magnetic field arranges tiny magnetic particles on the disk in a pattern
(N-S or S-N) to represent data.
❖ Recording Medium → The disk’s surface where data is stored by changing magnetic direction.
MR Read (Magneto-Resistive Read)
❖ MR Sensor → A sensor in the read
head that detects magnetic patterns on
the disk.
❖ Read Current → A small current
flows through the MR sensor, detecting
changes in magnetization to read data.
❖ Shield → A layer that prevents
interference and makes reading more
accurate.
Track Width The width of the data path where information is stored. A
smaller width means more data can fit on the disk.
DATA ORGANIZATION AND FORMATTING
❑Concentric Rings (Tracks) → Data is stored in circular tracks on the disk.
❑Gaps Between Tracks → Space between tracks prevents interference. Smaller gaps
increase storage capacity.
❑Same Number of Bits Per Track → The number of bits remains the same, but the
packing density varies.
❑Constant Angular Velocity (CAV) → The disk spins at a fixed speed, ensuring consistent
data access.
❑Tracks Divided into Sectors → Each track is split into smaller parts called sectors, where
data is stored.
❑Minimum Block Size = One Sector → The smallest unit of data storage is one sector.
❑Multiple Sectors per Block → A block can contain more than one sector to improve
efficiency.
DISK DATA LAYOUT
❑ Platters: Circular disks where data is stored,
usually with two sides (surfaces) for data.
❑ Tracks: Circular paths on the platter where
sectors are arranged in concentric rings.
❑ Inter-track gap: The space between adjacent
tracks on the platter to ensure proper alignment
and separation.
❑ Sectors: Divisions of a track where data is
stored, typically holding a fixed amount of data.
❑ Inter-sector gap: The space between two
sectors on the same track to separate them for
reading and writing.
DATA ORGANIZATION AND FORMATTING
❑ Concentric rings or tracks: Data is organized into circular tracks on the disk surface.
 Gaps between tracks
 Reduce the gap to increase capacity
 Same number of bits per track (variable density)
 Constant angular velocity
❑ Tracks divided into sectors: Each track is divided into smaller units called sectors, which
hold data.
❑ Data read/written in blocks: Data is read from or written to the disk in blocks, which
consist of one or more sectors.
❖ Minimum block size is one sector: The smallest readable or writable block is one
sector.
❖ May have more than one sector per block: Blocks can consist of multiple sectors for
more efficient data handling.
DISK VELOCITY
❑ A bit near the center of a rotating disk passes a fixed point more slowly than a bit on the
outer edge.
❑ Increase the spacing between bits on different tracks to maintain uniform data access.
❑ Rotate the disk at a constant angular velocity (CAV) to ensure a consistent data
scanning rate.
— Gives pie-shaped sectors and concentric tracks
— Individual tracks and sectors addressable
— Move head to the given track and wait for a given sector
— Waste of space on outer tracks
– Lower data density
❑ Can use zones to increase capacity
— Each zone has fixed bits per track
— More complex circuitry
COMPARISON OF VARIABLE/FIXED DENSITY

❑ Constant Angular Velocity (CAV): The disk spins at a constant speed, but the data
transfer rate varies across tracks.
❑ Constant Linear Velocity (CLV): The disk adjusts its speed to keep the data transfer
rate the same across all tracks.
CHARACTERISTICS OF MAGNETIC DISKS
❖ Single or Double-Sided: Data can be stored on one or both sides of the disk.

❖ Removable or Fixed: The disk can be taken out or permanently installed in the device.

❖ Fixed or Movable Head: The head is either stationary or moves to read/write data.

❖ Single or Multiple Platters: The disk has one or more stacked platters for storing data.

❖ Head Mechanism: The part that moves the read/write head to the correct location on the
disk.

❖ Speed: How fast the disk spins, how quickly the head finds data, and how fast data is
transferred.
FIXED/MOVABLE HEAD DISK
❑ Fixed head
 One read/write head per track
 Heads mounted on a fixed arm

❑ Movable head
 One read/write head per side
 Mounted on a movable arm
FIXED/MOVABLE HEAD DISK
REMOVABLE OR NOT
❑ Removable disk

 Can be removed from the drive and replaced with another disk

 Provides unlimited storage capacity (by changing disk)

 Easy data transfer between systems

❑ Nonremovable disk

 Permanently mounted in the drive


MULTIPLE PLATTERS
❑ One head per side

❑ Heads are joined and aligned

❑ Aligned tracks on each platter from cylinders

❑ Data is striped by cylinder


 Reduces head movement

 Increases speed (transfer rate)


HEAD MECHANISM
❑Contact: A type of head mechanism where the head physically touches the disk surface to
read/write data.
❖ Floppy: A flexible disk storage device that was commonly used for storing data, now
largely obsolete.
❑Fixed gap: A head mechanism with a constant distance between the head and the disk
surface during operation.
❑Aerodynamic gap or flying head: A head mechanism where the head floats above the
disk surface, using air pressure to maintain a small gap.
❖ Winchester: A type of hard drive with a sealed casing and a head that flies over the
disk surface, commonly used in personal computers.
FLOPPY DISK
• 8”, 5.25”, 3.5”
• Small capacity
—Up to 1.44Mbyte (2.88M never popular)
• Slow
• Universal
• Cheap
• Obsolete?
WINCHESTER HARD DISK (1)
❑Developed by IBM → Created in Winchester, USA.
❑Sealed Unit → Fully enclosed to protect against dust
and damage.
❑Multiple Platters → Contains one or more spinning
disks for data storage.
❑Floating Read/Write Heads → Heads hover above
the disk on a thin layer of air as it spins.
❑Small Head-to-Disk Gap → Allows precise reading
and writing of data.
❑Improved Durability → Becoming more robust over
time.
WINCHESTER HARD DISK (2)
❑Widely Used → Universal storage solution.
❑Affordable → Cost-effective compared to other storage options.
❑Fastest External Storage → Provides high-speed data access.
❑Increasing Capacity → Storage sizes continue to grow, with multiple gigabytes now
common.
❑Sealed Unit → Fully enclosed for protection.
❑Multiple Platters → Contains one or more spinning disks.
❑Floating Heads → Read/write heads hover on a thin air layer as the disk spins.
❑Tiny Head-to-Disk Gap → Ensures precise reading and writing.
❑More Durable → Continually improving in reliability and robustness.
SPEED
❑Seek Time → Time taken for the read/write head to move to the correct track.
❑Rotational Latency → Waiting time for the desired data to rotate under the read/write
head.
❑Access Time → Total delay before data transfer begins (Seek Time + Latency).
❑Transfer Rate → Speed at which data is copied from the disk to the computer.

Total time
RAID (REDUNDANT ARRAY OF INDEPENDENT DISKS)
• RAID originally redundant array of inexpensive disks) is a way of storing the same
data in different places on multiple hard disks to protect data in the case of a drive
failure.

• 7 levels in common use


• Not a hierarchy
• Share three common characteristics:
 Set of physical disks viewed as single logical drive by O/S

 Data distributed across physical drives

 Can use redundant capacity to store parity information


RAID LEVELS
MAGNETIC TAPE
❑ Magnetic Tape Storage
• Sequential Access → Unlike hard drives, data can only be read or written in order,
making access slower.
• Slower Than Disks → Both magnetic and optical disks are much faster than tape
storage.
• Extremely Cheap → One of the most cost-effective storage solutions for large
amounts of data.
• Best for Backup & Archiving → Used for storing old or rarely accessed data safely.
❑ Linear Tape-Open (LTO) Tape Drives
• Developed in the Late 1990s → Created as an open-source alternative to proprietary
tape storage systems.
• High-Capacity & Reliable → Can store large amounts of data securely over a long
period.
OPTICAL STORAGE: CD-ROM
❑Originally for Audio → Designed to store music before being adapted for data storage.
❑Capacity → Holds 650 MB, which is about 70+ minutes of audio.
❑Material → Made of polycarbonate with a reflective aluminum coating.
❑Data Storage → Information is stored as pits on the surface.
❑Reading Mechanism → A laser beam reads data by reflecting off the pits.
❑Constant Linear Velocity (CLV) → The disc rotates at varying speeds to keep the data
reading speed constant.
❑Track Length → The spiral track on a CD is 5.27 km long, allowing for 73.2 minutes of
playback.
CD OPERATION
OPTICAL DISK PRODUCTS
❖ CD (Compact Disk) → A non-erasable disk used for storing digitized audio. The
standard 12 cm disk can hold over 60 minutes of audio.
❖ CD-ROM → A non-erasable disk for computer data storage, holding more than 650 MB.
❖ CD-R (CD-Recordable) → A write-once disk, similar to a CD-ROM, but allows users to
store data permanently.
❖ CD-RW (CD-Rewritable) → A rewritable disk, allowing users to erase and write new
data multiple times.
❖ DVD (Digital Versatile Disk)-ROM → A read-only disk storing compressed video and
large digital data. Available in 8 cm and 12 cm sizes, with a double-sided capacity of up
to 17 GB.
❖ DVD-R (DVD Recordable) → A write-once DVD. Only one-sided disks can be used.
❖ DVD-RW (DVD Rewritable) → A rewritable DVD that allows multiple erasures and
rewrites. Only one-sided disks can be used.
❖ Blu-ray DVD
• A high-definition video disk with much higher storage than DVDs.
• Uses a 405-nm (blue-violet) laser for greater data density.
• A single layer on one side can store 25 GB of data.
CD-ROM FOR & AGAINST
❑ Pros:

• Large capacity → Can store over 650 MB of data.

• Easy to mass produce → Cost-effective for large-scale distribution.

• Removable → Convenient for transport and storage.

• Robust → More durable than floppy disks or magnetic tapes.

❑ Cons:

• Expensive for small runs → High cost if producing only a few copies.

• Slower than magnetic disks → Longer access time compared to hard drives.

• Read-only → Cannot be modified or rewritten once recorded.


OTHER OPTICAL STORAGE
CD-R (Compact Disc - Recordable)
• Writable → Users can write data once.
• WORM (Write Once, Read Many) → Data cannot be erased or modified.
• Affordable → Now a low-cost option for data storage.
• Compatible with CD-ROM drives → Can be read by most standard CD-ROM players.
CD-RW (Compact Disc - Rewritable)
• Erasable & Rewritable → Can be written and erased up to 1,000 times.
• Uses phase-change technology → Unlike CD-R, it doesn’t use pits.
• Getting cheaper → More affordable over time.
• Compatibility issues → Not all CD-ROM drives can read CD-RWs.
DVD - DIGITAL VIDEO/VERSATILE DISK
❑ The name "DVD" can have a few different interpretations, but here's a simplified
breakdown:
1. Digital Video Disk – This is the traditional name, referring to the format mainly used for
movies. It plays video files, hence the "Video" part of the name.
2. Digital Versatile Disk – This is a broader term that emphasizes the versatility of DVDs, not
just limited to video but also capable of storing data and being used in computers. It can read
both video and computer data, making it more versatile than just a video player.
3. Dogs Veritable Dinner – While this might be a humorous play on words, it’s not an official
term! It’s just for fun.
❑ Key Features of DVD:
• High Capacity: DVDs can hold about 4.7 GB per layer, which is a lot more than a regular CD.
• Double-Sided: Some DVDs have 2 sides, and each can have up to 2 layers, totaling around 17
GB.
• CD Compatibility: DVD drives can read regular CDs too.
• Writable Options: DVDs can also be written to (DVD-R, DVD-RW), though this technology
isn't completely standardized yet.
DVD - TECHNOLOGY
• Multi-layer

• Very high capacity (4.7G per layer)

• Full-length movie on a single disk

— Using MPEG compression

• Finally standardized (honest!)

• Movies carry regional coding

• Players only play correct region films

• Can be “fixed”
DVD – WRITABLE
• Loads of trouble with standards

• First-generation DVD drives may not read first-generation DVD-W disks

• First-generation DVD drives may not read CD-RW disks

• Wait for it to settle down before buying!


THANK YOU

You might also like