![Lead Image © Valentin Volkov, 123RF.com Lead Image © Valentin Volkov, 123RF.com](/var/ezflow_site/storage/images/archive/2014/22/save-and-restore-linux-processes-with-criu/123rf_12892772_eiswuerfel-schmelzen_valentyn-volkov-volkov_resized.png/94061-1-eng-US/123rf_12892772_eiswuerfel-schmelzen_Valentyn-Volkov-Volkov_resized.png_medium.png)
Lead Image © Valentin Volkov, 123RF.com
Save and Restore Linux Processes with CRIU
On Ice
Some maintenance work can only be done when no production software is running, but admins cannot terminate processes at will; otherwise, they risk losing data and time-consuming computations that will have to restart from scratch. The remedy on Linux systems is a small tool named "Checkpoint/Restore In Userspace," or CRIU.
CRIU freezes the current state of a process and saves it on the hard disk. Later, you can bring the process back to life; it then continues working at the point where CRIU froze it. For virtual machines, this is known as creating snapshots.
Freezing is not useful just to allow maintenance. Suspended processes can be moved to other computers and continue to run there. This live migration helps, for example, in load balancing scenarios: If a computer is just twiddling its thumbs, you can use a script to transfer a process to it. You can also freeze suspicious processes and analyze them on another system at your leisure. If you integrate CRIU in your system's startup scripts, it backs up processes automatically when you shut down and brings them back up on the next boot. In this way, you not only save the state before switching off but also shorten the boot process.
Numbers
Development is proceeding quickly. The first CRIU version appeared less than two years ago. When I first started writing this article, only the first release candidate of the 1.1 version was at available; v1.1-rc2 and v1.1 followed soon after. Two more versions followed quickly, and when this article went to press, v1.3-rc2 was the most recent release. The following comments are based on the v1.1 release candidate. Other versions are available in the release archive [1].
CRIU indeed works completely in userspace, but it imposes several requirements on the running system. First, the program only works on systems with ARM or x86_64
...Buy this article as PDF
(incl. VAT)