MadeEasy Test Series: Operating System - Page Replacement

1 vote
597 views
Consider a demand paged memory system, page table is held in registers. It takes 800 nsec to service a page fault if empty page is available or replaced page is not modified and 950 nsec if the replaced page is modified, main memory access time is 120 nsec. If page to be replaced is modified 85% of time and page faultrate is 20% then average memory access time is ________. (Upto 1 decimal place)

edited
0
I am getting the answer to be 305.5 but the test shows the answer 281.5
0
me too getting 305,5
0
I am also getting 305.5

1 vote

0.2*(0.85*950+0.15*800)+0.8*120

=0.2(807.5+120)+0.8*120

=185.5+96

=281.5

0.85*950 since 85% time page to be replaced is modified.

selected
1

The same solution is available in the test series but my doubt is, in page fault why didn't you add the memory access time?

Isn't the formula like this:

P*( Page fault service time + Memory access time ) + (1-P)( Memory access time )

If there is no page fault then we can get it directly from memory but if there is page fault then we have to service the page fault looking if modified or not then we have to eventually access it from the memory.

0
I guess you are confusing page fault with cache access time
0

#source: Galvin

0

When there is no page fault means that page is present in the main memory itself and we don't have to do anything, but if there is a page fault then it means first we are accessing the main memory to know that the page is not present there and then we have to bring that page from the disk which the page fault service time. Correct me if I am wrong here.

1
Thanks for clearing my doubt, actually most of the question that I was solving I didn't give any attention to the difference between page fault service time and additional service time. When it says additional then we have to add the memory access time, otherwise just the page fault service time.
1
We don't go through the entire main memory.We just check the page table for valid or invalid bit which tells us whether the page is present or there is a page fault
1

@jhaanuj2108 you are right,formula will be,EMAT =P*( Page fault service time + Memory access time ) + (1-P)( Memory access time ).  page fault service time is much much greater than memory access time generally page fault service time is considered in milliseconds and memory access time considered in nanosecond ,in this case we can ignore Memory access time in comparison to  Page fault service time. in Galvin ,memory access time is not considered because of above reason but in above question both are comparable so we can't ignore that.page fault service time does not include memory access time .There are three major components of the page fault service time-(1) service the page fault interrupt (2) read in the page (3) restart the process (according to Galvin).after it we have to access memory again for getting required page.

0

@Prateek Raghuvanshi

Are u sure?

0
yeah absolutely
0
Tats means key by test series is wrong.rgt?
0

@Arjun sir, please clear the confusion

which one is the correct formula

P*( Page fault service time + Memory access time ) + (1-P)( Memory access time )

or

P*( Page fault service time ) + (1-P)( Memory access time )

0

Can you explain why don't you add the memory access time in page service time?

P*( Page fault service time + Memory access time ) + (1-P)( Memory access time )

is this formula wrong for average memory access time?

0
i saw sachin mittal sir comment and he said that in the page fault service time we assume the memory access time has been included
0

@Ashutosh07091999 which comment of Sachin Mittal sir u saw?

1

https://gateoverflow.in/669/gate2000-2-22

see sachin mittal sir comment on this ques

0
obviously wrong solution correction required

Emat = P*( Page fault service time + Memory access time ) + (1-P)( Memory access time )

= P*(Page fault service time) + Memory access time

Page fault service time  = pm(Time taken when page modified) + (1-pm)(Time taken when page not modified)

= 0.85*950 + 0.15*800 = 927.5

Emat = 0.2*927.5+120 = 185.5 + 120 = 305.5

edited

Related questions

1 vote
1
221 views
Consider the two-dimensional array A$:$ int A[ ] [ ] = new int[100][100]; where A[0][0] is at location 200 in a paged memory system with pages of size 200. A small process that manipulates the matrix resides in page 0 (locations 0 to 199). Thus, every instruction fetch will be from ... contains the process and other two are initially empty? for(int j=0;j<100;j++) for(int i=0;i<100;i++) A[i][j]=0;
1 vote