Virtual Time

The measurement of time always produces a little confusion, but it is easily mastered. When dealing with a virtual memory system, real time is a problem since the program's execution can be interrupted by random page faults, I/O delays, and scheduler time-outs. We want a way of measuring time that is immune to these interruptions. Virtual time is the answer.

Virtual time is defined as the CPU time required to complete a job as if there were no interruptions. This is normally the total CPU time. Since we are dealing with memory allocations, it is convenient to take the unit of time to be the memory reference time. Thus if we say that the CPU executes for virtual time T, we mean that it generated T memory references. Equivalently, we mean that the program's page reference string contains T references. From the standpoint of the model, this means that we can pretend that references occur at times t=1,2,3,...,T.

If we want to convert virtual time to real time, we need to know the amount of real time that one memory reference takes. If this is 0.1 microsecond, for example, the real time is T*0.1 microseconds; a program of 10 million references would thus take 1 million microseconds, or one second, of real CPU time.

In this virtual world, L(m) counts the number of units between faults; if there are f faults in time T, then L(m)=T/f. The fault rate is the inverse of L(m). Do not confuse the fault rate (faults per time unit) with the fault count.

The nice thing about virtual time is that we can operate completely in the virtual time domain while answering performance questions about virtual memory. If we ever need to report the real time, we just multiply by the conversion factor.

There is a nice approximation formula for the space-time used by a program. (Remember that space-time has something to do with performance.) If the program operates with m pages for T virtual units, its space-time would be m*T page-units. If there are f page faults, each one interrupts the program for a time of D (the secondary memory access delay, measured in units), giving an additional amount of space-time m*D*f. Since the number of faults is f = T/L(m), we can collect all this into the formula

Y = m*T*(1 + D/L(m)).

We know from experiment that this approximation can have errors up to 25% or 30%.

--P.J. Denning