0% found this document useful (0 votes)
13 views3 pages

Lecture 17 COA

The document discusses cache organization and memory write operations. It describes two methods for writing to cache - write-through and write-back. It also discusses cache initialization and the use of valid bits.

Uploaded by

John Cena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views3 pages

Lecture 17 COA

The document discusses cache organization and memory write operations. It describes two methods for writing to cache - write-through and write-back. It also discusses cache initialization and the use of valid bits.

Uploaded by

John Cena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

25-04-2024

CSE 222 Computer Organization and Architecture

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

Writing into Cache

• An important aspect of cache organization is concerned with memory


write requests.
• When the CPU finds a word in cache during a read operation, the
main memory is not involved in the transfer.
• However, if the operation is a write, there are two ways that the
system can proceed.

Subject Coordinator: Dr. Gagan Vishwakarma Semester: IV - CSE 222 Compter Organization & Architecture 2
25-04-2024

Write-through

• The simplest and most 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 is called the write-through method.
• This method has the advantage that main memory always contains
the same data as the cache.

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

You might also like