Professional Documents
Culture Documents
Memory Organization 1
Memory Organization 1
Memory Organization 1
bit Data-8
bus
Memory Address Map
Decoder
3210
CS1
CS2
128×8 Data
RD
RAM 1
WR
AD7
CS1
CS2
128×8 Data
RD
RAM 2
WR
AD7
CS1
CS2
128×8 Data
RD
RAM 3
WR
AD7
CS1
CS2
128×8 Data
RD
RAM 4
WR
AD7
CS1
CS2
1-7 128×8 Data
ROM
8
AD9
9
Associative Memory
Associative Memory
Match
register
Input
Associative memory
array and logic M
Read
Write m words
n bits per word
Output
Associative memory of an m word, n cells per word
A1 Aj An
K1 Kj Kn
Word 1 C 11 C 1j C1n M1
Word i C i1 C ij C in Mi
Write
R S Match
F ij To M i
logic
Read
Output
Match logic
Neglect the K bits and compare the argument in A with the bits
stored in the cells of the words.
K1 A1 K2 A2 Kn An
Mi
Read Operation
If only one word may match the unmasked argument field, then
connect output Mi directly to the read line in the same word
,position
If we exclude words having zero content, then all zero output will
indicate that no match occurred and that the searched item is not
available in memory.
Write Operation
Locality of reference
The references to memory at any given interval of time tent to be
contained within a few localized areas in memory.
If the active portions of the program and data are placed in a fast
small memory, the average memory access time can be reduced.
When the CPU refers to memory and finds the word in cache, it
produces a hit. If the word is not found in cache, it counts it as
a miss.
The ratio of the number of hits divided by the total CPU references
to memory (hits + misses) is the hit ratio. The hit ratios of 0.9 and
higher have been reported
Cache Memory
The average memory access time of a computer system can be
improved considerably by use of cache.
The cache is placed between the CPU and main memory. It is the
faster component in the hierarchy and approaches the speed of
CPU components.
· Associative Mapping
· Direct Mapping
· Set – Associative Mapping.
Cache Memory
The main memory needs an address but includes both the tag and
the index bits.
The cache memory requires the index bit only i.e., 9 bits.
There are 2k words in the cache memory & 2n words in the main
memory.
e.g: k = 9, n = 15
Direct Mapping
Direct Mapping
00000
6710
Direct Mapping
.Each word in cache consists of the data word and it associated tag
When a new word is brought into cache, the tag bits store along
data
The tag field of the CPU address is equal to tag in the word from
.cache; there is a hit, otherwise miss
Each tag requires 6 bits & each data word has 12 bits, so the word
length is 2(6+12) =36 bits
When the CPU generates a memory request, the index value of the
address is used to access the cache.
The tag field of the CPU address is compared with both tags in the
cache.
Random replacement ·
FIFO ·
Least Recently Used (LRU) ·
Writing into cache
there are two writing methods that the system can proceed.
This method has 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.
The reason for the write-back method is that during the time a word resides
in the cache, it may be updated several times.
Virtual Memory
33
Execution of a Program
Operating system brings into main
memory a few pieces of the program
Resident set - portion of process that
is in main memory
An interrupt is generated when an
address is needed that is not in main
memory
Operating system places the process
in a blocking state
34
Execution of a Program
Piece of process that contains the
logical address is brought into main
memory
Operating system issues a disk I/O Read
request
Another process is dispatched to run while
the disk I/O takes place
An interrupt is issued when disk I/O
complete which causes the operating
system to place the affected process in
the Ready state
35
Support Needed for
Virtual Memory
Hardware must support paging and
segmentation
Operating system must be able to
management the movement of pages
and/or segments between secondary
memory and main memory
36
Paging
Each process has its own page table
Each page table entry contains the
frame number of the corresponding
page in main memory
A bit is needed to indicate whether the
page is in main memory or not
37
Paging
38
39
Page Tables
The entire page table may take up too
much main memory
Page tables are also stored in virtual
memory
When a process is running, part of its
page table is in main memory
40
Page Table
Page number
Process identifier
Control bits
Chain pointer
41
42
Segmentation
May be unequal, dynamic size
Simplifies handling of growing data
structures
Allows programs to be altered and
recompiled independently
Lends itself to sharing data among
processes
Lends itself to protection
43
Segment Tables
Corresponding segment in main
memory
Each entry contains the length of the
segment
A bit is needed to determine if
segment is already in main memory
Another bit is needed to determine if
the segment has been modified since
it was loaded in main memory 44
Segment Table Entries
45
46
Combined Paging and
Segmentation
Paging is transparent to the
programmer
Segmentation is visible to the
programmer
Each segment is broken into fixed-
size pages
47
Combined Segmentation and
Paging
48
49