I have a 2 way associative cache that stores 2 bytes of data in each cache line.

issuing the following sequential write commands:

address | data

xxxx11011 | 1
yyyy11010 | 2
zzzz11011 | 3

What will be the state of the cache?

I think it will be this:

column 1
tag | index | data
zzzz | 1101 | 0x0300

column 2
tag | index | data
yyyy | 1101 | 0x0002

link|improve this question
feedback

2 Answers

up vote 2 down vote accepted

There are many possibilities. It depends on what the cache is made for. For a database like google, it will store the "most used" records. On a small sequential audio-buffer the cache will work as FIFO (first in first out). For sending data tought serial port it could be recommended to use LIFO.

Here are some small informations: Cache methodes

Regards

link|improve this answer
cache methods are somewhat related but the question is about something else. I'll close it, because I don't seem to be able to rephrase into something understandable. +1 nonetheless – yas4891 Jun 27 '11 at 15:33
Hmm. I am really sorry. Perhaps you was right to change into the German room. Perhaps you are that kind to try it again in German here? – Nasenbaer Jun 29 '11 at 13:19
feedback

First, you have selected the wrong answer as the solution. cache replacement policies are important, but not in this specific example. Second, you should let us know the number of entries in the case, so that we can answer this question correctly. Third, index is not stored in caches at all. tag, data, coherence bits, replacement bits are stored (and a few other bits, depending on implementation). Fourth, there is no terminology called column. we call it "way". Now the answer of your question: I assume that there are 2^5=32 entries in the cache. In this case this is what we get:

....             way-1               way-2
in entry #11010: tag: yyyy, data: 2; old tag and data
in entry #11011: tag: xxxx, data: 1; tag: zzzz, data: 3
....

Please note that content of ways are interchangeable. So what I mean is that

....             way-1               way-2
in entry #11010: tag: yyyy, data: 2; old tag and data
in entry #11011: tag: zzzz, data: 3; tag: xxxx, data: 1
....

is also correct.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.