Demand paging can significantly affect the performance of a computer system.
Generally, the memory access time(ma) ranges from 10 to 200 nanoseconds. Until there are no page faults the memory access time is considered equal to effective access time. In case, a page fault occurs, the relevant page is read from the disk and the desired word is accessed. Let p is the probability of a page fault and nearly to 0 implies as we expect minimum page faults to occur.
The effective access time =
(1-p)*ma + p*page_fault_time
There are three components of page-fault service time-
- Service the page-fault interrupt
- Read in the page
- Restart the process
The first and third tasks can be reduced, with careful coding or adding several hundred instructions. These tasks take from 1 to 100 microseconds each.
The page switch time is close to 8 milliseconds. Therefore, the total paging time is 8 milliseconds.
From the above values
effective access time = (1-p)*(200 microseconds) + p*(8 milliseconds) = (1-p)*200+ p*8000000 = 200 + 7999800*p
From above, we can clearly say the effective access time is directly proportional to the probability of the page fault.
If one access out of 1000 causes a page fault, the effective access time is 8.2 microseconds. The computer will be slowed down by a factor of 40 because of demand paging.
Therefore, it is important to keep the page-fault rate low in a demand paging system. Otherwise, the effective access time increases slowing process execution.