Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  A CPU has a 32 KB direct mapped cache with 12... Start Learning for Free
A CPU has a 32 KB direct mapped cache with 128 byte-block size. Suppose A is two dimensional array of size with elements that occupy 8-bytes each. Consider the following two C code segments, P1 and P2.
P1:
for (i=0; i<512; i++)
{
for (j=0; j<512; j++)
{
x +=A[i] [j];
}
}
P2:
for (i=0; i<512; i++)
{
for (j=0; j<512; j++)
{
x +=A[j] [i];
}
}
P1 and P2 are executed independently with the same initial state, namely, the array A is not in the cache and i, j, x are in
registers. Let the number of cache misses experienced by P1 be M1 and that for P2 be M2.
The value of the ratio 
  • a)
    0
  • b)
    1/16
  • c)
    1/8
  • d)
    16
Correct answer is option 'B'. Can you explain this answer?
Verified Answer
A CPU has a 32 KB direct mapped cache with 128 byte-block size. Suppos...
Number of Cache Lines

In 1 Cache Line
 
P

P2

    
It is so because for
P1 for every line there is a miss, and once a miss is processed we get 16 elements in memory. So another miss happens after 16 elements.
for
P2 for every element there is a miss coz storage is row major order(by default) and we are accessing column wise.
Hence, answer = option B
View all questions of this test
Explore Courses for Computer Science Engineering (CSE) exam

Similar Computer Science Engineering (CSE) Doubts

Top Courses for Computer Science Engineering (CSE)

