Computer Science, asked by ianujramola, 8 months ago

how does a
two-way set associative cache mapping
scheme work​

Answers

Answered by Anonymous
3

Answer:

Explanation:

Each set contains two ways or degrees of associativity. Each way consists of a data block and the valid and tag bits. The cache reads blocks from both ways in the selected set and checks the tags and valid bits for a hit. If a hit occurs in one of the ways, a multiplexer selects data from that way.

Answered by shlokbhandwalkar
1

Consider a two-way set-associative cache. We can store a single bit, B, in the set to indicate which line was last used. Call the two lines in the set L0 and L1. Then, when L0 is accessed, bit B is set to 1, else it is set to 0. The bit thus indicates which line was most/least recently accessed. This scheme can be expanded to cope with four-way sets by dividing the four lines into three pairs6. Let there be three LRU bits, B0, B1, and B2. These are all set to 0 when the cache is flushed, and are updated on every cache hit or replacement. Call the four lines in the set, L0, L1, L2, and L3. Divide these four lines into two pairs of lines, pair L01 comprising lines L0 and L1, and pair L23 comprising lines L2 and L3. Let bit B0 indicate whether pair L01 or L23 was last accessed. That is, if either L0 or L1 is accessed, B0 is set to 1, while if either L2 or L3 is accessed, B0 is set to 0. Let bit B1 indicate which line in pair L01 is accessed. That is, if L0 is accessed, B1 is set to 1, else B1 is set to 0. Similarly, bit B2 indicates which line in pair L23 is accessed. That is, if L2 is accessed, B2 is set to 1, else B2 is set to 0.

Similar questions