Reputation: 373
I found this problem in an OS past paper and I need some help in figuring it out. You are given:
P1
and P2
, that fit, on their own and together, in one page; the programs are: P1:
for(i=0; i<10; i++)
for(j=0; j<10; j++)
A[i][j]=0;
P2:
for(j=0; j<10; j++)
for(i=0; i<10; i++)
A[i][j]=0;
The question is: How many pages does each program occupy and which one is more efficient given that we are using the LRU algorithm?
I know how the LRU algorithm works and my guess would be that P1
is more efficient because the matrix is stored contiguously by lines. But I don't understand where LRU fits in this logic (please correct me if my reasoning is wrong). Concerning the number of pages that each program occupies, we've never covered that in class. Can someone help me?
If it helps, the answer options are:
P1
and P2
occupy 11 pages each and P1
is more efficientP1
and P2
occupy 11 pages each and P2
is more efficientP1
and P2
occupy 100 pages each and P2
is more efficientP1
and P2
occupy 10 pages each and P1
is more efficientP1
and P2
occupy 10 pages each and P2
is more efficientAlso, I have a feeling this question is "inspired" by this problem in Operating System Concepts Essentials (maybe it could provide some context):
Upvotes: 0
Views: 136