Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help answering questions about cache #includestdio.h> #includestdlib.h> #include #define OFFSET BITS (6) #define SET-INDEX-BITS (5) #define TAG-BITS (64-OFFSET-BITS-SET-INDEX-BITS) #define NWAYS (8) // 64 bytes

Need help answering questions about cache

image text in transcribed

#includestdio.h> #includestdlib.h> #include #define OFFSET BITS (6) #define SET-INDEX-BITS (5) #define TAG-BITS (64-OFFSET-BITS-SET-INDEX-BITS) #define NWAYS (8) // 64 bytes cache line /1 32 sets // // 8 ways cache. void questions () unsigned answer0; Suppose a machine has a n-way set associative cache. // The characteristics of the cache are defined in line 5-8. // 1) How many bytes of cache does this machine have? answer 0 print f ("Q1: %u ", answer); // 2) For an address 0x40000100, what is the cache set for the address? / Note that the index for the first set is 0, so the answer should /be a number within 0-31 answer0; printf("Q2: %u ", answer); // 3) For an address 0x4000011F, what is the cache set for the address? / Note that the index for the first set is 0, so the answer should /be a number within 0-31. answer = 0; printf("Q3: %u ", answer); 4) Assume that the cache is empty in the begining. After following // addresses are accessed in order, how many cache lines are used /I (to store data) in set 0 11 0x40000100 11 0x40000104 11 0x40000188 /1 0x40000004 11 0x40000008 1 0x80000100 1 0x80000104 11 0x80000004 11 0x80000008 answer E0; printf("Q4: %u ", answer); #includestdio.h> #includestdlib.h> #include #define OFFSET BITS (6) #define SET-INDEX-BITS (5) #define TAG-BITS (64-OFFSET-BITS-SET-INDEX-BITS) #define NWAYS (8) // 64 bytes cache line /1 32 sets // // 8 ways cache. void questions () unsigned answer0; Suppose a machine has a n-way set associative cache. // The characteristics of the cache are defined in line 5-8. // 1) How many bytes of cache does this machine have? answer 0 print f ("Q1: %u ", answer); // 2) For an address 0x40000100, what is the cache set for the address? / Note that the index for the first set is 0, so the answer should /be a number within 0-31 answer0; printf("Q2: %u ", answer); // 3) For an address 0x4000011F, what is the cache set for the address? / Note that the index for the first set is 0, so the answer should /be a number within 0-31. answer = 0; printf("Q3: %u ", answer); 4) Assume that the cache is empty in the begining. After following // addresses are accessed in order, how many cache lines are used /I (to store data) in set 0 11 0x40000100 11 0x40000104 11 0x40000188 /1 0x40000004 11 0x40000008 1 0x80000100 1 0x80000104 11 0x80000004 11 0x80000008 answer E0; printf("Q4: %u ", answer)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Internals A Deep Dive Into How Distributed Data Systems Work

Authors: Alex Petrov

1st Edition

1492040347, 978-1492040347

More Books

Students also viewed these Databases questions