519 views
1 votes
1 votes
Consider a binary search algorithm to search an element in array of ‘n’ numbers. Assume that this array spans over multiple pages with each page holding ‘p’ elements (n>p). Every memory access will generate a page fault until the search range is less than ‘p’. The minimum value of ‘p’ that reduces the page fault is

1 Answer

0 votes
0 votes
  1.   n
    Explanation:
    We have n elements and a page can hold p elements. So, we will have n/p pages to store elements and binary search takes log(n/p) memory accesses. 
    Each memory access creates a page faults. So we have log(n/p) page faults. 
    To minimize page faults partial differentiate it with p and n then equate it to zero. 
    We get p=n or to minimize p value use the method below:
    The minimum value of page fault would be zero (ideal) then if we put p=n then we get log(n/p) = log(n/n) = log1=0.

Related questions

0 votes
0 votes
0 answers
2
vaishali jhalani asked Nov 28, 2016
801 views
By incresing the page size..page fault inscreases as the number of frames decreases and also page fault may decreases due to spatial locality..Then How to decide about pa...
0 votes
0 votes
1 answer
3
Prashant Sharma asked Sep 24, 2015
285 views
The given ans is 9. I don't get it .
0 votes
0 votes
1 answer
4
sampad asked Oct 4, 2015
2,065 views
A process having access to f frames(initially all empty) makes m memory accesses to p distinct pages.What are the max and min. no. of page faults that will occur?