Main Memory Main memory generally utilizes Dynamic RAM
- Slides: 43
Main Memory • Main memory generally utilizes Dynamic RAM (DRAM), which use a single transistor to store a bit, but require a periodic data refresh by reading every row. • Static RAM may be used for main memory if the added expense, low density, high power consumption, and complexity is feasible (e. g. Cray Vector Supercomputers). • Main memory performance is affected by: – Memory latency: Affects cache miss penalty. Measured by: • Access time: The time it takes between a memory access request is issued to main memory and the time the requested information is available to cache/CPU. • Cycle time: The minimum time between requests to memory (greater than access time in DRAM to allow address lines to be stable) – Memory bandwidth: The maximum sustained data transfer rate between main memory and cache/CPU. EECC 551 - Shaaban #1 Lec # 9 Fall 2002 10 -17 -2002
Logical DRAM Organization (16 Mbit) Column Decoder … Sense Amps & I/O 14 Row/Column Address Data In Row Decoder A 0…A 13 0 D Memory Array (16, 384 x 16, 384) Q Data Out Word Line Control Signals: Row Access Strobe (RAS): Low to latch row address Column Address Strobe (CAS): Low to latch column address Write Enable (WE) Output Enable (OE) Storage Cell EECC 551 - Shaaban #2 Lec # 9 Fall 2002 10 -17 -2002
Logical Diagram of A Typical DRAM EECC 551 - Shaaban #3 Lec # 9 Fall 2002 10 -17 -2002
Four Key DRAM Timing Parameters • t. RAC: Minimum time from RAS (Row Access Strobe) line falling to the valid data output. – Usually quoted as the nominal speed of a DRAM chip – For a typical 64 Mb DRAM t. RAC = 60 ns • t. RC: Minimum time from the start of one row access to the start of the next (memory cycle time). – t. RC = 110 ns for a 64 Mbit DRAM with a t. RAC of 60 ns • t. CAC: minimum time from CAS (Column Access Strobe) line falling to valid data output. – 12 ns for a 64 Mbit DRAM with a t. RAC of 60 ns • t. PC: minimum time from the start of one column access to the start of the next. – About 25 ns for a 64 Mbit DRAM with a t. RAC of 60 ns EECC 551 - Shaaban #4 Lec # 9 Fall 2002 10 -17 -2002
DRAM Performance • A 60 ns (t. RAC) DRAM chip can: – Perform a row access only every 110 ns (t. RC) – Perform column access (t. CAC) in 12 ns, but time between column accesses is at least 25 ns (t. PC). • In practice, external address delays and turning around buses make it 30 to 40 ns • These times do not include the time to drive the addresses off the CPU or the memory controller overhead. EECC 551 - Shaaban #5 Lec # 9 Fall 2002 10 -17 -2002
Simplified DRAM Speed Parameters • Row Access Strobe (RAS)Time: (similar to t. RAC) – Minimum time from RAS (Row Access Strobe) line falling to the first valid data output. – A major component of memory latency. – Only improves 5% every year. • Column Access Strobe (CAS) Time/data transfer time: (similar to t. CAC) – The minimum time required to read additional data by changing column address while keeping the same row address. – Along with memory bus width, determines peak memory bandwidth. EECC 551 - Shaaban #6 Lec # 9 Fall 2002 10 -17 -2002
DRAM Generations Year Size 1980 1983 1986 1989 1992 1996 1998 2000 2002 64 Kb 256 Kb 1 Mb 4 Mb 16 Mb 64 Mb 128 Mb 256 Mb 512 Mb RAS (ns) CAS (ns) 150 -180 120 -150 100 -120 80 -100 60 -80 50 -70 45 -65 40 -60 75 50 25 20 15 12 10 7 5 8000: 1 (Capacity) 15: 1 (~bandwidth) Cycle Time 250 ns 220 ns 190 ns 165 ns 120 ns 110 ns 100 ns 90 ns 80 ns Memory Type Page Mode Fast Page Mode EDO PC 66 SDRAM PC 100 SDRAM PC 133 SDRAM PC 2700 DDR SDRAM 3: 1 (Latency) EECC 551 - Shaaban #7 Lec # 9 Fall 2002 10 -17 -2002
DRAM Write Timing EECC 551 - Shaaban #8 Lec # 9 Fall 2002 10 -17 -2002
DRAM Read Timing EECC 551 - Shaaban #9 Lec # 9 Fall 2002 10 -17 -2002
Simplified Asynchronous DRAM Read Timing Source: http: //arstechnica. com/paedia/r/ram_guide. part 2 -1. html EECC 551 - Shaaban #10 Lec # 9 Fall 2002 10 -17 -2002
Page Mode DRAM: Motivation EECC 551 - Shaaban #11 Lec # 9 Fall 2002 10 -17 -2002
Page Mode DRAM: Operation EECC 551 - Shaaban #12 Lec # 9 Fall 2002 10 -17 -2002
Simplified Asynchronous Fast Page Mode (FPM) DRAM Read Timing FPM DRAM speed rated using t. RAC ~ 50 -70 ns Typical timing at 66 MHZ : 5 -3 -3 -3 For bus width = 64 bits = 8 bytes cache block size = 32 bytes It takes = 5+3+3+3 = 14 memory cycles or 15 ns x 14 = 210 ns to read 32 byte block Read Miss penalty for CPU running at 1 GHZ = 15 x 14 = 210 CPU cycles EECC 551 - Shaaban #13 Lec # 9 Fall 2002 10 -17 -2002
Simplified Asynchronous Extended Data Out (EDO) DRAM Read Timing • Extended Data Out DRAM operates in a similar fashion to Fast Page Mode DRAM except the data from one read is on the output pins at the same time the column address for the next read is being latched in. EDO DRAM speed rated using t. RAC ~ 40 -60 ns Typical timing at 66 MHZ : 5 -2 -2 -2 For bus width = 64 bits = 8 bytes Max. Bandwidth = 8 x 66 / 2 = 264 Mbytes/sec It takes = 5+2+2+2 = 11 memory cycles or 15 ns x 11 = 165 ns to read 32 byte cache block Minimum Read Miss penalty for CPU running at 1 GHZ = 11 x 15 = 165 CPU cycles EECC 551 - Shaaban Source: http: //arstechnica. com/paedia/r/ram_guide. part 2 -1. html #14 Lec # 9 Fall 2002 10 -17 -2002
Current Synchronous DRAM Interface Characteristics Summary EECC 551 - Shaaban #15 Lec # 9 Fall 2002 10 -17 -2002
Synchronous Dynamic RAM, SDRAM Organization DDR SDRAM organization is similar but four banks are used in each DDR SDRAM chip instead of two. Data transfer on both rising and falling edges of the clock EECC 551 - Shaaban #16 Lec # 9 Fall 2002 10 -17 -2002
Simplified SDRAM Read Timing Typical timing at 133 MHZ (PC 133 SDRAM) : 5 -1 -1 -1 For bus width = 64 bits = 8 bytes Max. Bandwidth = 133 x 8 = 1064 Mbytes/sec It takes = 5+1+1+1 = 8 memory cycles or 7. 5 ns x 8 = 60 ns to read 32 byte cache block Minimum Read Miss penalty for CPU running at 1 GHZ = 7. 5 x 8 = 60 CPU cycles EECC 551 - Shaaban #17 Lec # 9 Fall 2002 10 -17 -2002
Memory Bandwidth Improvement Techniques • Wider Main Memory: Memory width is increased to a number of words (usually the size of a cache block). Þ Memory bandwidth is proportional to memory width. e. g Doubling the width of cache and memory doubles memory bandwidth • Simple Interleaved Memory: Memory is organized as a number of banks each one word wide. – Simultaneous multiple word memory reads or writes are accomplished by sending memory addresses to several memory banks at once. – Interleaving factor: Refers to the mapping of memory addressees to memory banks. e. g. using 4 banks, bank 0 has all words whose address is: (word address mod) 4 = 0 EECC 551 - Shaaban #18 Lec # 9 Fall 2002 10 -17 -2002
Wider memory, bus and cache Narrow bus and cache with interleaved memory Three examples of bus width, memory width, and memory interleaving to achieve higher memory bandwidth Simplest design: Everything is the width of one word EECC 551 - Shaaban #19 Lec # 9 Fall 2002 10 -17 -2002
Memory Interleaving Number of banks ³ Number of cycles to access word in a bank EECC 551 - Shaaban #20 Lec # 9 Fall 2002 10 -17 -2002
Four way interleaved memory Three memory banks address interleaving : Sequentially interleaved addresses on the left, address requires a division Right: Alternate interleaving requires only modulo to a power of 2 EECC 551 - Shaaban #21 Lec # 9 Fall 2002 10 -17 -2002
Memory Width, Interleaving: An Example Given the following system parameters with single cache level L 1: Block size=1 word Memory bus width=1 word Miss rate =3% Miss penalty=32 cycles (4 cycles to send address 24 cycles access time/word, 4 cycles to send a word) Memory access/instruction = 1. 2 Ideal CPI (ignoring cache misses) = 2 Miss rate (block size=2 word)=2% Miss rate (block size=4 words) =1% • • The CPI of the base machine with 1 -word blocks = 2+(1. 2 x 0. 03 x 32) = 3. 15 Increasing the block size to two words gives the following CPI: – 32 -bit bus and memory, no interleaving = 2 + (1. 2 x. 02 x 32) = 3. 54 – 32 -bit bus and memory, interleaved = 2 + (1. 2 x. 02 x (4 + 24 + 8) = 2. 86 – 64 -bit bus and memory, no interleaving = 2 + (1. 2 x 0. 02 x 1 x 32) = 2. 77 • Increasing the block size to four words; resulting CPI: – 32 -bit bus and memory, no interleaving = 2 + (1. 2 x 0. 01 x 4 x 32) = 3. 54 – 32 -bit bus and memory, interleaved = 2 + (1. 2 x 0. 01 x (4 +24 + 16) = 2. 53 – 64 -bit bus and memory, no interleaving = 2 + (1. 2 x 0. 01 x 2 x 32) = 2. 77 EECC 551 - Shaaban #22 Lec # 9 Fall 2002 10 -17 -2002
Computer System Components CPU Core 1 GHz - 3. 0 GHz 4 -way Superscaler RISC or RISC-core (x 86): Deep Instruction Pipelines Dynamic scheduling Multiple FP, integer FUs Dynamic branch prediction Hardware speculation SDRAM PC 100/PC 133 100 -133 MHZ 64 -128 bits wide 2 -way inteleaved ~ 900 MBYTES/SEC )64 bit) Double Date Rate (DDR) SDRAM PC 2100 133 MHZ DDR 64 -128 bits wide 4 -way interleaved ~2. 1 GBYTES/SEC (64 bit) RAMbus DRAM (RDRAM) 400 MHZ DDR 16 bits wide (32 banks) ~ 1. 6 GBYTES/SEC L 1 CPU L 2 All Non-blocking caches L 1 16 -128 K 1 -2 way set associative (on chip), separate or unified L 2 256 K- 2 M 4 -32 way set associative (on chip) unified L 3 2 -16 M 8 -32 way set associative (off chip) unified L 3 Caches System Bus Examples: Alpha, AMD K 7: EV 6, 200 -333 MHZ Intel PII, PIII: GTL+ 133 MHZ Intel P 4 533 MHZ adapters Memory Controller Memory Bus NICs Controllers Memory I/O Buses Disks Displays Keyboards North Bridge South Bridge Chipset Example: PCI, 33 -66 MHZ 32 -64 bits wide 133 -528 MBYTES/SEC Networks I/O Devices: EECC 551 - Shaaban #23 Lec # 9 Fall 2002 10 -17 -2002
X 86 CPU Cache/Memory Performance Example AMD Athlon T-Bird Vs. Intel PIII AMD Athlon T-Bird 1 GHZ L 1: 64 K INST, 64 K DATA (3 cycle latency), both 2 -way L 2: 256 K 16 -way 64 bit bus Latency: 7 cycles L 1, L 2 on-chip Main Memory: Intel PIII GHZ L 1: 16 K INST, 16 K DATA (3 cycle latency), both 2 -way L 2: 256 K 8 -way 256 bit , Latency: 7 cycles L 1, L 2 on-chip (32 byte blocks) 64 K 320 K PC 2100 133 MHZ DDR SDRAM 64 bit Peak bandwidth: 2100 MB/s Latency Range: 19 ns - 64 ns PC 133 MHZ SDRAM 64 bit Peak bandwidth: 1000 MB/s Latency Range: 25 ns - 80 ns L 1 Miss L 2 Miss L 1 Hit L 1 Miss L 2 Hit PC 800 Rambus DRDRAM 400 MHZ DDR 16 -bit Peak bandwidth: 1600 MB/s (1 channel) Latency Range: 35 ns - 80 ns Intel 840 uses two PC 800 channels Source: http: //www 1. anandtech. com/showdoc. html? i=1344&p=9 EECC 551 - Shaaban #24 Lec # 9 Fall 2002 10 -17 -2002
X 86 CPU Cache/Memory Performance Example: AMD Athlon T-Bird Vs. Intel PIII This Linpack data size range causes L 2 misses and relies on main memory AMD PC 2100 Intel PC 133 AMD PC 133 Intel PC 800 (2 channels) Intel PC 800 (1 channel) Source: http: //www 1. anandtech. com/showdoc. html? i=1344&p=9 EECC 551 - Shaaban #25 Lec # 9 Fall 2002 10 -17 -2002
X 86 CPU Cache/Memory Performance Example: AMD Athlon T-Bird Vs. Intel PIII, Vs. P 4 AMD Athlon T-Bird 1 GHZ L 1: 64 K INST, 64 K DATA (3 cycle latency), both 2 -way L 2: 256 K 16 -way 64 bit bus Latency: 7 cycles L 1, L 2 on-chip Intel P 4, 1. 5 GHZ L 1: 8 K DATA (2 cycle latency) 4 -way 64 byte blocks 96 KB Execution Trace Cache L 2: 256 K 8 -way 256 bit bus , 128 byte blocks Latency: 7 cycles L 1, L 2 on-chip Intel PIII 1 GHZ L 1: 16 K INST, 16 K DATA (3 cycle latency) both 2 -way 32 byte blocks L 2: 256 K 8 -way 256 bit bus , Latency: 7 cycles L 1, L 2 on-chip Source: http: //www 1. anandtech. com/showdoc. html? i=1360&p=15 EECC 551 - Shaaban #26 Lec # 9 Fall 2002 10 -17 -2002
X 86 CPU Cache/Memory Performance Example: AMD Athlon T-Bird Vs. Duron AMD Athlon T-Bird 750 MHZ-1 GHZ L 1: 64 K INST, 64 K DATA, both 2 -way L 2: 256 K 16 -way 64 bit Latency: 7 cycles L 1, L 2 on-chip Memory: PC 2100 133 MHZ DDR SDRAM 64 bit Peak bandwidth: 2100 MB/s PC 1600 100 MHZ DDR SDRAM 64 bit Peak bandwidth: 1600 MB/s L 1 Miss L 2 Miss L 1 Hit AMD Athlon Duron 750 MHZ-1 GHZ L 1: 64 K INST, 64 K DATA both 2 -way L 2: 64 K 16 -way 64 bit Latency: 7 cycles L 1, L 2 on-chip Source: http: //www 1. anandtech. com/showdoc. html? i=1345&p=10 EECC 551 - Shaaban #27 Lec # 9 Fall 2002 10 -17 -2002
A Typical Memory Hierarchy Faster Larger Capacity Processor Control Registers Datapath Second Level Cache (SRAM) L 2 On-Chip Level One Cache L 1 Main Memory (DRAM) Speed (ns): 1 s 100 s Size (bytes): 100 s Ks Ms Virtual Memory, Secondary Storage (Disk) Tertiary Storage (Tape) 10, 000 s 10, 000, 000 s (10 s ms) (10 s sec) Gs Ts EECC 551 - Shaaban #28 Lec # 9 Fall 2002 10 -17 -2002
Virtual Memory • Virtual memory controls two levels of the memory hierarchy: • Main memory (DRAM). • Mass storage (usually magnetic disks). • Main memory is divided into blocks allocated to different running processes in the system: • Fixed size blocks: Pages (size 4 k to 64 k bytes). • Variable size blocks: Segments (largest size 216 up to 232). • At any given time, for any running process, a portion of its data/code is loaded in main memory while the rest is available only in mass storage. • A program code/data block needed for process execution and not present in main memory result in a page fault (address fault) and the block has to be loaded into main memory from disk. • A program can be run in any location in main memory or disk by using a relocation mechanism controlled by the operating system which maps the address from virtual address space (logical program address) to physical address space (main memory, disk). EECC 551 - Shaaban #29 Lec # 9 Fall 2002 10 -17 -2002
Virtual Memory Benefits – Illusion of having more physical main memory – Allows program relocation – Protection from illegal memory access Virtual address 31 30 29 28 27 15 14 13 12 11 10 9 8 Virtual page number 3 2 1 0 Page offset Translation 2 9 28 27 15 14 13 12 11 10 9 8 Physical page number 3 2 1 0 Page offset Physical address EECC 551 - Shaaban #30 Lec # 9 Fall 2002 10 -17 -2002
Paging Versus Segmentation EECC 551 - Shaaban #31 Lec # 9 Fall 2002 10 -17 -2002
Virtual ® Physical Address Translation Contiguous virtual address space of a program Physical location of blocks A, B, C EECC 551 - Shaaban #32 Lec # 9 Fall 2002 10 -17 -2002
Mapping Virtual Addresses to Physical Addresses Using A Page Table EECC 551 - Shaaban #33 Lec # 9 Fall 2002 10 -17 -2002
Virtual Address Translation V irtual pa ge number P age table V a lid P hysica l pa ge or disk addre ss P hysica l m em ory 1 1 0 1 D isk stora ge 1 0 1 EECC 551 - Shaaban #34 Lec # 9 Fall 2002 10 -17 -2002
Page Table Organization Page table register Virtual address 3 1 30 2 9 28 2 7 1 5 1 4 1 3 12 1 1 1 0 9 8 Virtual page number Page offset 20 V a lid 3 2 1 0 12 Physical page number Two memory accesses needed: • First to page table. • Second to item. Page table 18 If 0 then page is not present in memory 29 28 27 15 14 13 Physical page number 12 1 1 10 9 8 3 2 1 0 Page offset Physical address EECC 551 - Shaaban #35 Lec # 9 Fall 2002 10 -17 -2002
Typical Parameter Range For Cache & Virtual Memory EECC 551 - Shaaban #36 Lec # 9 Fall 2002 10 -17 -2002
Virtual Memory Issues/Strategies • Main memory block placement: Fully associative placement is used to lower the miss rate. • Block replacement: The least recently used (LRU) block is replaced when a new block is brought into main memory from disk. • Write strategy: Write back is used and only those pages changed in main memory are written to disk (dirty bit scheme is used). • To locate blocks in main memory a page table is utilized. The page table is indexed by the virtual page number and contains the physical address of the block. – In paging: Offset is concatenated to this physical page address. – In segmentation: Offset is added to the physical segment address. • To limit the size of the page table to the number of physical pages in main memory a hashing scheme is used. • Utilizing address locality, a translation look-aside buffer (TLB) is usually used to cache recent address translations and prevent a second memory access to read the page table. EECC 551 - Shaaban #37 Lec # 9 Fall 2002 10 -17 -2002
Speeding Up Address Translation: Translation Lookaside Buffer (TLB) • • TLB: A small on-chip fully-associative cache used for address translations. If a virtual address is found in TLB (a TLB hit), the page table in main memory is not accessed. Virtual Page Number Valid Tag Physical Page Address 1 TLB (on-chip) 128 -256 Entries Physical Memory 1 128 -256 TLB Entries 0 1 Valid Physical Page or Disk Address 1 1 Page Table (in main memory) Disk Storage 0 1 1 0 1 EECC 551 - Shaaban #38 Lec # 9 Fall 2002 10 -17 -2002
Operation of The Alpha 21264 Data TLB (DTLB) During Address Translation Virtual address DTLB = 128 entries Address Space Number (ASN) Identifies process similar to PID (no need to flush TLB on context switch) Protection Permissions Valid bit EECC 551 - Shaaban #39 Lec # 9 Fall 2002 10 -17 -2002
A Memory Hierarchy With TLB & Two Levels of Cache TLB: Direct Mapped 256 entries L 1 direct mapped 8 KB L 2 direct mapped 4 MB Virtual address 64 bits Physical address 41 bits EECC 551 - Shaaban #40 Lec # 9 Fall 2002 10 -17 -2002
TLB Operation TLB & Cache Operation Virtual address TLB access Cache is physically-addressed TLB miss use page table No Yes TLB hit? Physical address No Try to read data from cache Cache miss stall No Cache hit? Yes Write? No Yes Write protection exception Cache operation W rite a ccess bit on? Yes W rite data into ca che, update the tag, a nd put the data and the addre ss into the write buffer Deliver data to the CPU EECC 551 - Shaaban #41 Lec # 9 Fall 2002 10 -17 -2002
CPU Performance with Real TLBs When a real TLB is used with a TLB miss rate and a TLB miss penalty is used: CPI = CPIexecution + mem stalls per instruction + TLB stalls per instruction Where: Mem Stalls per instruction = Mem accesses per instruction x mem stalls per access Similarly: TLB Stalls per instruction = Mem accesses per instruction x TLB stalls per access = TLB miss rate x TLB miss penalty Example: Given: CPIexecution = 1. 3 Mem accesses per instruction = 1. 4 Mem stalls per access =. 5 TLB miss rate =. 3% TLB miss penalty = 30 cycles What is the reluting CPU CPI? Mem Stalls per instruction = 1. 4 x. 5 =. 7 cycles/instruction TLB stalls per instruction = 1. 4 x (TLB miss rate x TLB miss penalty) = 1. 4 x. 003 x 30 =. 126 cycles/instruction CPI = 1. 3 +. 7 +. 126 = 2. 126 EECC 551 - Shaaban #42 Lec # 9 Fall 2002 10 -17 -2002
Event Combinations of Cache, TLB, Virtual Memory Cache TLB Virtual Memory Miss Hit Miss Miss Hit Hit Miss Hit Miss Possible? When? Possible, no need to check page table TLB miss, found in page table TLB miss, cache miss Page fault Impossible, cannot be in TLB if not in memory Impossible, cannot be in TLB or cache if not in memory Impossible, cannot be in cache if not in memory EECC 551 - Shaaban #43 Lec # 9 Fall 2002 10 -17 -2002
- Ram nam me lin hai dekhat sabme ram
- Cmos common source amplifier
- Static and dynamic ram
- Dynamic ram refresh rate
- Dynamic ram employs
- Memory basics
- Rdram vs sdram
- Dynamic ram types
- The internal ram memory of the 8051 is *
- Difference between ram and cache memory
- Dynamic dynamic - bloom
- Memory allocation in c++
- Example of dynamic memory allocation
- Explicit memory allocation
- Malloc function
- Knuth's boundary tags
- Example of dynamic memory allocation
- Dynamic memory allocation in data structure
- Dynamic memory allocation in data structure
- Dynamic c programming
- A free map determines which blocks are free, allocated.
- Dynamic memory allocation in java
- Dynamic memory management
- Dynamic memory management
- What is dynamic memory allocation
- Semantic features definition
- Explicit memory
- Long term memory vs short term memory
- Internal memory and external memory
- Primary memory and secondary memory
- Logical memory is broken into
- Which memory is the actual working memory?
- Virtual memory
- Virtual memory in memory hierarchy consists of
- Eidetic memory vs iconic memory
- Shared vs distributed memory
- Thunder is the sound of brainpop
- Sound waves from a radio generally travel in which medium?
- Comma after generally
- In a minimum cardinality, minimums are generally stated as
- Learning is defined as relatively ___ in behaviour.
- Judy believes that her fate
- Comma after generally
- Savanna biome plants