80 likes | 262 Views
Performance of demand paging. Let. be the probability of a page fault . We expect . to be close to zero, that is there will be only. a few page faults. The effective access time is. effective access time. page fault time.
E N D
Performance of demand paging Let be the probability of a page fault We expect to be close to zero, that is there will be only a few page faults. The effective access time is effective access time page fault time To compute the effective access time, we must know how much time is needed to service a page fault. A page fault causes the following sequence to occur:
Trap to the operating system. • Save the user registers and process state. • Determine that the interrupt was a page fault. • Check that the page reference was legal and determine the location of the page on the disk. • Issue a read from the disk to free a frame. • Wait in a queue for this device until the read request is serviced. • Wait for the device seek and / or latency time. • Begin the transfer of the page to a free frame • While waiting, allocate the CPU to some other user (CPU scheduling is optional). • Interrupt from the disk (I/O completed).
Save the registers and process state for the other user (if step 6 executed). • Determine that the interrupt was from the disk. • Correct the page table and other tables to show that the desired page is now in memory. • Wait for the CPU to be allocated to this process again. • Restore the user registers, process state, and new page table, then resume the interrupted instruction.
Note all these steps are necessary in every case. For example, we are assuming that, in step 6, the CPU is allocated to another process while the I/O occurs. This arrangement allows multiprogramming to maintain CPU untilization, but requires additional time to resume the page-fault service routine when the I/O transfer is complete. • In any case, there are major components of the page-fault service time: • Service the page-fault interrupt. • Read in the page • Restart the process.
The first and third tasks may be reduced, with careful coding, to several hundred instructions. They may take from 1 to 100 microseconds each, The page-switch time is close to 24 milliseconds. A typical hard disk has an average latency of 8 milliseconds, a seek of 15 milliseconds, and a transfer time of 1 millisecond. Thus, the total paging time is close to 25 milliseconds, including hardware and software time. We are looking at only the device-service time. If a queue of processes is waiting for the device (other processes that have caused page faults), we have to add device-queueing time as we wait for the paging device to be free to service our request, increasing even more the time to swap.
If we take an average page-fault service time of 25 milliseconds and a memory access time of 100 nanoseconds, then the effective access time in nanoseconds is Effective access time milliseconds We see then that the effective access time is directly proportional to the page-fault rate. If one access out of 1000 causes a page fault, the effective access time is 25 microseconds. The computer would be slowed down by a factor of 250 because of demand paging. If we want less than 10-percent degradation, we need
To keep the slowdown due to paging to a reasonable level, we can allow only less than 1 memory access out of 2,500,000 to page fault.