Wednesday, December 16, 2009

Operating Systems

Assume tht a MM with only 4 pages ,each of 16 bytes,is initially empty.the cpu generates the following sequence of virtual addresses & uses the lru replacement policy.
0 ,4,8,20,24,36,44,12,68,72,80,28,32,88,92
How many page faults?Wht r the page no of the pages pages present in the MM at the end of the sequence.
plz anybody solve this.

solution:- 7 page faults with 1,2,4,5 at the end.......
each page size is 16 bytes..so, these virtual addresses are divided by 16 and so we get as 0 0 0 1 1 2 2 0 4 4 5 5 1 2 5 5 ............. with lru replacement statergy, we will get as 7 page faults.... with 2,5,1,4 at the end.......

Go Back N Protocol

Sorry i have posted that picture in rapidshare which i guess is not working regarding that go back n protocol

here is the situation

Monday, December 14, 2009

Question Number 18 Gate 2009

#include
int fun(int n,int *fp)
{
int t,f;
if(n<=1)
{
*fp=1;
return 1;
}
t=fun(n-1,fp);
f=t+*fp;
*fp=t;
return f;
}
int main()
{
int x=15;
printf("%d", fun(5,&x));
return 0;
}

i hope these pictures give a clear idea of the question