Lecture 17 COA
Lecture 17 COA
Lecture 17
Subject Coordinator
Dr. Gagan Vishwakarma
Department of Computer Science and Engineering
E-Mail ID: gagan@iiitbhopal.ac.in
Google Scholar ID: https://scholar.google.com/citations?user=X7IFJGMAAAAJ&hl=en
Scopus ID: https://www.scopus.com/authid/detail.uri?authorId=57200601924
Orchid ID: https://orcid.org/0000-0002-3308-8438
Subject Coordinator: Dr. Gagan Vishwakarma Semester: IV - CSE 222 Compter Organization & Architecture 2
25-04-2024
Write-through
Subject Coordinator: Dr. Gagan Vishwakarma Semester: IV - CSE 222 Compter Organization & Architecture 3
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;
• however, as long as the word remains in the cache, it does not matter
whether the copy in main memory is out of date, since requests from
the word are filled from the cache.
• It is only when the word is displaced from the cache that an accurate
copy need be rewritten into main memory.
Subject Coordinator: Dr. Gagan Vishwakarma Semester: IV - CSE 222 Compter Organization & Architecture 4
25-04-2024
Cache Initialization
• The cache is initialized when power is applied to the computer or
when the main memory is loaded with a complete set of programs
from auxiliary memory.
• After initialization the cache is considered to be empty, but in effect it
contains some nonvalid data.
• Each word in cache included a valid bit to indicate whether or not the
word contains valid data.
• Now The cache is initialized by clearing all the valid bits to 0.
Subject Coordinator: Dr. Gagan Vishwakarma Semester: IV - CSE 222 Compter Organization & Architecture 5
Valid Bit
• The valid bit of a particular cache word is set to 1 the first time this
word is loaded from main memory and stays set unless the cache has
to be initialized again.
• The introduction of the valid bit means that a word in cache is not
replaced by another word unless the valid bit is set to 1 and a
mismatch of tags occurs.
• If the valid bit 0, the new word automatically replaces the invalid
data.
• Thus the initialization condition has the effect of forcing misses from
the cache until it fills with valid data.
Subject Coordinator: Dr. Gagan Vishwakarma Semester: IV - CSE 222 Compter Organization & Architecture 6