23
CS222: Memory Hierarchy (Memory, Disk, Paging) Dr. A. Sahu Dept of Comp. Sc. & Engg. Dept of Comp. Sc. & Engg. Indian Institute of Technology Guwahati

CS222: Hierarchy (Memory, Paging)

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CS222: Hierarchy (Memory, Paging)

CS222: Memory Hierarchy (Memory, Disk, Paging)

Dr.  A. Sahu

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

Indian Institute of Technology Guwahati

Page 2: CS222: Hierarchy (Memory, Paging)

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

Page 3: CS222: Hierarchy (Memory, Paging)

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

Page 4: CS222: Hierarchy (Memory, Paging)

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

Page 5: CS222: Hierarchy (Memory, Paging)

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

Page 6: CS222: Hierarchy (Memory, Paging)

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

Page 7: CS222: Hierarchy (Memory, Paging)

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?

Page 8: CS222: Hierarchy (Memory, Paging)

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

Page 9: CS222: Hierarchy (Memory, Paging)

Use Faster BusUse Faster Bus

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

latencylatency

firstword subsequent

dwords

Page 10: CS222: Hierarchy (Memory, Paging)

Interleaved MemoryInterleaved Memory

Memory

Memory

CPU Cache

Memory

Memory0 1 2 3

bank 0 bank 1 bank 2 bank 3

4812

5913

61014

71115

Page 11: CS222: Hierarchy (Memory, Paging)

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

Page 12: CS222: Hierarchy (Memory, Paging)

Case I

mL≤Ta Tbus Tbus Tbus

firstword subsequent

bli TLTT ⋅−+= )1(

word qL ‐1 words

busaline TLTT + )1(

Page 13: CS222: Hierarchy (Memory, Paging)

Case II

busc TmTandmL ⋅≤>

Ta m . Tbus m . Tbus

Tc

fi d d

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

busaline )(

Page 14: CS222: Hierarchy (Memory, Paging)

Case IIICase III

busc TmTandmL ⋅>>

Ta Tc TbusTc Tc

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

⎞⎜⎜⎝

⎛−⎥⎥

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

Page 15: CS222: Hierarchy (Memory, Paging)

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

Page 16: CS222: Hierarchy (Memory, Paging)

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

Page 17: CS222: Hierarchy (Memory, Paging)

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

Page 18: CS222: Hierarchy (Memory, Paging)

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

Page 19: CS222: Hierarchy (Memory, Paging)

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

Page 20: CS222: Hierarchy (Memory, Paging)

Secondary Memory Hard Disk, CD, DVD

Page 21: CS222: Hierarchy (Memory, Paging)

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

Page 22: CS222: Hierarchy (Memory, Paging)

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

• ElectromechanicalElectromechanical– Rotating disks

– Arm assembly

• Electronics– Disk controller

– Cache

– Interface controller

Page 23: CS222: Hierarchy (Memory, Paging)