Questions 2 : Assume there are three small caches, each consisting of four one-word blocks. On cache is direct-mapped, a second is two-way set-associative, and the third is fully associative. Find the number of hits for each cache organization given the following sequence of block addresses: 0, 8, 6, 5, 10, 15 and 8 are accessed twice in the same sequence. Make a tabular column as given below to show the cache content on each of columns as required. Show all the pass independently pass. Draw as many numbers Assume the writing policy is LRU. Memory location Hit/Mis Add as many columns as required

 Answer:

Sequence of Block Addresses:

0, 8, 6, 5, 10, 15, 8 (accessed twice in the same sequence)

Cache Configurations:

  1. Direct-Mapped Cache: 4 blocks
  2. Two-Way Set-Associative Cache: 2 sets with 2 blocks each
  3. Fully Associative Cache: 4 blocks

Simulation:

Direct-Mapped Cache:

AccessAddressIndexCache ContentHit/Miss
1000Miss
2808Miss
3628, 6Miss
4518, 6, 5Miss
51028, 10, 5Miss
61538, 10, 5, 15Miss
7808, 10, 5, 15Hit
8000, 10, 5, 15Miss
9808, 10, 5, 15Miss
10628, 6, 5, 15Miss
11518, 6, 5, 15Hit
121028, 10, 5, 15Miss
131538, 10, 5, 15Hit
14808, 10, 5, 15Hit

Direct-Mapped Cache Hits: 3

Two-Way Set-Associative Cache:

AccessAddressIndexSet ContentHit/Miss
100(0, -)Miss
280(0, 8)Miss
361(0, 8), (6, -)Miss
451(0, 8), (6, 5)Miss
5100(10, 8), (6, 5)Miss
6151(10, 8), (6, 15)Miss
780(10, 8), (6, 15)Hit
800(0, 8), (6, 15)Miss
980(0, 8), (6, 15)Hit
1061(0, 8), (6, 15)Hit
1151(0, 8), (5, 15)Miss
12100(10, 8), (5, 15)Miss
13151(10, 8), (5, 15)Hit
1480(10, 8), (5, 15)Hit

Two-Way Set-Associative Cache Hits: 5

Fully Associative Cache:

AccessAddressCache ContentHit/Miss
100Miss
280, 8Miss
360, 8, 6Miss
450, 8, 6, 5Miss
5108, 6, 5, 10Miss
6156, 5, 10, 15Miss
785, 10, 15, 8Miss
8010, 15, 8, 0Miss
9815, 8, 0Hit
1068, 0, 6Miss
1150, 6, 5Miss
12106, 5, 10Miss
13155, 10, 15Miss
14810, 15, 8Miss

Fully Associative Cache Hits: 1

Summary of Hits:

  • Direct-Mapped Cache Hits: 3
  • Two-Way Set-Associative Cache Hits: 5
  • Fully Associative Cache Hits: 1

Here is the summary table for the cache contents and hits/misses for each access:

AccessAddressDirect-Mapped CacheHit/MissTwo-Way Set-Associative CacheHit/MissFully Associative CacheHit/Miss
100Miss(0, -)Miss0Miss
288Miss(0, 8)Miss0, 8Miss
368, 6Miss(0, 8), (6, -)Miss0, 8, 6Miss
458, 6, 5Miss(0, 8), (6, 5)Miss0, 8, 6, 5Miss
5108, 10, 5Miss(10, 8), (6, 5)Miss8, 6, 5, 10Miss
6158, 10, 5, 15Miss(10, 8), (6, 15)Miss6, 5, 10, 15Miss
788, 10, 5, 15Hit(10, 8), (6, 15)Hit5, 10, 15, 8Miss
800, 10, 5, 15Miss(0, 8), (6, 15)Miss10, 15, 8, 0Miss
988, 10, 5, 15Miss(0, 8), (6, 15)Hit15, 8, 0Hit
1068, 6, 5, 15Miss(0, 8), (6, 15)Hit8, 0, 6Miss
1158, 6, 5, 15Hit(0, 8), (5, 15)Miss0, 6, 5Miss
12108, 10, 5, 15Miss(10, 8), (5, 15)Miss6, 5, 10Miss
13158, 10, 5, 15Hit(10, 8), (5, 15)Hit5, 10, 15Miss
1488, 10, 5, 15Hit(10, 8), (5, 15)Hit10, 15, 8Miss
  • Direct-Mapped Cache Hits: 3
  • Two-Way Set-Associative Cache Hits: 5
  • Fully Associative Cache Hits: 1

Comments

Popular posts from this blog

Quetion 6 : Consider the "in-order-issue/in-order-completion" execution sequence shown in f In Figure Decode OWE Execute 12 12 12 14 16 13 16 13 15 15 16 Write 024/06/02 11 3 4 11 12 13 13 N 15 16 a. Identify the most likely reason why I could not enter the execute fourth cycle. stage until the [2] b. Will "in-order issue/out-of-order completion" or "out-of-order issue/out-of-order completion" fix this? If so, which? Explain

7.Write a program to read a list containing item name, item code and cost interactively and produce a three-column output as shown below. NAME CODE COST Turbo C++ 1001 250.95 C Primer 905 95.70 ------------- ------- ---------- ------------- ------- ---------- Note that the name and code are left-justified and the cost is right-justified with a precision of two digits. Trailing zeros are shown.