A CPU has a 32 KB direct mapped cache with 128 byte-block size. Suppose A is two dimensional array of size with elements that occupy 8-bytes each. Consider the following two C code segments, P1 and P2.P1:for (i=0; i<512; i++){for (j=0; j<512; j++){x +=A[i] [j];}}P2:for (i=0; i<512; i++){for (j=0; j<512; j++){x +=A[j] [i];}}P1 and P2 are executed independently with the same initial state, namely, the array A is not in the cache and i, j, x are inregisters. Let the number of cache misses experienced by P1 be M1 and that for P2 be M2.The value of the ratio a)0b)1/16c)1/8d)16Correct answer is option 'B'. Can you explain this answer?
Question Description
A CPU has a 32 KB direct mapped cache with 128 byte-block size. Suppose A is two dimensional array of size with elements that occupy 8-bytes each. Consider the following two C code segments, P1 and P2.P1:for (i=0; i<512; i++){for (j=0; j<512; j++){x +=A[i] [j];}}P2:for (i=0; i<512; i++){for (j=0; j<512; j++){x +=A[j] [i];}}P1 and P2 are executed independently with the same initial state, namely, the array A is not in the cache and i, j, x are inregisters. Let the number of cache misses experienced by P1 be M1 and that for P2 be M2.The value of the ratio a)0b)1/16c)1/8d)16Correct answer is option 'B'. Can you explain this answer? for Computer Science Engineering (CSE) 2024 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about A CPU has a 32 KB direct mapped cache with 128 byte-block size. Suppose A is two dimensional array of size with elements that occupy 8-bytes each. Consider the following two C code segments, P1 and P2.P1:for (i=0; i<512; i++){for (j=0; j<512; j++){x +=A[i] [j];}}P2:for (i=0; i<512; i++){for (j=0; j<512; j++){x +=A[j] [i];}}P1 and P2 are executed independently with the same initial state, namely, the array A is not in the cache and i, j, x are inregisters. Let the number of cache misses experienced by P1 be M1 and that for P2 be M2.The value of the ratio a)0b)1/16c)1/8d)16Correct answer is option 'B'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for A CPU has a 32 KB direct mapped cache with 128 byte-block size. Suppose A is two dimensional array of size with elements that occupy 8-bytes each. Consider the following two C code segments, P1 and P2.P1:for (i=0; i<512; i++){for (j=0; j<512; j++){x +=A[i] [j];}}P2:for (i=0; i<512; i++){for (j=0; j<512; j++){x +=A[j] [i];}}P1 and P2 are executed independently with the same initial state, namely, the array A is not in the cache and i, j, x are inregisters. Let the number of cache misses experienced by P1 be M1 and that for P2 be M2.The value of the ratio a)0b)1/16c)1/8d)16Correct answer is option 'B'. Can you explain this answer?.
Solutions for A CPU has a 32 KB direct mapped cache with 128 byte-block size. Suppose A is two dimensional array of size with elements that occupy 8-bytes each. Consider the following two C code segments, P1 and P2.P1:for (i=0; i<512; i++){for (j=0; j<512; j++){x +=A[i] [j];}}P2:for (i=0; i<512; i++){for (j=0; j<512; j++){x +=A[j] [i];}}P1 and P2 are executed independently with the same initial state, namely, the array A is not in the cache and i, j, x are inregisters. Let the number of cache misses experienced by P1 be M1 and that for P2 be M2.The value of the ratio a)0b)1/16c)1/8d)16Correct answer is option 'B'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of A CPU has a 32 KB direct mapped cache with 128 byte-block size. Suppose A is two dimensional array of size with elements that occupy 8-bytes each. Consider the following two C code segments, P1 and P2.P1:for (i=0; i<512; i++){for (j=0; j<512; j++){x +=A[i] [j];}}P2:for (i=0; i<512; i++){for (j=0; j<512; j++){x +=A[j] [i];}}P1 and P2 are executed independently with the same initial state, namely, the array A is not in the cache and i, j, x are inregisters. Let the number of cache misses experienced by P1 be M1 and that for P2 be M2.The value of the ratio a)0b)1/16c)1/8d)16Correct answer is option 'B'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of A CPU has a 32 KB direct mapped cache with 128 byte-block size. Suppose A is two dimensional array of size with elements that occupy 8-bytes each. Consider the following two C code segments, P1 and P2.P1:for (i=0; i<512; i++){for (j=0; j<512; j++){x +=A[i] [j];}}P2:for (i=0; i<512; i++){for (j=0; j<512; j++){x +=A[j] [i];}}P1 and P2 are executed independently with the same initial state, namely, the array A is not in the cache and i, j, x are inregisters. Let the number of cache misses experienced by P1 be M1 and that for P2 be M2.The value of the ratio a)0b)1/16c)1/8d)16Correct answer is option 'B'. Can you explain this answer?, a detailed solution for A CPU has a 32 KB direct mapped cache with 128 byte-block size. Suppose A is two dimensional array of size with elements that occupy 8-bytes each. Consider the following two C code segments, P1 and P2.P1:for (i=0; i<512; i++){for (j=0; j<512; j++){x +=A[i] [j];}}P2:for (i=0; i<512; i++){for (j=0; j<512; j++){x +=A[j] [i];}}P1 and P2 are executed independently with the same initial state, namely, the array A is not in the cache and i, j, x are inregisters. Let the number of cache misses experienced by P1 be M1 and that for P2 be M2.The value of the ratio a)0b)1/16c)1/8d)16Correct answer is option 'B'. Can you explain this answer? has been provided alongside types of A CPU has a 32 KB direct mapped cache with 128 byte-block size. Suppose A is two dimensional array of size with elements that occupy 8-bytes each. Consider the following two C code segments, P1 and P2.P1:for (i=0; i<512; i++){for (j=0; j<512; j++){x +=A[i] [j];}}P2:for (i=0; i<512; i++){for (j=0; j<512; j++){x +=A[j] [i];}}P1 and P2 are executed independently with the same initial state, namely, the array A is not in the cache and i, j, x are inregisters. Let the number of cache misses experienced by P1 be M1 and that for P2 be M2.The value of the ratio a)0b)1/16c)1/8d)16Correct answer is option 'B'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice A CPU has a 32 KB direct mapped cache with 128 byte-block size. Suppose A is two dimensional array of size with elements that occupy 8-bytes each. Consider the following two C code segments, P1 and P2.P1:for (i=0; i<512; i++){for (j=0; j<512; j++){x +=A[i] [j];}}P2:for (i=0; i<512; i++){for (j=0; j<512; j++){x +=A[j] [i];}}P1 and P2 are executed independently with the same initial state, namely, the array A is not in the cache and i, j, x are inregisters. Let the number of cache misses experienced by P1 be M1 and that for P2 be M2.The value of the ratio a)0b)1/16c)1/8d)16Correct answer is option 'B'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev