Memory Hierarchy Flashcards
What are the characteristics of Memory?
- Location
- Capacity
- Unit of transfer
- Access method
- Performance
- Organisation
What is Capacity normally expressed as?
Bytes
What are three ways of expressing memory performance?
- Access Time
- Memory Cycle time
- Transfer Rate
What is Access Time?
Time between presenting the address and getting the valid data (Stated as N clock) typically nanoseconds
What is Memory Cycle time
Time may be required for the memory to recover before next access
What is Transfer Rate?
Rate at which data can be moved - typically gigabytes
What are the characteristics of physical memory?
- Decay
- Volatility
- Erasable
- Power consumption
What type of physical memory use semiconductors?
- SRAM
- DRAM
- Flash
How did Core memory work?
- Magnetic ring for each bit
- Used high currents
- 1-6 µs cycle time
How does storage hierarchy looklike?
- Registers
- L1 Cache
- L2 Cache
- Main Memory
- Disk cache
- Disk, Flash/SSD
- Optical
- Tape
What is DRAM and how does it work?
Dynamic RAM
- Bits stored as charge in capacitors
- Charges leak so need refreshing even when powered
- Simpler construction
- Smaller per bit
- Less expensive
- Slower (6-60ns)
- Used in main RAM
- “switch” connects it to the read or write circuit
How does DRAM refresh work?
- Each bit discharges over time and is boosted back by the refresh
- This is a disadvantage of DRAM - but density is very high
What are the specs and characteristics of DDR5?
- Approx. 2 x DDR4
- Faster clocks (up to 4Ghz) -> more bandwidth
- Two independent 32 bit channels
- Some error correction built-in
- Lower voltage (1.1V) -> 20% lower power use
- Can burst read 64 bytes
- Capacity up to 96GB DIMM
What is SRAM and its characteristics?
Static RAM
- Bits sorted as on/off gates (using 4-6 transistors)
- No charges to leak, no refreshing needed when powered
- More complex construction - Larger per bit
- More expensive per MiB (100x)
- Faster (0.5 to 10ns)
- Good for Cache and embedded RAM
- Only used as main RAM on microcontrollers
What is ROM?
Read Only Memory
- Permanent storage (Non-volatile)
- Hardware support library subroutines
- Systems programs (BIOS)
What do CPUs use for DIMMs?
Two 64 bit channels
How can increasing DDR4 DIMMs help?
4 can increase bandwidth and decrease latency to/form cache as accesses can be interleaved
What type of errors can occur in memory?
- DRAM can loose data (e.g. 25k failures per Mbit per billion hours)
- Hard Failure (Permanent defect - most common)
- Soft Error (Random, non-destructive as there is no permanent damage to memory)
What are Caches?
- Caches are small blocks of fast SRAM located on CPU chip
- The CPU needs data faster than DRAM can provide so Memory requests go there, not DRAM
How does a cache operation work?
- CPU reads a memory location
- address goes to cache
- If present, cache provides data (cache hit)
- If not present, block read required from main RAM to cache (cache miss)
- Then deliver data request by CPU
What are the Cache Design parameters?
- Size
- Mapping function needed
- Replacement Algorithm
- Write Policy
- Block Size
- Number of Caches
Why is it preferable to use smaller L1 cache than a bigger L2 cache?
Big caches have longer latency
What is latency?
The time it takes for data to travel from one place to another
How does RAM get shielded from the cores with cache?
Multiple cores usually share a large level 3 cache to shield RAM from the cores
Why is the Cache Mapping Function used?
- Needed because cache is smaller than main RAM
- Blocks of cache are allocated to certain addresses
- Simplest method -direct mapped
- Most caches now associative
How are Cache misses avoided?
- Try to access consecutive bytes in a cache line
- Align data to the cache line boundaries
How does Magnetic disks work?
- One head per side
- Heads are joined and aligned
- Aligned tracks on each platter from cylinders
- Data is striped by cylinder (reduces head movement and increases speed)
- Best value online storage
How is Data organised and formatted on a Magnetic disk?
- Concentric rings or tracks
Gaps between tracks
Reduce gap to increase capacity
Same bits per track - Minimum block size is one sector
- Tracks divided into sectors of 512B or 4KiB
What determines HDD speed?
- Seek time (Moving head to correct track)
- Rotational latency (Waiting for data to rotate under head)
- Access time = Seek + Latency
- Transfer rate
What is on-disk cache?
- Used to store whole tracks and cache r/w
- Acts as a buffer between disk
What is the Mean time between failures for hard disks?
114 years
What are the characteristics of SSDs?
- Non volatile NAND logic (Fast) or flash based
- Fast access times
- Near zero latency
- Sequential read speed 500-7000 MiBs
- Max about 18TiB at the moment
- More shock resistant, silent
- Lower power
- Expensive per Gbyte compared to HD
What are SSD characteristics?
- Can only write approx millions of times
- They need up to date firmware and drivers
- A very full SSD can wear-out the remaining space faster
What is wear levelling?
Spreads the writes around so no one area is worn out
How fast is SATA?
600 MiB/s
What is the best SSD interface?
PCIe as it supports very long command queues
What is the specs of Blu-ray?
- Use 406nvm laser
- 15-30GiB
- Useful for offline storage/transfer
- Can read at 70MiB/s
What are optical Jukeboxes?
- 100s TB per box (typically Blu-ray)
- 6s disk change
- 500 slots, 10 drivers
What is the specs of magnetic tape?
- Large 12TB to 36TB
- Serial access but good for backups
- Speed often quoted in GB/hour
- Cheap per TByte
What is iSCSI?
Internet Small Computer System Interface
- Uses tcp/ip over normal ethernet
- typically uses isolated network
- can use an offload processor card to save cpu time
- allows remote and very flexible storage arrays
What is RAID 0 and how does it work?
Redundant array of independent disks
- No redundancy
- Data striped across all disks
- Increase speed
- Size is N * DiskSize
How does RAID 1 work?
- Mirrored Disks
- Data is striped across disks
- 2 copies of each stripe on separate disks
- Read from either
- Write to both - Size is size of one disk
- Recovery is simple (swap fault disk and re-mirror with no down time)
- Expensive
How does RAID 5 work?
- Parity striped across all disks
- Round robin allocation for parity stripe
- Size is (N-1)*SizeofDisk
How does RAID 6 work?
Can tolerate two disk failures therefore much more reliable
Size is (N-2)*SizeofDisk
How does rebuilding work with RAID?
- When a drive fails, the system has to rebuild
- It can take a long time but the system can still perform okay
- Hot swap drives means no downtime
- A “hot spare” drive is always in system for automatic rebuilds