How does increasing the page size affect the number of page faults?

Question Detail: 

If we let the physical memory size remain constant,

  • What effect does the size of the page have on the number of frames?
  • What effect does the number of frames have on the number of page faults?

Also, please provide reference strings as an example.

Asked By : Anil Kumar Muppalla
Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/6813

Answered By : Anil Kumar Muppalla

After careful reading i have come to understand that this is a complex behavior when the page size is doubled the page faults is reduced also when the page size is halved. The replacement algorithm considered is FIFO.

note: page fault is denoted by p and no page fault by n
number of frames = physical memory size / page size

the page size = frame size

Reference string sequence: 1 2 3 4 5 1 2 3 4 5

Condition 1: Initial

physical memory = 400 bytes
page size = 100 bytes
number of frames = 4

1 2 3 4 5 1 2 3 4 5 p p p p p p p p p p 1 1 1 1 5 5 5 5 4 4   2 2 2 2 1 1 1 1 5     3 3 3 3 2 2 2 2       4 4 4 4 3 3 3 

total page fault = 10

Condition 2: When page size is halved

physical memory = 400 bytes
page size = 50 bytes
number of frames = 8

1 2 3 4 5 1 2 3 4 5 p p p p p n n n n n  1 1 1 1 1 1 1 1 1 1   2 2 2 2 2 2 2 2 2     3 3 3 3 3 3 3 3       4 4 4 4 4 4 4         5 5 5 5 5 5 

total page fault = 5 with 3 frames remaining unused.

Condition 1: when the page size is doubled.

physical memory = 400 bytes
page size = 200 bytes
number of frames = 2

Each frame can accommodate more data in one frame, here two original pages can be loaded to the frame at any time.

1 2 3 4 5 1 2 3 4 5 => (1 2) (3 4) (5 1) (2 3) (4 5) => 1 3 5 2 4

1 3 5 2 4 p p p p p  1 1 5 5 4    3 3 2 2 

Total page faults = 5

No comments

Powered by Blogger.