CryoPID - A Process Freezer for Linux
CryoPID allows you to capture the state of a running process in Linux and
save it to a file. This file can then be used to resume the process later on,
either after a reboot or even on another machine.
CryoPID was spawned out of a discussion on the Software suspend mailing list about the
complexities of suspending and resuming individual processes.
CryoPID consists of a program called freeze that captures
the state of a running process and writes it into a file. The file is
self-executing and self-extracting, so to resume a process, you simply run
that file. See the table below for more details on what is supported.
Current features are:
- Can run as an ordinary user! (no root privileges needed)
- Works on both 2.4 and 2.6.
- Works on x86 and AMD64.
- Can start & stop a process multiple times
- Can migrate processes between machines and between kernel versions (tested between 2.4 to 2.6 and 2.6 to 2.4).
Yes, checkpointing software such as this is
nothing new, but I was unable to
find a tool that worked on Linux that did not require at least one of the
following:
- root privileges
- modifications to the kernel
- recompiling/relinking your software
- using an LD_PRELOAD when you start your program.
CryoPID requires none of these and hence can be used as an ordinary user on any
Linux machine running a 2.4 or 2.6 kernel (2.2 untested). This will remain one
of the main design goals of CryoPID.
| Legend: |
| Working |
| Partial |
| Hacky |
| Planned |
| Wontfix |
| Full image of executable |
Yes |
| Dynamically-linked Libraries |
Yes. Can be included in image to resume on a machine with
differing libraries |
| mmap'd memory |
Yes. Both mmap'd files and anonymous mappings can be saved in
the image. |
| Terminal status |
Yes. termios state is captured and restored. |
| Signal handlers |
Yes. |
| Thread-local storage |
Yes. (Note this does not imply threads. It was required for
working with recent glibc's on 2.6 kernels, which setup thread-local storage
for standalone processes). |
| File descriptors |
Open files and offsets are restored. Temporary files that have been unlinked and
are not accessible on the filesystem are always saved in the image. Other
files that do not exist on resume are not yet restored. Support for saving file
contents for such situations is planned. |
| Sockets |
Established TCP connections can be restored if the kernel
supports tcpcp.
In future versions, listening sockets will be rebound, and UDP and UNIX
sockets will be reconnected. |
| X applications |
Support is experimental. Enable USE_GTK=y in the Makefile.
Most bugs with resuming Gtk+ applications require fixes from either Gtk+ or the
application itself. |
| Multiple processes with hierarchy |
Not yet. Planned. |
| PTYs other than the current one |
Would be needed to suspend/resume a screen session with
multiple PTYs inside. |
| Process name in ps (/proc/pid/cmdline) |
Planned. Currently gets garbled upon resume. Without help from the kernel,
it involves tweaking the environment and command-line arguments and
re-exec'ing to make task->arg_start land at the same place. |
| Compression |
GZIP compression is used by default. LZO compression is supported. bzip2
compression might be planned, and a nice way to switch between them. |
| Processes using 0x00100000 |
The resumer sits at 0x00100000. If another process uses this area of
virtual memory, it can not be frozen. CryoPID's location could be chosen
dynamically, but not until a need arises.
|
So when would you want to use CryoPID? Here are some programs and cases where
it does work:
- irssi - you run irssi under a screen on a shell server somewhere.
You realise the server is going to reboot. You don't want to lose your
scrollback. You suspend irssi before the server shuts down. Once it's back,
you resume irssi and have all your channels and scrollback still. irssi is
smart enough to automatically reconnect to your IRC servers.
- vim/nano - (convoluted) you want to point somebody at at particular
point in a file, or show off some macro you recorded, or something. Save
your vim session, send it to another machine, resume.
- mutt - You have a huge inbox with 30000 emails that you don't want
to have to close mutt and reopen to check your email. You also don't want to
leave it running in the interests of memory consumption. Ensure you sync your
mutt before saving it to a file, and the just resume it later. Et voila.
Some cases where it would be nice, and will hopefully be supported sometime:
- screen - your shell server is going down. You want to preserve your
entire screen session, with child processes and all across a reboot. Support
for hierarchies of processes needed.
- X applications - you want to save your X application while you
restart the X server (to change to a projector?), or reboot. This could be
done with the help of xmove (needs to be integrated into CryoPID).
-
PAX must be turned off if you have it (chpax -xperms <target
program>)
-
Very undocumented.
So by this point you're probably saying, "Yeah right, that's impossible".
Show me.
Latest version:
Older versions:
A mailing list for the discussion of CryoPID has been setup.
Click here to
go to the subscription page.
|
Hosting thanks to
|