CS222: Hierarchy (Memory, Paging)

Preview:

Citation preview

CS222: Memory Hierarchy (Memory, Disk, Paging)

Dr.  A. Sahu

Dept of Comp. Sc. & Engg.Dept of Comp. Sc. & Engg.

Indian Institute of Technology Guwahati

Outline• Previous: Cache Pre‐fecthing

d / f f h–Hardware/Software Prefecth• Take home exam

– Advance Memory Addressing Scheme (TLB, Paging, Segmentation, Virtual Addressing) 

• Memory• Memory• Disk

/• Paging/Segmentation• Take home exam

Take Home Exam 2Take Home Exam 2

• Submission time 18 Apr 2011 Tuesday 11AM‐p y12AM, if u submit after Tuesday credit will be zero)

• Submit a concise 10 12 pages handwritten report• Submit a concise 10‐12 pages handwritten report on 

• Memory Addressing Schemes, Paging andMemory Addressing Schemes, Paging and Segmentation Virtual Addressing , TLB and TLB Caching Y f / d b k b i l b• You can refer/read any book or web material but put proper references (for copied diagram and copied paragraph) in your report. p p g p ) y p

SW Prefetch ExampleSW Prefetch Example• 8 KB direct mapped, write back data cache with 16 byte blocks16 byte blocks. 

• a is 3 × 100, b is 101 × 3

for (i = 0; i < 3; i++)for (j = 0; j < 100; j++)

[i][j] b[j][0] * b[j+1][0]a[i][j] = b[j][0] * b[j+1][0];

each array element is 8 byteseach array element is 8 bytesmisses in array a = 3 * 100 /2 = 150misses in array b = 101total misses = 251

SW Prefetch Example – contd.SW Prefetch Example  contd.Suppose we need to prefetch  7 iterations in advanceSuppose we need to prefetch  7 iterations in advancefor (j = 0; j < 100; j++){

prefetch(b[j+7]][0]);prefetch(b[j+7]][0]);prefetch(a[0][j+7]);prefetch(a[0][j+7]);a[0][j] = b[j][0] * b[j+1][0];

}for (i = 1; i < 3; i++)

for (j = 0; j < 100; j++){prefetch(a[i][j+7]);prefetch(a[i][j+7]);a[i][j] = b[j][0] * b[j+1][0];

}}

misses in first loop = 7 (for b[0..6][0]) + 4 (for a[0][0..6] )misses in second loop = 4 (for a[1][0..6]) + 4 (for a[2][0..6] )sses seco d oop ( o a[ ][0 6]) ( o a[ ][0 6] )total misses = 19, total prefetches = 400

Primary Memory/Primary Memory/Physical Memory/Physical Memory/ DRAM/DDR/SDRAMDRAM/DDR/SDRAM

RequirementsRequirements

• CPU – Main Memory : Word transfersCPU  Main Memory : Word transfers

• Cache – Main Memory : block/line transfers (words also in WT)(words also in WT) 

• I/O – Main Memory : large block transfers

• Use of write buffers

• Out of order execution

How to speed up transfer?How to speed‐up transfer?

Use Wider BusUse Wider Bus

Wide bus between cache and main memory –Wide bus between cache and main memory Multiple words transferred in parallel

MCPU Cache Memory

Use Faster BusUse Faster Bus

• Improve the throughput not necessarily theImprove the throughput, not necessarily the latency

latencylatency

firstword subsequent

dwords

Interleaved MemoryInterleaved Memory

Memory

Memory

CPU Cache

Memory

Memory0 1 2 3

bank 0 bank 1 bank 2 bank 3

4812

5913

61014

71115

Interleaved Memory Performance

Given :Given :L = line sizem = number of interleaved modulesm = number of interleaved modulesTa= memory access timeT l tiTc = memory cycle timeTbus = bus cycle timeFind :Tline = line access time

Case I

mL≤Ta Tbus Tbus Tbus

firstword subsequent

bli TLTT ⋅−+= )1(

word qL ‐1 words

busaline TLTT + )1(

Case II

busc TmTandmL ⋅≤>

Ta m . Tbus m . Tbus

Tc

fi d d

busaline TLTT ⋅−+= )1(first m words next m words

busaline )(

Case IIICase III

busc TmTandmL ⋅>>

Ta Tc TbusTc Tc

)mod)1((1 mLTmLTTT buscaline −⋅+⎟⎟

⎞⎜⎜⎝

⎛−⎥⎥

⎤⎢⎢⎡⋅+=m ⎠⎝ ⎥⎢

Semiconductor Memory Technology

• Fast memory for cache ‐ Static RAM (SRAM)Fast memory for cache  Static RAM (SRAM)

• High density main memory ‐ Dynamic RAM (DRAM)(DRAM)

• Non volatile memories for embedded systems ROM PROM EPROM Fl h‐ ROM, PROM, EPROM, Flash

DRAM StructureDRAM Structure

Column address

CAS

Column decoder

Column address

Address pins

2n/2

Storage Row address2n 2n/2

2n/2Row

dec

cells

RAS

oder

Sense amps

Din

Dout

WE

Enhancing DRAM Performance

• Multiple arrays of cellsMultiple arrays of cells

• Access multiple bits in a row (sequentially | randomly)randomly)

• Synchronous interface rather than h i fasynchronous interface

• Transfer data on both edges of clock

DRAM TechnologiesDRAM Technologies

Fast Page Mode (FPM) DRAMFast Page Mode (FPM) DRAMExtended Data Out (EDO) DRAMBurst Extended Data Out (BEDO) DRAMBurst Extended Data Out (BEDO) DRAMSynchronous DRAM (SDRAM)Synchronous‐Link DRAM (SLDRAM)Double Data Rate SDRAM (DDR SDRAM)Direct Rambus DRAM (DRDRAM)Video RAM (VRAM) – dual portedVideo RAM (VRAM)  dual ported

Fast Page Mode (FPM) DRAMFast Page Mode (FPM) DRAM

• Row address selects a page (row)Row address selects a page (row)

• Bits in a page selected by column addresses

Secondary Memory Hard Disk, CD, DVD

Secondary Memory d kHard Disk, CD, DVD

• Hard Disk• Hard Disk

• Flash Memory, Solid State Disk

• CD ROM

• DVD ROM• DVD ROM

• DVD  R/W

• Tape

Hard Disk Drive (HDD) ComponentsHard Disk Drive (HDD) Components

• ElectromechanicalElectromechanical– Rotating disks

– Arm assembly

• Electronics– Disk controller

– Cache

– Interface controller

Recommended