Click to See Complete Forum and Search --> : a mind boggling query.........


mudit
February 12th, 2003, 11:43 PM
hello all
i am bit confused to see the results of following piece of code
please help me out.......
i executed following piece of code to see the devastating effect of
pagefaults on a process

void main()
{
int i;
int *arr;
int * arr1,*arr2;
char ch;
arr= new int[5000000];
for(i=0;i<5000000;i++)
arr[i]=0;
arr1= new int[5000000];
for(i=0;i<5000000;i++)
arr1[i]=0;
arr2=new int[5000000];
for(i=0;i<5000000;i++)
arr2[i]=0;
}


as per my calcultions
each array will take around (5000000*4)/4096 pages on winnt
i.e. around 4883 pages.
to my knowledge avg page fault service time is 25ms that means
4883*25=1220.75 secs (atleast) for execution of each array as each location is referred only once.
so this process should take considerable amount of time to execute but to my surprise it was too fast. why?????????
waitin for reply
thanks n regds
mudit

mudit
February 12th, 2003, 11:56 PM
sorry some mistake in my previous calculation
time for loading data for each array 4883*25=122.075 secs
that means process should take atleast 3*122 = 366 secs atleast
for 3 arrays where as the process actually takes just around 15 secs
thanks n regds
mudit