Wednesday, August 09, 2006

Cryonics and Demons in the ram

Recently, I have been working on something I like to call "system cryonics". The basic idea is to take a running program, and freeze the exact state it was in. This information is plopped into a file. The file can then be revived back into a running program again. The process when is in file form can be moved to another system, archived, or simply copied. If this is done right, the possibilities it opens up are very exciting.

But, there are many ways the process can go wrong. The first issue comes when freezing occurs. The ideal method involves not killing the process, but sometimes this is the only choice. Now while a proper halting of the software is ideal somethings are lost when processes are exited. Core files do not hold that much info on your process state. The information that is held is very relative. The environment you revive your process in might not be even remotely similar. So core files are a pretty terrible choice. There are other dangers that come with them that will be mentioned later.

What exactly is it that needs to be saved? Should the libraries that the process was linked to be frozen as well? The risk with that is a backpropagation that eventually freezes your entire system. All your entire memory collapse into an enormous file. The system is gone, and that file might not have even saved the data in a proper way. This essentially an unsafe hibernate. Now freezing processes is partially about avoiding system reboots. With this, the freezing process is a reboot. Anything frozen should probably also translate its system-specific details into abstract general terms. The final realization is that the process being frozen should not have to stop for this process to occur.

My failure came in not freezing enough of the details. I figured I just needed to save the program's data. The issue was the program had hooks into libraries that were running in memory at the time. These relative memory locations were still remembered from the program unfroze. The program loaded and then dissappeared. That was normal, since I had froze it while it was a daemon. I checked for extra programs running. I noticed nothing. So, I figured the program killed itself while unfreezing and I would now have to go back to debug.

The problem was the program really was revived and was scratching at the memory where its libraries were. My other programs started crashing. Nothing in one burst, but slowly and randomly. The program in an effort to run was trying to use other resources. Now my machine was haunted. I had no process id, so I couldn't kill the thing. But, I was convinced I could. It continued to lurk and slowly kill applications, until I finally shut down my machine. I turned it on a day later. My machine was now exorcised.

I have to keep hacking at it, but in the meanwhile, I did find a cyronics program that seems to work. It's called Cryopid. I am going to have to exchange emails with the authors so wisdom may be shed. And demons can stop haunting my ram.

0 Comments:

Post a Comment

<< Home