Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Minimum Page Frames

What determines the minimum number of page frames that must be allocated to a running process in a virtual memory environment.

I found the the answer to the above question is instruction set architecture but couldn't understand reason behind it.

please explain.

EDIT : The question is on the following link http://www.geeksforgeeks.org/archives/4036 (see question 3), i'm not able to understand the logic behind the answer.

like image 985
Amol Sharma Avatar asked Jun 26 '12 17:06

Amol Sharma


1 Answers

yes ISA does play a role.
Imagine this hypothetical condition if the ISA supports an instruction(like mov in x86) which can take an operand after 3 levels of indirection( recall x86's indirect addressing mode). Lets call this system A.
On another system you can have max of 2 levels of indirection call it B.

On A and B if we give 4 as the minimum number of frames see what happens. B runs fine not A here's the reason:
when an instruction which has 3 level of indirection in its operand is loaded into the cpu for execution, remember we only have 4 frames for this process,assume this scenario
frame 1 will be for the instruction itself.
frame 2 will be for the 1st level of indirection the operand is in another page
frame 3 will be for the 2nd level of indirection maybe this was not in the address range of previously allocated frame.
frame 4 the same happens with the next level of indirection.
Now recall pipeline , only after the operand fetch is done we can go to the next execution stage, but we don't have the final operand we only have the address of where it in the frame 4 , now you get a page fault, so you remove one of the previously allocated frame to process and restart the instruction which caused the fault , but again the same thing happens. The system B doesn't have this problem.

As far as i recall this is the way ISA plays a role in deciding minimum number of frames for a process. Refer galvin i think the book covers this in virtual memory section.
But this is in theory , I don't know how the process is in a real system like linux.

Cheers :)

Edit:- As given in the link you pointed the instruction may cross page boundary

like image 100
Deepthought Avatar answered Oct 10 '22 23:10

Deepthought