Memory Organization
Memory Organization
Memory Organization
Memory Organization.
Memory Organization.
Memory Unit
2k words
n bits per word
Memory Organization.
Memory Organization.
Memory Hierarchy
Main Memory
Main Memory
Main Memory
Main Memory
Main Memory
Main Memory
Main Memory
Main Memory
Main Memory
Flash Memory:
It is electrically erasable and Programmed
permanent type of memory. The entire block is
erased and reprogrammed as a whole at a time.
The name flash memory has been given due
to fast reprogrammed capacity.
Due to lower power consumption flash memory
is used in battery driven digital devices such as
handled computers, cell phones, digital
cameras, MP3 players etc.
Auxiliary Memory
Auxiliary Memory
Auxiliary Memory
Auxiliary Memory
Auxiliary Memory
Auxiliary Memory
Auxiliary Memory
Magnetic Tapes:
Magnetic tapes consists of the electrical,
mechanical, and electronic components to
provide the parts and control mechanism for a
magnetic tape unit.
The tape it self is a strip of plastic coated with
magnetic recording medium. Bits are recorded as
magnetic spots on the tape along several tracks.
Read/write heads are mounted on one track so
that data can be recorded and read as a
sequence of characters.
Auxiliary Memory
Memory Hierarchy
Memory Hierarchy
Memory Hierarchy
Q. How do architects address this
gap?
A. Put smaller, faster cache
memories between CPU and DRAM.
Create a memory hierarchy.
Memory Hierarchy
Memory Hierarchy
Memory Hierarchy
Memory Hierarchy
Main Memory
Random-Access Memory
(RAM)
Access
time
Persist? Sensitive?
Cost
Applications
SRAM
1X
Yes
No
100x
cache memories
DRAM
10X
No
Yes
1X
Main memories,
frame buffers
ROM
Main Memory
RAM
ROM
Outline
Memory Hierarchy
Associative Memory
Cache
Virtual memory
Associative Memory
Associative Memory
Associative Memory
Associative Memory
Hardware Configuration
Associative Memory
Associative Memory
Associative Memory
Associative Memory
A
K
Word1
Match
Word2
101 111100
111 000000
100 111100 No
101 000001 Match
Associative Memory
Read Operation
If more than one word in memory matches
the unmasked argument field, all the match
words will have 1s in the corresponding bit
position of the match register.
It is then necessary to scan the bits of the
match register one at a time.
The matched words are read in sequence
by applying a read signal to each word line
whose corresponding Mi bit is a 1.
Associative Memory
Write Operation
Cache memory
Cache memory
Cache memory
Cache memory
Cache memory
Associative mapping
Direct mapping
Set-associative mapping
Cache memory
Cache memory
Associative mapping
Associative mapping
Fig: Associative Mapping Cache( all numbers in
octal)
Associative mapping
Associative mapping
Direct Mapping
Direct Mapping
Direct Mapping
fig: Addressing Relationships Between
Main And Cache Memories
6 bits 9 bits
Address = 15 bits
Data = 12 bits
Address = 9
bits
Data = 12 bits
Direct Mapping
Direct Mapping
Fig: Direct mapping cache organization
a. Main Memory
b. Cache Memory
Direct Mapping
Direct Mapping
Direct Mapping
Block 0
Index
Tag
000
01
3450
007
01
6578
Data
6
Tag
Block
Word
010
Block 1
017
Index
770
Block 63 777
02
6710
02
Direct Mapping
Set-Associative Mapping
Set-Associative Mapping
Fig: Two-Way Set-Associative Mapping Cache
Set-Associative Mapping
Set-Associative Mapping
Cache Memory
Writing into Cache
If the operation is a write , there are two ways that the
system can proceed.
Write-through method: The simplest and commonly
used procedure is to update main memory with every
memory write operation, with cache memory being updated
in parallel if it contains the word at the specified address.
This method as the advantage that main memory always
contains the same data as the cache.
Write-back method: In this method only the cache location
is updated during a write operation. The location is then
marked by a flag so that later when the word is removed
from the cache it is copied into main memory.
Virtual Memory
Virtual Memory
Virtual Memory
Virtual Memory
Virtual Memory
Auxiliary Memory
Program1
Data1,1
Data1,2
Main Memory
Program1
Program 2
Data 2,1
Data 1,1
Address Space
N=1024K=2^20
Memory space
M=32k=2^15
Virtual Memory
Fig: Memory table for mapping a virtual address
Virtual
addres
s
register
(20
bits)
Memory
Mapping
Table
Memory
Table
Buffer
register
Main
Memory
address
register
(15 bits)
Main
Memory
Main
Memory
Buffer
Register
Virtual Memory
Address mapping using pages:
The implementation of the address mapping is simplified
if the information in the address space and the memory
space are divided into groups of fixed size.
The physical memory is broken down into groups of equal
size called blocks.
The term page refers to groups of address space of the
same size
For example, if a page or block consists of 1k words, then
using previous example, address space is divided into
1024 pages and main memory is divided into 32 blocks
Virtual Memory
The programs are also considered to be split
into pages. Portions of programs are moved
from auxiliary memory to main memory in
records of equal size of a page. The term
page-frame is some times used to denote a
block.
Consider a computer with an address space of
8k and memory space of 4k. If we split each
into groups of 1k words we obtain eight pages
and four blocks as shown in figure.
Virtual Memory
Fig: Address space and memory space split into groups of 1k words
Page 0
Page 1
Block 0
Block 1
Page 4
Block 3
space
Page 5
M = 4K = 2^12
Page 6
Page 7
Block 2
Memory
Virtual Memory
The programs are also considered to be split
into pages. Portions of programs are moved
from auxiliary memory to main memory in
records of equal size of a page. The term
page-frame is some times used to denote a
block.
Consider a computer with an address space of
8k and memory space of 4k. If we split each
into groups of 1k words we obtain eight pages
and four blocks as shown in figure.
Virtual Memory
The mapping from address space to memory space is
facilitated if each virtual address is considered to be
represented by two numbers:
A page number address and line within the page
In the example of above figure, a virtual address has 13
bits since each page consists of 2^10 =1024 words,
the high order three bits of a virtual address will
specify one of the eight pages and the lower order 10
bits give the line address within the page.
At any time, up to four pages of address space may
reside in main memory in any one of the four blocks.
The organization of memory mapping table in a paged
system is shown in figure below.
Virtual address
Presence bit
Main memory
Block 0
11
Block 1
00
Table Address
0
1
010101001
1
Virtual
Memory
0
100
0
011
Block 2
Block 3
Fig:
01
1 table in a paged system
101 Memory
110
10
111
Memory page table
01
MBR
Virtual Memory
The memory page table consists of eight words; one for
each page. The address in the page table denotes the
page number and the content of the word gives the block
number where that page is stored in main memory.
The table shows that pages 1,2,5 and 6 are now available in
main memory in blocks 3,0,1 and 2 respectively.
A presence bit in each location indicates whether the page
has been transferred from auxiliary memory into main
memory.
A 0 in the presence bit indicates that this page is not
available in main memory.
The CPU references a word in memory with a virtual address
of 13 bits. Three high order bits of the virtual address
specify a page number and also an address for the
memory page table.
Virtual Memory
The line number from the virtual address is transferred
into the 10 low-order bits of the memory address
register.
Associative Memory Page Table:
A more efficient way to organize the page table would
be to construct it with a number of words equal to the
number of blocks in main memory.
This method can be implemented by means of an
associative memory with each word in memory
containing page number together with its
corresponding block number.
Virtual Memory
Virtual Address
Page no
1
1
0
0
1
1
1
Line Number
0
001
11
010
00
101
01
110
10
Page No
Block No
Key Register
Associative Memory
Argument Register
Virtual Memory
Each entry in the associative memory array consists of two
fields. The first three bits specify a field for storing the page
number.
The last two bits consists a field for storing the block number
The virtual address is placed in the argument register. The
page number bits in the argument register are compared
with all page numbers in the page field of the associative
memory.
If the page number is found, the 5bit word is read out from
memory. The corresponding block number, being in the
same word, is transferred to the main memory address
register.
If no match occurs, a call to the operating system is generated
to bring the required page from auxiliary memory.
Page Replacement
Page Replacement
Page Replacement