TuxOnIce development has been sponsored by:

Redhat

Cyclades

LinuxFund

LACLinux

Open Source Development Labs

at-mirror
hosted by

gaugusch.at
Next Previous Contents

6. How it works

For the more curious users, briefly listed here are the steps of the kernel part of the hibernation process. This may also help in tracking why it doesn't hibernate.

  1. Stop all processes. If some processes can't be stopped, abort.
  2. Eat memory. At this stage we check if we have enough memory to save the image and meet your specifications for maximum image size. If necessary, we unfreeze the processes, eat memory until we think we have enough and then try again from step 1.
  3. Suspend drivers. This accounts for the screen briefly going blank on some computers.
  4. Prepare a directory of pages and save it along with the image. This is done in two parts. First, all of the pages we know aren't needed for hibernation (ie, not buffer & page caches) are saved, being very careful not to have a lasting impact on the image we're making. Then, an atomic copy is made of the remaining pages (kernel & process space) using the memory just saved and any other free RAM. This copy is then saved. Finally, we save the page directory for the latter set of pages separately and also store the page directory's location in the swap header. We can then (if your computer supports it) power down.

Resuming is essentially the reverse of this process. The pagedir is loaded, as is the copy (being careful not to use RAM we're about to overwrite). Then we copy the old kernel back and restore registers. We are now running with the original kernel image. Finally, we load the first set of pages we saved, clean up and exit.


Next Previous Contents
Last updated: Thu, 08 Jan 2009 10:22:34 +0800

Frozen penguins image by darkmetal
and adapted by Nigel Cunningham
"Tuxsicle" artwork by Pierre-Philippe Coupard

Copyright © 2003-2005 Bernard B