UNIX Process Cryogenics?
shawarma asks: "Due to a recent
power outage, I've had to shut down a server running a process that had
been running for ages calculating something. The job it was doing would
have been done in a few days, I think, but I had to shut it down before the
UPS ran out of juice. This got me thinking: Why can't I freeze down the
process and thaw it back up at a later time? It ought to be possible to take
all the connected memory pages and save them in some way, preserve file
handles and pointers, and everything. Maybe net-connections would die,
but that's understandable. Has any work been done in this field? If not,
shouldn't there be? I'd like to contribute in some way, but I think it's a bit
over my head.." Laptops have been doing this in some form for years:
most laptops, when they run out of power, or when told by the user will
go into "suspend" mode which is similar to what the poster is describing,
however outside of laptops, I haven't seen this done. Sleeping processes
also do something similar, sending their memory pages into swap so other
running processes can use the memory. What, if anything, is preventing
someone from taking this a step further?
What you want is known as "checkpointing."
There have been a number of projects that do this under Unix over the years. Many of them do it for the purpose of process migration. Others do it just for recovery.
One such project that I used in the early 90s was Condor.
The typical approach is to do something along the lines of forcing a core dump and then doing some magic to restart the process from the core file.
1) Produce the core dump of a process
/. posts this as a relevant question is very
2) Use the core and process image to restart it
(for example in the debugger such as gdb, if you
don't want to write specialized software).
To the best of my knowledge perl "compiler" uses
precisely this technique to produce perl "executables" - dumps them out as a core right
after compilation and reuses it later on.
You can do this to a kernel as well, if you
REALLY want to.
However, since indeed many things may be dependant
on state of kernel, files, network connections, devices etc. etc. doing this is not adviseable.
Good coding practice for long-running processes is
to actually spend some time on writing the state
saving functionality to support process restart.
Anyway, (call it a flame if ya will) but the fact
that
disquieting - level of technical knowledge here
gets reduced day after day.
There is or was a project to suspend the whole os to disk. Details are here: http://falcon.sch.bme.hu/~seasons/linux/swsusp.htm l
The difference between Canada and the USA is that in Canada healthcare is a right and gun ownership is a privilege.
You can run Linux in an isolated environment on your computer and when you want to freeze a process, VPC can save the state of the environment. When you thaw it hours or years later, the environment doesn't know any time has passed. Since VPC can run multiple instances on the same machine, you can put the critical process in its own environment.
Thats VOGONS and it was 10 minutes, not 5.
-Restil
Play with my webcams and lights here
This comment is far from (Score:4, Informative) ... it's not even relevant. We're not talking about the whole OS hibernating, we're talking about saving the execution state of an executing process so that it can be resurrected later and continued (ie. if a reboot is necessary).
----- rL
You could do this with VMware. Run another copy of Linux inside a VM, and suspend the VM when you need to shut the box down for a while. Very simple.
This is not the most efficient way to use a computer, of course -- you'd probably want to dedicate your resources to the application instead of to a virtual machine environment -- but technically this does get the job done.
Tired of FB/Google censorship? Visit UNCENSORED!