Memory Hierarchy
1
krraju.in
What you’ll learn
2
Memory and I/O Organization Memory Hierarchy, Associative Memory, Cache Memory, Virtual memory.
I/O Organization: Peripheral devices, I/O interface, Asynchronous data transfer, Modes of transfer, Priority interrupt, direct memory access and IOP
Unit-4
krraju.in
3
Terminology
krraju.in
4
Memory Characteristics
Ideal memory system characteristics:
Size: Infinitely large, no constraints on program or data set size.
Speed: Infinitely fast, latency equal to the fastest memory technology available.
Cost: The per bit cost should approach the lowest cost technology available.
Volatility and Portability
krraju.in
5
Design Objective
krraju.in
6
How to meet the design objective?
Four interrelated ways to meet this goal
krraju.in
7
Overview
Historically, the limiting factor in computer’s performance has been memory access time.
Goal: To develop an effective memory organization that supports the processing power of the CPU.
CPU
I/O
Memory
krraju.in
8
Primary Memory
The part of the memory hierarchy that the CPU accesses directly; excluded are the peripheral storage devices.
Main memory is a program addressable storage from which instructions and other data can be loaded directly into registers for subsequent execution or processing.
krraju.in
9
Memory Cell
krraju.in
10
Memory Organisation
krraju.in
11
Core Memory
krraju.in
12
Semiconductor Memory
krraju.in
13
ROM (Read Only Memory)
A Semiconductor memory whose contents cannot be altered. (Non-erasable memory).
krraju.in
14
DRAM (Dynamic RAM)
krraju.in
15
DRAM chips
krraju.in
16
SRAM (Static RAM)
Buffer: A high speed memory interposed between two devices to match the speed of one device with the other.
krraju.in
17
Auxiliary Memory
Auxiliary memory: Devices that provide backup storage. e.g.: magnetic disks, tapes etc.
Secondary memory: Memory located outside the computer system itself, including disk and tape.
Magnetic disk: A flat circular plate with a magnetizable surface layer on which data can be stored by magnetic recording.
krraju.in
18
Magnetic Tape
A tape with a magnetizable surface on which data can be stored by magnetic recording.
Advantages: Lowest cost per unit stored.
Disadvantages: Sequential access means slow retrieval speeds.
Applications: Corporate data archiving.
krraju.in
19
Floppy (Flexible) Disks
krraju.in
20
Micro floppy disks
Single density, double density and high density and sizes like 8 inches, 5¼ inches (mini floppy) and 3½ inches (micro floppy) are available.
Advantages: Low cost per diskette and portability.
Disadvantages: Low capacity, very high cost per unit stored, large access times and fragile.
Applications: Personal computers.
krraju.in
21
Floppy Disk
Capacity
Disk | 8 inch | 5.25 inch | 3. 5 inch | ||
Density | Double | Double | High | Low | High |
Capacity | ~1 MB | 360 KB | 1.2 MB | 720 KB | 1.44 MB |
Surfaces | 2 | 2 | 2 | 2 | 2 |
Tracks/ surface | 77 | 40 | 80 | 80 | 80 |
Sectors/ track | 26 | 9 | 15 | 9 | 18 |
Bytes/sector | 256 (0.25K) | 512(0.5K) | 512(0.5K) | 512(0.5K) | 512(0.5K) |
Disk capacity can be calculated as:
Disk capacity = (number of surfaces) x (tracks per surface) x (sectors per track) x (bytes per sector)
(2 sides x 40 tracks x 9 sectors x 0.5K bytes=360 KB
(2 sides x 80 tracks x 15 sectors x 0.5K bytes)=1200 KB=1.2 MB
krraju.in
22
Soft and Hard Sectoring
Soft sectored: A flexible disk is soft sectored when it has only one index hole. Each track is divided into sectors by electronic timing after sensing the index hole on each revolution. The number of sectors depends upon the format required for each soft sectored flexible disk.
Hard sectored: A flexible disk that is hard sectored has the index holes punched right into the disk. The number of holes depends on the size of the flexible disk. These holes divide up each track into sectors by a light beam physically sensing each hole.
krraju.in
23
Hard Drive
krraju.in
24
Disk
Seek time: Time taken to move the read/write head to a required track.
Latency time: Time taken to rotate the disk in such a way that the read/write head is positioned on a particular sector.
Drive access time = track seek time + latency + transfer time
krraju.in
25
An Example
A disk has 128 sectors per track with 512 bytes per sector. The rotation rate is 5200 RPM. What is the transfer rate in bytes/second?
Solution:
The rotation time is 60/5200 = 11.5 ms.
The transfer rate is
(128 x 512/(11.5 x 10-3 ))= 5.7M bytes/s.
krraju.in
26
Winchester Disk
The disks and the Read/Write heads are placed in a sealed, air filtered enclosure. They have larger capacity for a given physical size compared to unsealed units.
Advantages:
Disadvantages: Fragile; high cost per unit stored.
Applications: Personal computers through mainframes.
krraju.in
27
Magnetic Disks
Model | Seagate Barracuda 180 | Hitachi DK23DA | IBM Microdrive |
Application domain | Server | Laptop | Pocket device |
Capacity | 180 GB | 40 GB | 1 GB |
Platters / Surfaces | 12 / 24 | 2 / 4 | 1 / 2 |
Cylinders | 24 247 | 33 067 | 7 167 |
Sectors per track, avg | 604 | 591 | 140 |
Buffer size | 16 MB | 2 MB | 1/8 MB |
Seek time, min,avg,max | 1, 8, 17 ms | 3, 13, 25 ms | 1, 12, 19 ms |
Diameter | 3.5² | 2.5² | 1.0² |
Rotation speed, rpm | 7200 | 4200 | 3600 |
krraju.in
28
Hard disk technologies
Magneto resistive technology: In this technology, the hard drive heads change resistance in the presence of a magnetic field and allow a smaller flying height and areal densities of 1 GB/sq. inch being achieved.
Near field recording technology: It uses a solid immersion lens in the read/write head. This allows a laser beam to be focused on a very small spot thereby increasing the densities.
krraju.in
29
Bubble Memory
Stores binary data in the form of little magnetic bubbles. It is similar to RAM, except it is nonvolatile by design.
Advantages:
Disadvantages:
krraju.in
30
Magneto-optical (MO) drive
An erasable, high capacity removable storage device similar to a CD-ROM drive. They use both magnetic and laser technology to write data to the disk, and use the laser to read that data back again. Writing data takes two passes over the disk, an erase pass followed by the write pass, but reading can be done in just one pass and so is much faster.
Advantages: Portability, high storage capacity and random access.
Disadvantages: Costlier than magnetic storage devices.
Applications: Personal computers.
krraju.in
31
RIAD (Redundant Array of Independent Disks)
Uses a large number of small hard drives to distribute data across all of the disk drives. Data is distributed across this set of drives in a defined manner. Data is duplicated or it can be reconstructed in the event of a disk failure.
Advantages: High capacity; designed for risk of data loss; low cost to minimize per unit stored.
Disadvantages: Semi-permanent installation.
Applications: Corporate data storage that requires frequent, rapid access.
krraju.in
32
Optical Storage
CD-ROM (Compact Disk Read Only Memory) is a non-erasable disk used for storing data. It uses 12 cm disks and can hold more than 650 M bytes (about 72 minutes of video).
Advantages: High capacity; moderate cost per unit stored; high durability and portability.
Disadvantages: Slower retrieval speeds than hard drives; only certain types can be rewritten.
Applications: Personal computers to corporate data storage:
krraju.in
33
CD-ROM working
krraju.in
34
DVD (Digital Versatile Disk)
Uses two layers on each side of a disk to store data. DVDs use the same general design as CDs, but the difference is
krraju.in
35
Erasable optical disk
An optical disk, that can be repeatedly written and overwritten, as with any magnetic disk.
Advantages:
Disadvantages:
Applications:
krraju.in
36
Flash Memory
Non-volatile EEPROM that can be electrically erased or written.
krraju.in
37
Flash Memory contd..
Advantages:
Disadvantages: High cost and limited capacity.
Applications:
krraju.in
Memory Access
38
krraju.in
39
Memory Access
krraju.in
40
Memories and their Access Times
Memory type | Technology | Size | Access time |
Cache | Semiconductor RAM | 128-512 KB | 10 ns |
Main memory | Semiconductor RAM | 4-128 MB | 50 ns |
Magnetic disk | Hard disk | Gigabyte | 10ms, 10 MB/sec |
Optical disk | CD-ROM | Gigabyte | 300 ms, 600 KB/sec |
Magnetic tape | TAPE | 100s MB | Sec-min, 10 MB/min |
krraju.in
41
Random Access
krraju.in
42
Sequential Access
krraju.in
43
Direct Access
krraju.in
44
Associative Access
Argument Register
Key Register
M
Output
Match Register
Read
Write
m x n
Associative Memory
Array and Logic
Input
krraju.in
45
Content Addressable Memory
krraju.in
46
Basis for the Memory Hierarchy
Moving information into the fast memory infrequently and accessing it many times before replacing with new information
krraju.in
47
Memory Parameters
| Access type | Capacity | Latency | Bandwidth | Cost/MB |
CPU registers | Random | 64-1K bytes | 1-10 ns | System clock rate | High |
Cache memory | Random | 8-512 KB | 15-20 ns | 10-20 MB/s | High |
Main memory | Random | 16-512 MB | 30-50 ns | 1-2 MB/s | |
Disk memory | Direct | 1-20 GB | 10-30 ms | 1-2 MB/s | Low |
Tape memory | Sequential | 1-20 TB | 30-10,000 ms | 1-2 MB/s | Very low |
krraju.in
48
Memory Hierarchy Characteristics
CPU
Registers
Main Memory
Fast
Small
High cost
Hierarchical memory
Cache
Disk
Slow
Very Large
Very low cost
krraju.in
49
Goal
Try to match the processor speed with the rate of information transfer from the lowest element in the hierarchy.
krraju.in
50
Memory Hierarchy Advantages
krraju.in
51
Locality of Reference
The memory hierarchy works because of locality of reference
krraju.in
52
Instructions and data recently referenced by a program are likely to be used again soon.
Temporal Locality (Locality in Time)
krraju.in
53
Portions of address space near the current locus of reference are likely to be referenced in the near feature.
Spatial Locality (Locality in Space)
krraju.in
54
Reducing Memory Latency
krraju.in
55
Placement of Cache Memory
CPU
3.8 GHz
Main Memory
533 MHz
Bus 800 MHz
Without Cache
CPU
Main Memory
533 MHz
Bus 800 MHz
With Cache
Cache
3.8 GHz
Front-side Bus
Back-side Bus
krraju.in
56
CPU
Registers
Main Memory
Auxiliary memory
Memory Hierarchy in a Computer System
Cache Memory
Magnetic Tapes
Magnetic Disks
I/O Processor
krraju.in
57
Cache and auxiliary memories are used for different purposes.
Hierarchical Memory System
krraju.in
58
Desktop, Drawer, and File Cabinet Analogy
Items on a desktop (register) or in a drawer (cache) are more readily accessible than those in a file cabinet (main memory).
krraju.in
59
Hit Ratio
No. of times referenced words are in cache
Hit Ratio
Total number of memory accesses
CPU
Cache
Main Memory
krraju.in
60
Assume a hit rate h in the drawer.
Drawer and File Cabinet Analogy
krraju.in
Recap
61
krraju.in