CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2002
    Location
    india
    Posts
    6

    a mind boggling query.........

    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

  2. #2
    Join Date
    Feb 2002
    Location
    india
    Posts
    6
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured