When an virtual machine is running in the background, the VDD must trap all the video I/O, saving the output values and emulating input values as needed. The VDD must also install a page fault hook procedure so that it can detect attempts to read from or write to video memory. The hook procedure must check the current display focus, and examine the virtual machine's virtual controller state to determine how to map the accessed memory. The hook procedure can also be used to demand page the video memory, restoring and mapping the video pages when they are needed to create the physical display.