Deprecated: Implicit conversion from float-string "1547042999.090" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 796

Deprecated: Implicit conversion from float-string "1547042999.090" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 801

Deprecated: Implicit conversion from float-string "1547042999.090" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 802

Deprecated: Implicit conversion from float-string "1547042999.090" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 803

Deprecated: Implicit conversion from float-string "1547042999.090" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 594
CO and Architecture: Test Series
retagged by
762 views
2 votes
2 votes
Consider a 4-way set associative cache that has 8-lines, with perfect LRU cache replacement and supports a block size of 16-bytes. For the following memory access pattern (shown as byte addresses), find the hit ratio?
3, 5, 6, 21, 32, 14, 5, 10, 11, 12
retagged by

2 Answers

Best answer
3 votes
3 votes
**Edit :

Cache block size is 16 byte i.e. in one access cache is fetching 15 more addresses next to that request.

1st request is 3. Miss !  cache will fecth from 0 to 15 in one access.

now addresses 5,6 are hit.

request 21 is again miss. So it will fetch from 16 to 31.

again miss for 32.

Next all requests will be in cache so all are hit.

 

Hit ratio = 7/10 =0.70
selected by
0 votes
0 votes

Each address is divided as: [TAG bits] [SET bits] [BLOCK OFFSET bits]

Here, BLOCK OFFSET = 16 bytes => 4 bits

SET = 8 lines / 4 = 2 sets => 1 bit

Remaining => TAG bits

Replacement happens in the SET :

So, address having 5th bit from right which is SET bit as 0 goes to 1st SET, otherwise 2nd SET.

Eg: 3 = 000011 => SET0  and 21 = 010101 => SET1

 

SET0

3 => 14 => 12

5 (hit)
6 => 10
32 => 11

 

SET1
21
 
 
 

 

HIT ratio = 1/10 = 0.1

Related questions


Deprecated: Implicit conversion from float-string "1707099142.871" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 796

Deprecated: Implicit conversion from float-string "1707099142.871" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 801

Deprecated: Implicit conversion from float-string "1707099142.871" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 802

Deprecated: Implicit conversion from float-string "1707099142.871" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 803

Deprecated: Implicit conversion from float-string "1706409304.645" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 796

Deprecated: Implicit conversion from float-string "1706409304.645" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 801

Deprecated: Implicit conversion from float-string "1706409304.645" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 802

Deprecated: Implicit conversion from float-string "1706409304.645" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 803

Deprecated: Implicit conversion from float-string "1705800085.548" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 796

Deprecated: Implicit conversion from float-string "1705800085.548" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 801

Deprecated: Implicit conversion from float-string "1705800085.548" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 802

Deprecated: Implicit conversion from float-string "1705800085.548" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 803

Deprecated: Implicit conversion from float-string "1705800016.832" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 796

Deprecated: Implicit conversion from float-string "1705800016.832" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 801

Deprecated: Implicit conversion from float-string "1705800016.832" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 802

Deprecated: Implicit conversion from float-string "1705800016.832" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 803
398
views
1 answers
4 votes
GO Classes asked Feb 5
398 views
Consider the cache of size 512 bytes that is direct-mapped?Suppose the size of integer is 4 bytes and block size is 16 bytes. Assume cache is initially empty and all data...
726
views
1 answers
6 votes
GO Classes asked Jan 28
726 views
Assume a cache memory with the following properties:The cache size $\text{(C)}$ is 512 bytes (contains $512$ data bytes)The cache uses an LRU (least recently used) policy...
505
views
2 answers
3 votes
GO Classes asked Jan 21
505 views
Suppose we have a four-way set associative physically addressed cache of size $256 \mathrm{KB}$ and $\text{16B}$ blocks, on a machine that uses $32$-bit physical addresse...
815
views
1 answers
8 votes
GO Classes asked Jan 21
815 views
A computer has a $32$-bit address bus with a direct mapped cache, using $4$ bits for block offset, $16$ tag bits, and $12$ index bits.Which of the following address pairs...