Module IV-MemorySystem
Module IV-MemorySystem
MEMORY SYSTEM
COA-MODULE -IV-MEMORY 1
1
SYSTEM
Text/Reference Books
COA-MODULE -IV-MEMORY
CO-UNIT-V-Memory System 5
.
SYSTEM
Exploiting the Memory Hierarchy
Locality
Spatial Locality:
• Data is more likely to be accessed if neighboring
data is accessed.
(e.g., data in a sequentially access array)
Temporal Locality:
• Data is more likely to be accessed if it has
been recently accessed.
(e.g. code within a loop)
COA-MODULE -IV-MEMORY 6
CO-UNIT-V-Memory
SYSTEM System
MEMORY HIERARCHY
Auxiliary
memory
Magneti
c I/O Main
tapes processo memor
Magneti r y
c
disks
CPU Cache
memor
Storage Hierarchy – y
fastest CPU registers
Register Memory Hierarchy is to obtain
at top, slowest tape the highest possible access
drives at bottom speed while minimizing the
Cache total cost of the memory
system
Main Memory • Speed of memory access is
Decreasing frequency critical, the idea is to bring
of access of the Magnetic Disk
instructions and data that will be
memory by the used in the near future as close
processor to the processor as possible.
Magnetic Tape
COA-MODULE -IV-MEMORY 7
CO-UNIT-V-Memory System
SYSTEM
An Example Memory Hierarchy
Smaller, Pre-fetching
Data L0:
faster, CPU registers hold words retrieved
transferred registers
and between layers from L1 cache.
costlier is L1: on-chip L1
(per byte) usually bigger cache (SRAM) L1 cache holds cache lines retrieved
storage than requested. from the L2 cache memory.
devices This is to off-chip L2
anticipate cache (SRAM)
L2 cache holds cache lines
using retrieved from main memory.
the extra
blocks L2:L3: main memory
Larger, of data (DRAM)
Main memory holds disk
slower, blocks retrieved from local
and disks.
cheaper local secondary storage
L4:
(per byte)
storage
(local disks) Local disks hold files
devices retrieved from disks on
remote network servers.
Control
Tertiary
Secondary
Storage
Storage
Second Main (Tape)
(Disk)
Level
Registers
Memory
On-
Datapath
Cache
Chip
Cache (DRAM)
(SRAM)
L0 L1 L2 L3 L4 L5
Speed (ns): 1.0ns 2.5n 10ns 10ms 10s
0.5ns s
16KB 256KB 512MB 80GB 20TB
Size (bytes): 256B
COA-MODULE -IV-MEMORY 9 9
CO-UNIT-V-Memory System
SYSTEM
Memory Hierarchy
• Fastest access is to the data held
Processor
in processor registers. Registers
Registers are at the top of the memory
Increasin L0 hierarchy.
Increasing
g size Increasing speed • Relatively small amount of
Primar cost
memory that can be
ycach L1 per bit
e implemented on the processor
chip. This is processor cache.
• Two levels of cache. Level 1 (L1)
Secondar
y cache L2 cache is on the processor chip.
Level 2 (L2) cache is in between
main memory and processor.
• Next level is main memory,
Main
memory implemented as SIMMs. Much
L3 larger, but much slower than
cache memory.
• Next level is magnetic disks.
Magnetic
disk Huge amount of inexepensive
secondary storage.
memory • Speed of memory access is
L4
critical, the idea is to bring
COA-MODULE -IV-MEMORY
CO-UNIT-V-MEMORY SYSTEM 10
instructions and data that will 1be
SYSTEM
used in the near future as close0
Main Memory
The main memory of a computer is semiconductor memory.
The main memory unit is basically consists of two kinds of
memory:
RAM (RWM):Random access memory; which is volatile in nature.
ROM: Read only memory; which is non-volatile.
Permanent information is kept in ROM and the user space is
basically in RAM.
The smallest unit of information is known as bit (binary digit)
in one memory cell one bit of information can be stored.
8 bit together is termed as a byte.
The maximum size of main memory that can be used in any
computer is determined by the addressing scheme.
A computer that generates 16-bit address is capable of addressing
upto 216 which is equal to 64K memory location.
Similarly, for 32 bit addresses, the total capacity will be 232
which is equal to 4G memory location.
In some computer, the smallest addressable unit of
information is a memory word and the machine is called word-
COA-MODULE -IV-MEMORY 11
CO-UNIT-V-Memory
addressable . System 1
SYSTEM
1
Some basic concepts
Processor Memory
k-
address
bit
MAR bus
n-bit
data
MDR bus Up to 2k
addressable
locations
3 2 1 0 0 2 2 3
Word- 7 6 5 4 4 5 6 7
address 11 10 9 8 8 9 10 11
15 14 13 12 12 13 14 15
Address of a Byte of a
word
COA-MODULE -IV-MEMORY word
CO-UNIT V-Memory 13
SYSTEM
System
Organization of the main
memory
In some computer, individual address is assigned for each
byte of information, and it is called byte-addressable
computer.
In this computer, one memory word contains one or more
memory bytes which can be addressed individually.
A byte addressable 32-bit computer, each memory word
contains 4 bytes. A possible way of address assignment is
shown in figure. The address of a word is always
integer multiple of 4.
The main memory is usually designed to store and
retrieve data in word length quantities.
The word length of a computer is generally defined by the
number of
bits actually stored or retrieved in one main memory access.
Consider a machine with 32 bit address bus. If the word size is
32 bit, then the high order 30 bit will specify the
address of a word. If we want to access any byte of the word,
then it can
COA-MODULE be specified by the lower two bit of the
-IV-MEMORY
CO-UNIT V-Memory 14
address bus.
SYSTEM
System
Some basic concepts(Contd.,)
◾ An important design issue is to provide a computer system with as
large and fast a memory as possible, within a given cost target.
◾ Several techniques to increase the effective size and speed of the
memory:
Cache memory (to increase the effective speed).
Virtual memory (to increase the effective size).
The data transfer between main memory and the CPU takes place
through two CPU registers.
MAR : Memory Address Register and MDR : Memory Data
Register.
If the MAR is k-bits, then the total addressable memory location will
be 2k.
If the MDR is n-bits, then the n bit of data is transferred in one
memory cycle.
In the above example, size of data bus is n-bit and size of address
bus is k bit.
It also includes control lines like Read, Write and Memory Function
Complete (MFC) for coordinating data transfer.
COA-MODULE
In the case of byte addressable computer, another control line to15
-IV-MEMORY be
added to indicate the byte transfer instead of the whole word.
SYSTEM
Memory Operation
CPU initiates a memory operation by loading the appropriate
data i.e., address to MAR.
Memory read operation,
CPU sets the read memory control line to 1.
Then the contents of the memory location is brought to
MDR. The memory control circuitry indicates this to the CPU
by setting
MFC to 1.
Memory write operation
CPU places the data into MDR .
Sets the write memory control line to 1.
Once the contents of MDR are stored in specified memory
location, then the memory control circuitry indicates the end
of operation by setting MFC to 1.
COA-MODULE -IV-MEMORY
CO-UNIT V-MEMORY System 116
SYSTEM
6
Measures for the speed of a memory:
Memory Access Time
A useful measure of the speed of memory unit is the time that
elapses between the initiation of an operation and the
completion of the operation .
(Ex. The time between Read and MFC)
Memory cycle time
This is the minimum time delay between the initiation two
independent memory operations
(Ex. two successive memory read operation).
Memory cycle time is slightly larger than memory access
time.
COA-MODULE -IV-MEMORY
CO-UNIT V-MEMORY 117
SYSTEM
System 7
Semiconductor RAM
memories
COA-MODULE -IV-MEMORY
118
SYSTEM
8
Internal organization of memory
chips
Each memory cell can hold one bit of information.
Memory cells are organized in the form of an array.
One row is one memory word.
All cells of a row are connected to a common line, known as the
“word
line”.
Word line is connected to the address decoder.
Sense/write circuits are connected to the data input/output lines of
the memory chip.
The storage part is modelled here with SR-latch, but in reality
it is an electronics circuit made up of transistors.
The memory constructed with the help of transistors is
known as semiconductor memory.
The semiconductor memories are termed as Random Access
Memory(RAM), because it is possible to access any memory
location in random.
Depending on the technology used to construct a RAM, there
are two types of RAM : SRAM: Static Random Access Memory.
COA-MODULE -IV-MEMORY
CO-UNIT-V-MEMORY SYSTEM
DRAM: Dynamic Random Access Memory. 119
SYSTEM 9
Memory Cell Operation
COA-MODULE -IV-MEMORY
CO-UNIT-V-Memory 20
SYSTEM
system
Chip Organization
Control (WR)
Cell
Select Data In / Data Out
(CS) (sense)
COA-MODULE -IV-MEMORY 21
SYSTEM
Simplified Representation-4 bit memory
COA-MODULE -IV-MEMORY 22
SYSTEM
Four Word Memory, 4 bits
per word
Memory
addresses:
0 A1=0,
1 A0=0
2 A1=0,
3 A0=1
A1=1,
Datain : AD3 D2 D1
0=0
D0
A1=1,
A =1
Dataout: Q0 3, Q2, Q1,
Q0
Decoder selects only one memory
cell
COA-MODULE -IV-MEMORY 23
SYSTEM
2n-Word 1-Bit RAM IC
To build a RAM IC 4-to-16 Word select
from a RAM A3 3
0
A3 2 1
slice, we need: 2 RAM cell
A2 2 3
– Decoder decodes A2 2
4
the n address lines A1 A1 21
5
6 RAM clel
ton word select
2 A0 A0 2
0 7
8
– lines
A 3-state buffer 16
1
x Decoder
9
RAM 10
on the data 11
As output.
memory arrays can be Data
input
Data
output
12
13
very 14
15
large ,We need large decoders Read/
RAM cell
The decoder size and Write
Memory
bfanouts canabe reduced by R/w
n using coincident enable logic
yapproximately
in aselection
2-dimensional Data input Data in
(a) Symbol Data
Dataout
array.
– Uses two decoders, one for words and one for oRu/wt
output
Bit
bits Read/Write
select
•
•
•
FF FF
A 0
W1
•
•
•
A 1
Addres • • • • • • Memor
s • • • • • • y
A 2 • • • • • • cells
decode
r
A 3
16 words of 8 bits
each: It has 16 W15
•
•
•
external
connections: addr.
4, data 8, R/
control: 2, Sense / Sense / Sense /
Write Write Write
power/ground: 2 circuit circuit circuit W
1K memory cells: CS
128x8 memory,
external connections:
b7 b1 b0
? 19 (7+8+2+2)
Data input/output Fig.16x8 memory
1Kx1:? 15
COA-MODULE -IV-MEMORY
CO-UNIT-V-MEMORY
(10+1+2+2) SYSTEM
lines: org. 252
SYSTEM 5
Cell Arrays and Coincident Selection
(continued) 2-to-4
Decoder 0
Example A3 21
RAM cell RAM cell RAM cell RAM cell
For address 1001: A2
20
0 1 2 3
1
10 selects row 2
Row RAM cell RAM cell RAM cell RAM cell
01 selects column select 4 5 6 7
1 Cell 9 is 2
Address .
accessedLines :A3 A2 A1
RAM cell
8
RAM cell
9
RAM cell
10
RAM cell
11
A 0 3
Row RAM cell RAM cell RAM cell RAM cell
select: A3A2 12 13 14 15
Column select: Row R/w R/w Read/Write Read/Write
logic
A1A0 decoder
logic logic logic
X X X X
Column select Data
Fig.16x1 memory 0 1 2 3 output
21 Enable
COA-MODULE -IV-MEMORY 26
SYSTEM 20 Chip select
A Memory Chip
5-bit row
addres W0
s
W1
32 32
5-bit
decode memory
r cell
array
W31 Sense/
Write
circuitry
10-bit
addres
s 32-to-
1 R/
output
W
multiplexer
and
CS
input
demultiplexer
5-bit
column
address
Data
Fig. Organization of a 1K 1 memory input/outp
ut
chip.
COA-MODULE -IV-MEMORY 27
SYSTEM
Static Memories
T1 T2
X Y
Word
line
Bit lines
COA-MODULE -IV-MEMORY 28
SYSTEM
SRAM
Cell
A static RAM cell (Transisitor Latch)
Two transistor inverters are cross connected to implement a
basic flip-flop (latch).
The latch is connected to one word line and two bits lines by
transistors T1 and T2.
T1 and T2 act as swithes that can be opened or closed
under the control of the word line.
When word line is at ground level, the transistors are
turned off and
the latch retains its state.
Ex.The cell is in state 1 if the logic value at X is 1 and at Y is 0.
How to read state of SRAM cell:
The word line is activated to close switches T1 and T2.
If the cell is in state 1, the signal on bit line b is high and the
signal at bit line b’ is low. The opposite is true if the cell is in
state 0 Thus b and b’ are complements of each other.
Sense/Write circuits at the end of the bit lines monitor the
COA-MODULE
state of b-IV-MEMORY
and SYSTEM
CO-UNIT-V-MEMORY b’ and set the output accordingly. 229
SYSTEM 9
SRAM cell.
Write operation:
The state of the cell is set by placing the appropriate value on
bit b and b’, and then activating the word line.
This forces the cell into the corresponding state.
The required signals on the bit lines are generated by
sense /write circuit.
COA-MODULE -IV-MEMORY
Chapter 2 - Machine Instructions & 330
SYSTEM
0
Static Memories-CMOS Cell
Low power
consumption
Advantage of using Static RAM
cell : Access time is less
COA-MODULE -IV-MEMORY 31
SYSTEM
Asynchronous DRAMs vs SRAMs
Word line
T
C
COA-MODULE -IV-MEMORY 36
SYSTEM
Synchronous DRAMs
• Operation is directly
synchronized with processor
clock signal.
Refres
h • The outputs of the sense circuits
counte
r are connected to a latch.
• During a Read operation, the
contents of the cells in a row
Row
addres Row Cell array are loaded onto the latches.
decode • During a refresh operation, the
s latch r
Row/ contents of the cells are
Column refreshed without changing the
address Colum contents of the latches.
n • Data held in the latches
addres
s Column Read/Write correspond to the selected
counte decode circuits &
r latches
columns are transferred
r
to the output.
Cloc • For a burst mode of operation,
k
Mode successive columns are selected
RA SS Data Data
CA register
input output
using column address counter and
R/ W and register register clock. CAS signal need not be
timing control
CS generated externally. A new data is
placed during raising edge of the
clock
Dat
COA-MODULE -IV-MEMORY a
37
SYSTEM
Latency and Bandwidth
COA-MODULE -IV-MEMORY 38
SYSTEM
Latency, Bandwidth, and DDRSDRAMs
COA-MODULE -IV-MEMORY
CO-UNIT-V-MEMORY SYSTEM 339
SYSTEM 9
Constructing Wider
Memory
COA-MODULE -IV-MEMORY 40
SYSTEM
Constructing Longer
Memory
We can combine
chips to create a
8 word x 4 bit
memory. Third
address bit goes
to a decoder to
select only one of
the two chips.
COA-MODULE -IV-MEMORY 41
SYSTEM
Structure of large memories: Static
memories Implement a memory unit of
21-bit 2M words of 32 bits each.
addresse 19-bit internal chip address
A0 s Use 512x8 static memory
A1
chips. Each column consists
A19 of 4 chips. Each chip
A20
implements one byte
position.
A chip is selected by setting
its chip select control line to
2-bit 1.
decode
r Selected chip places its data on
the data output line, outputs of
other chips are in high
512K 8
memory impedance state.
D31-24 D23- D15- D7-0
chip
16 8 21 bits to address a 32-bit
512 K 8 memory
chip word. High order 2 bits are
19-bit 8-bit data
needed to select the row, by
addres
s
input/outp
ut activating the four Chip Select
signals.
Fig. Organization of 2M x Chip 19 bits are used to access
select
32 specific byte locations inside
COA-MODULE -IV-MEMORY the selected chip. 42
SYSTEM
Large memories: Dynamic memories
COA-MODULE -IV-MEMORY 43
SYSTEM
Memory controller
COA-MODULE -IV-MEMORY 44
SYSTEM
Memory controller (contd..)
Row/
address
Column
Addres
s
RAS
R/
Memory CAS
W
Reques controller R/ W
Processor t CS Memory
Cloc
k Clock
Dat
a
COA-MODULE -IV-MEMORY 45
SYSTEM
Read-Only
Memories
(ROMs)
COA-MODULE -IV-MEMORY 46
SYSTEM
Read-Only Memories (ROMs)
Volatile / non-volatile
memory
ROM
PROM: programmable ROM
Bit line
Word
line
P Connected to store a 0
Not connected to store a
1
Fig. A ROM
cell.
COA-MODULE -IV-MEMORY 48
SYSTEM
Read-Only Memories (Contd.,)
◾ Read-Only Memory:
Data are written into a ROM when it is manufactured.
◾ Programmable Read-Only Memory (PROM):
Allow the data to be loaded by a user.
Process of inserting the data is irreversible.
Storing information specific to a user in a ROM is
expensive.
Providing programming capability to a user may be
better.
◾ Erasable Programmable Read-Only Memory (EPROM):
Stored data to be erased and new data to be loaded.
Flexibility, useful during the development phase of
digital
systems.
Erasable, reprogrammable ROM.
Erasure requires exposing the ROM to UV light.
COA-MODULE -IV-MEMORY 449
SYSTEM 9
Read-Only Memories (Contd.,)
COA-MODULE -IV-MEMORY 52
SYSTEM
Cache Memories
COA-MODULE -IV-MEMORY 53
SYSTEM
Locality of Reference
COA-MODULE -IV-MEMORY 54
SYSTEM
Cache memories
Main
Processor Cache
memor
y
Size
Mapping Function
Replacement
Algorithm
Write Policy
Block Size
Number of Caches
COA-MODULE -IV-MEMORY 59
SYSTEM
•
Tag Fields
• A cache line contains two fields
– Data from RAM
– The address of the block currently in the cache.
• The part of the cache line that stores the address of the block is
called the tag field.
Many different addresses can be in any cache line.
The tag specifies the address currently in the cache line.
Only the upper address bits are needed.
Cache Lines
• The cache memory is divided into blocks or lines. Currently lines
can
range from 16 to 64 bytes.
• Data is copied to and from the cache one line at a time.
•The lower log2(line size) bits of an address specify a particular
byte in line.
COA-MODULE -IV-MEMORY 60
SYSTEM
Line Example
01100101 With a line size of
00 4,
01100101
01
COA-MODULE -IV-MEMORY
CO-UNIT-V-MEMORY SYSTEM 662
SYSTEM 2
Example
64
COA-MODULE -IV-MEMORY SYSTEM
1.Direct mapping
65
COA-MODULE -IV-MEMORY SYSTEM
Direct Mapping-with word
transfers
Direct Cache Addressing
The lower log2(line size) bits define which byte in the block
The next log2(number of lines) bits defines which line of the
cache
The remaining upper bits are the tag field.
Cache Constants
cache size / line size = number of lines
log2(line size) = bits for offset
log2(number of lines) = bits for cache index
remaining upper bits = tag address bits
Given problem:
w=4 words=22
Divide the remaining main memory block size into two
parts.(s=22) r and (s-r) fields.
One part should be equal to cache block of cache called
Main memory
address
Tag Index/ line word
24 bit address
w=2 bit word identifier (4 byte
block) Address field:
22 bit block identifier s=14,
8 bit tag (=22-14)
14 bit slot or line
No two blocks in the same line
have the same Tag field
Check contents of cache by finding
line and checking Tag
COA-MODULE -IV-MEMORY SYSTEM 71
Direct Mapping from Cache to Main
Memory
0 0, m, 2m, 3m…2s-m
1 1,m+1, 2m+1…2s-m+1
Simple
Inexpensive
Fixed location for given block
If a program accesses 2 blocks that map to the same
line repeatedly, cache misses are very high
74
COA-MODULE -IV-MEMORY SYSTEM
Direct mapping-example2
77
COA-MODULE -IV-MEMORY SYSTEM
2.Fully Associative Mapping
Tag word
80
COA-MODULE -IV-MEMORY SYSTEM
Associative Mapping
81
COA-MODULE -IV-MEMORY SYSTEM
Associative Mapping
from Cache to Main
Memory
82
COA-MODULE -IV-MEMORY SYSTEM
Associative mapping
Mai
• Main memory block can be placed
memor Block 0
y
n
Block 1
into any cache position.
Cach
e
• Memory address is divided into 2
tag
Block 0
tag
fields:
Block 1 - Low order 4 bits identify the word
Block 127
within a block.
Block 128 - High order 12 bits or tag bits
tag
Block 127 Block 129 identify a memory block
when it is resident in the
cache.
• Flexible, and uses cache space
Block 255
Tag Word
Block 256
efficiently.
12 4
• Replacement algorithms can be used
Main memory
Block 257
address to replace an existing block in the
cache when the cache is full.
• Cost is higher than direct-mapped
Block 4095
cache because of the need to search
all 128 patterns to determine whether
COA-MODULE -IV-MEMORY
CO-UNIT-V-MEMORY SYSTEM a given block is in the cache. 883
SYSTEM 3
3.Set Associative Mapping
That is more than one pair of tag and data are residing
the
at same location of cache memory. If one cache
location is holding
Tag two pair
Set of tag + word
data items, that
is called s2e-tway associative mapping.
84
COA-MODULE -IV-MEMORY SYSTEM
2-way Set Associative
Mapping
COA-MODULE -IV-MEMORY 89
SYSTEM
Performance considerations
COA-MODULE -IV-MEMORY 90
SYSTEM
Interleaving
COA-MODULE -IV-MEMORY 91
SYSTEM
Methods of address layouts
k m
bits bits mbit k
Module Address in MM
module address s bits
Address in Module MM
module address
COA-MODULE -IV-MEMORY 92
SYSTEM
Hit Rate and Miss Penalty
Hit rate
Miss penalty
Hit rate can be improved by increasing block size, while
keeping cache size constant
Block sizes that are neither very small nor very large give
best
results.
Miss penalty can be reduced if load-through approach is used
when loading new blocks into cache.
COA-MODULE -IV-MEMORY 93
SYSTEM
Caches on the processor chip
COA-MODULE -IV-MEMORY 94
SYSTEM
Writing into the cache
COA-MODULE -IV-MEMORY
995
SYSTEM
5
Other Performance Enhancements
◾ Write-through:
• Each write operation involves writing to the main memory.
• If the processor has to wait for the write operation to be complete, it
slows
down the processor.
• Processor does not depend on the results of the write operation.
• Write buffer can be included for temporary storage of write requests.
• Processor places each write request into the buffer and continues
execution.
• If a subsequent Read request references data which is still in the
write buffer, then this data is referenced in the write buffer.
◾ Write-back:
• Block is written back to the main memory when it is replaced due
to a miss.
• If the processor waits for this write to complete, before reading the
new block, it is slowed down.
• Fast write buffer can hold the block to be written, and the new
block can be read first.
• Dirty bit is set when we write to the cache, this indicates the cache
is now
inconsistent with main memory.
• CO-UNIT-V-MEMORY
Dirty bit for
COA-MODULE cache
-IV-MEMORYslot is cleared when update occurs.
SYSTEM 996
SYSTEM 6
Main advantages:
Write- Back vs Write-
Through
• Write- Back:
• The block can be written by the processor at the frequency at
which the cache, and not the main memory, can accept it.
• Multiple writes to the same block require only a single write to
the main memory.
• Write- Through:
• Simpler to be implemented, but to be effective it requires a w rite
buffer to do , not to wait for the lower level of the memory
hierarchy (to avoid write stalls)
• The read misses are cheaper because they do not require any
write to the
lower level of the memory hierarchy
• Memory always up to date.
COA-MODULE -IV-MEMORY 97
SYSTEM
Other Performance Enhancements (Contd.,)
Prefetching
• New data are brought into the processor when they are first
needed.
• Processor has to wait before the data transfer is complete.
• Prefetch the data into the cache before they are actually needed,
or a
before a Read miss occurs.
• Prefetching can be accomplished through software by
including a special instruction in the machine language of
the processor.
Inclusion of prefetch instructions increases the length of
the
programs.
• Prefetching can also be accomplished using hardware:
Circuitry that attempts to discover patterns in memory
references and then prefetches according to this pattern.
COA-MODULE -IV-MEMORY 98
SYSTEM
Other Performance Enhancements (Contd.,)
Lockup-Free Cache
• Prefetching scheme does not work if it stops other
accesses to the cache until the prefetch is completed.
• A cache of this type is said to be “locked” while it services
a miss.
• Cache structure which supports multiple outstanding
misses is called a lockup free cache.
• Since only one miss can be serviced at a time, a lockup free
cache must include circuits that keep track of all the
outstanding misses.
• Special registers may hold the necessary
information about these misses.
COA-MODULE -IV-MEMORY 99
SYSTEM
Cache replacement
policies
COA-MODULE -IV-MEMORY
10
SYSTEM
0
Cache algorithms (Page replacement
policies)
Replacement algorithms are used when there are no
available space in a cache in which to place a data. Four of
the most common cache replacement algorithms are
described
COA-MODULE -IV-MEMORY 10
SYSTEM 3
Virtual memories
memory.
Physical address in main
memory
COA-MODULE -IV-MEMORY 113
SYSTEM
Address translation (contd..)
◾ Page table entry for a page also includes some control bits
which describe the status of the page while it is in the main
memory.
◾ One bit indicates the validity of the page.
Indicates whether the page is actually loaded into the
main
memory.
Allows the operating system to invalidate the page
without actually removing it.
◾ One bit indicates whether the page has been modified
during its residency in the main memory.
This bit determines whether the page should be written
back to the disk when it is removed from the main memory.
Similar to the dirty or modified bit in case of cache
memory.
COA-MODULE -IV-MEMORY 12
SYSTEM 5
Memory management
COA-MODULE -IV-MEMORY 12
SYSTEM 9
Magnetic Hard Disks
Disk
Disk drive
Disk
controller
Sector 0,
Sector 3,
track 1
trackn Sector 0,
track 0
Sector header
Following the data, there is an error-correction code
(ECC).
Formatting process
Difference between inner tracks and outer tracks
Access time – seek time / rotational delay (latency
time)
Data buffer/cache
System
bus
Disk
controller
Seek
Read
Write
Error
checking
Pit Lan
d
Reflectio
n
Reflectio
n
No
reflection
0 1 0 0 1 0 0 0 0 1 0 0 0 1 0 0 1 0 0 1
0
CD-ROM
CD-Recordable (CD-R)
CD-ReWritable (CD-
RW)
DVD
DVD-RAM
File File
mar File
k mar
•
k
•
• • 7 or
• • 9
• •
bits