









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Faster and more expensive than DRAM. □ Dynamic RAM (DRAM). ▫ Each cell stores bit with a capacitor. One transistor is used for access.
Typology: Study notes
1 / 16
This page cannot be seen from the preview
Don't miss anything!










Carnegie Mellon
Introduction
to
Computer
Systems
th
Lecture,
Feb.
Instructors: Todd
Mowry
Anthony
Rowe
1
y
y
Carnegie Mellon
2
Carnegie Mellon
RAM is
traditionally
packaged
as
a
chip.
i^
i i
ll^
ll (
bi
ll)
asic
storage
unit
i
s^
normally
a
cell (one
bi
t^
per
cell).
Multiple
chips
form
a
memory.
Each
cell
stores
a
bit
with
a
four
or
six
‐transistor
circuit.
Retains
value
indefinitely,
as
long
as
it
is
kept
powered.
Relatively
insensitive
to
electrical
noise
radiation,
etc.
t^
d
i^
th
3
aster
and
more
expensive
th
an
Each
cell
stores
bit
with
a
capacitor.
One
transistor
is
used
for
access
Value
must
be
refreshed
every
ms.
More
sensitive
to
disturbances
radiation,…)
than
Slower
and
cheaper
than
Carnegie Mellon
Trans.
Access
Needs
Needs
per bit
time
refresh? EDC?
Cost
Applications
4 or 6
No
Maybe
100x
Cache memories
Yes
Yes
Main memories,frame buffers
4
Carnegie Mellon
dw total
bits
organized
as
d supercells of
size
w bits^ cols
rows
0
1
2
3
0 1 2
16 x 8 DRAM chip
addr
ll
2 bits/
Memory
5
2 3
Internal row buffer
data
supercell
(2,1)
8 bits/
Memorycontroller
(to/from CPU)
Carnegie Mellon
Step
1(a):
Row
access
strobe
selects
row
Step
1(b):
Row
copied
from
array
to
row
buffer.
Step
1(b):
Row
copied
from
array
to
row
buffer. Cols
Rows
RAS
=
2
0
1
2
3
0 1 2
16 x 8 DRAM chip
addr
2 /
Memory
6
2
Internal row buffer
3
data
8 /
controller
Carnegie Mellon
Step
2(a):
Column
access
strobe
selects
column
Step
2(b):
Step
2(b):
SupercellSupercell (2,1)
copied
from
buffer
to
data
lines,
and
eventually
copied
from
buffer
to
data
lines,
and
eventually
back
to
the
back
to
the
Cols
Rows
0
1
2
3
0 1 2
16 x 8 DRAM chip
CAS
=^
1
addr
2 /
Memory
To CPU
7
2 3
Internal row buffer
data
8 /
controller
supercell
(2,1)
supercell
(2,1)
Carnegie Mellon
: supercell (i,j)
addr
(row
=
i,
col
=^
j)
DRAM 0
64 MBmemory moduleconsisting ofeight 8Mx8 DRAMs
DRAM 7
bits0-
bits8-
bits16-
bits24-
bits32-
bits40-
bits48-
bits56-
8
Memorycontroller
0
31
7 8
15 16 23 24
32
63
39 40 47 48 55 56 64-bit doubleword at main memory address
A
64-bit doubleword
0
31
7 8
15 16 23 24
32
63
39 40 47 48 55 56
Carnegie Mellon
ALU
Register file
Bus interface
x^
0 A
x
Main memory
%eax
I/O bridge
Load operation:
movl
A,
%eax
13
Carnegie Mellon
x^
ALU
Register file
Bus interface
x
Main memory
0 A
%eax
I/O bridge
Load operation:
movl
A,
%eax
14
Carnegie Mellon
y^
ALU
Register file
Bus interface
A
Main memory
0 A
%eax
I/O bridge
Store operation:
movl
%eax,
A
15
Carnegie Mellon
y^
ALU
Register file
Bus interface
y
Main memory
(^0) A
%eax
I/O bridge
Store operation:
movl
%eax,
A
16
Carnegie Mellon
y^
ALU
register file
bus interface
y
main memory
0 A
%eax
I/O bridge
Store operation:
movl
%eax,
A
17
Carnegie Mellon
18
Image courtesy of Seagate Technology
Carnegie Mellon
Surface
Tracks
Track
k
Gaps
19
Spindle
Sectors
Carnegie Mellon
Cylinder
k
Surface 0Surface 1Surface 2Surface 3Surface 4Surface 5
Platter 0Platter 1Platter 2
20
Spindle
Carnegie Mellon
25
Carnegie Mellon
26
Carnegie Mellon
27
Carnegie Mellon
28
Carnegie Mellon
After BLUE read
29
Carnegie Mellon
After BLUE read
30
Carnegie Mellon
After BLUE read
Seek for RED
31
Carnegie Mellon
After BLUE read
Seek for RED
Rotational latency
32
Carnegie Mellon
Th
f^
il bl
i^
d l d
f^
b
i^
d
Th
e
set
of
available
sectors
i
s^
modeled
as
a
sequence
of
b
‐sized
logical
blocks
Maintained
by
hardware/firmware
device
called
disk
controller.
Converts
requests
for
logical
blocks
into
(surface,track,sector)
triples.
37
triples.
Accounts
for
the
difference
in
“formatted
capacity”
and
“maximum
capacity”.
Carnegie Mellon
ALU
Register file
CPU chip
Main memory
I/O bridge
Bus interface
System bus
Memory bus
38
Disk controller
Graphicsadapter
USB controller Mouse
Keyboard
Monitor
Disk
I/O bus
Expansion slots forother devices suchas network adapters.
Carnegie Mellon
ALU
Register file
CPU chip
Main memory
ALU
I/O bus
Bus interface
39
Disk controller
Graphicsadapter
USB controller mouse
keyboard
Monitor
Disk
Carnegie Mellon
A
LU
Register file
CPU chip
Main memory
U
I/O bus
Bus interface
40
Disk controller
Graphicsadapter
USB controller Mouse
Keyboard
Monitor
Disk
Carnegie Mellon
ALU
Register file
CPU chip
Main memory
ALU
I/O bus
Bus interface
41
Disk controller
Graphicsadapter
USB controller Mouse
Keyboard
Monitor
Disk
Carnegie Mellon
Solid State Disk (SSD)
Requests to read andwrite logical disk blocks
Flash
translation layer
Page 0
Page 1
Page P-
Block 0
Page 0
Page 1
Page P-
Block B-
Flash memory
(^
)
42
Carnegie Mellon
Sequential
read
tput
MB/s
Sequential
write
tput
MB/s
Random
read
tput
MB/s
Random
write
tput
MB/s
Erasing
a
block
is
slow
(around
ms)
Write
to
a
page
triggers
a
copy
of
all
useful
pages
in
the
block
^
Find an used block (new block) and erase it
p
p
Rand
read
access
us
Random
write
access
us
43
^
Find
an
used
block
(new
block)
and
erase
it
^
Write
the
page
into
the
new
block
^
Copy
other
pages
from
old
block
to
the
new
block
Carnegie Mellon
No
moving
parts
faster,
less
power,
more
rugged
Have
the
potential
to
wear
out
^
Mitigated
by
“wear
leveling
logic”
in
flash
translation
layer
^
E.g.
Intel
guarantees
petabyte (
15
bytes)
of
random
writes
before
they
wear
out
In 2010 about 100 times more expensive per byte
44
In
about
times
more
expensive
per
byte
players,
smart
phones,
laptops
Beginning
to
appear
in
desktops
and
servers
Carnegie Mellon
49
Carnegie Mellon
Recently
referenced
items
are
likely
to
be
referenced
again
in
the
near
future
50
Items
with
nearby
addresses
tend
to
be
referenced
close
together
in
time
Carnegie Mellon
sum
=
0;
for
(i =
0;
i <
n;
i++)
sum
+= a[i];
Reference
array
elements
in
succession
(stride
reference
pattern).
Reference
variable
sum
each
iteration.
sum
+= a[i];
return sum;
51
Reference
instructions
in
sequence.
Cycle
through
loop
repeatedly.
Carnegie Mellon
int sum_array_rows(int a[M][N]){
52
{
int i, j, sum = 0;for (i = 0; i < M; i++)
for (j = 0; j < N; j++)
sum += a[i][j];
return sum;
}
Carnegie Mellon
int sum_array_cols(int a[M][N]){
int i, j, sum = 0;for (j = 0; j < N; j++)
for (i = 0; i < M; i++)
sum += a[i][j];
return sum;
53
return
sum;
}
Carnegie Mellon
int sum_array_3d(int a[M][N][N]){
int i, j, k, sum = 0;for (i = 0; i < M; i++)
for (j = 0; j < N; j++)
54
for
(j = 0; j < N; j++)for (k = 0; k < N; k++)
sum += a[k][i][j];
return sum;
}
Carnegie Mellon
h
l^
i^
b
h
l^
i
ast
storage
technologies
cost
more
per
b
yte,
h
ave
less
capacity,
and
require
more
power
(heat!).
The
gap
between
and
main
memory
speed
is
widening.
Well
‐written
programs
tend
to
exhibit
good
locality.
55
Carnegie Mellon
56
Carnegie Mellon
Data
in
block
b
is
needed
Request:
12
0
1
2
3
8
9
14
3
Block
b
is
not
in
cache:
Miss!Block
b
is
fetched
from
memory
Request:
12
12
12
Block
b
is
stored
in
cache
61
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
12
-^ Placement
policy:
determines
where
b
goes
-^ Replacement
policy:
determines
which
block
gets
evicted
(victim)
Carnegie Mellon
C ld
i^
b
h
h
i
old
misses
occur
b
ecause
the
cache
i
s^
empty.
Most
caches
limit
blocks
at
level
k+
to
a
small
subset
(sometimes
a
singleton)
of
the
block
positions
at
level
k.
^
E.g.
Block
i at
level
k+
must
be
placed
in
block
(i mod
at
level
k.
Conflict
misses
occur
when
the
level
k cache
is
large
enough,
but
multiple
data objects all map to the same level
k
block.
62
data
objects
all
map
to
the
same
level
k
block.
^
E.g.
Referencing
blocks
would
miss
every
time.
Occurs
when
the
set
of
active
cache
blocks
(working
set)
is
larger
than
the
cache.
Carnegie Mellon
CacheRegisters
Type
4 ‐
8 bytes words What
is
Cached?
Compiler 0
CPU core
Managed
By
Latency
(cycles)
Where
is
it
Cached?
Hardware 0
On
‐ Chip
TLB
Address
translations
TLB Buffer
cache
Virtual
Memory
L
cache L
cache Registers
Parts
of
files
4 ‐
KB
page
64
‐ bytes
block
64
‐ bytes
block
4 8
bytes
words
OS
100
Main
memory
Hardware 1
On
‐ Chip
L
Hardware
10
On/Off
‐ Chip
L
Hardware
OS
100
Main
memory
Compiler 0
CPU
core
Disk cache
Disk sectors
Disk controller
100 000
Disk firmware
63
Web
browser
10,000,
Local
disk
Web
pages
Browser
cache
Web
cache
Network
buffer
cache
Web
pages
Parts
of
files
Web
proxy
server
1,000,000,
Remote
server
disks
AFS/NFS
client
10,000,
Local
disk
Disk
cache
Disk
sectors
Disk
controller
100
,
Disk
firmware
Carnegie Mellon
64