Re: Hot swap kernel

Richard B. Johnson (root@chaos.analogic.com)
Thu, 22 Jan 1998 18:17:57 -0500 (EST)


On Wed, 21 Jan 1998, docwhat@gerf.org ;The Doctor What wrote:

> Repeating what you said:
> ->Many portables has got a feature which allows you to turn of the
> machine and
> ->restart it without needing to boot again. Basically I think it flushes the
> ->memory and info about processes.. Before it does that it probably
> syncs the
> ->discs etc. This feature didn't work to well on Linux but the theory...
> ->I am not sure (as usual) but if it would be possible to freeze the system,
> ->flush all interesting info including the entire memory and make the
> new kernel
> ->cooperate with the "old" info..
> ->Perhaps it would only operate if we killed all processes perhaps even
> umounting
> ->all filesystems. This wouldn't be bad at all. I can imagine this
> won't take
> ->more then perhaps 10 seconds. A major time saving compared to a complete
> ->reboot... But then all network connections would be lost, but it is
> at least a
> ->start =)
>
> I believe that the feature in laptops that you mention doesn't connect
> with the OS. Specifically, I believe that the hardware in the laptop
> saves the state of the Memory, CPU and Video, then simply turns off the
> power. When it re-starts, it loads everything back in place and tells
> the cpu to "go".
>
> Am I wrong? I had a friend who installed an ancient copy of Win3.0 on
> one of these Laptops (it was originally a Win95 OEM2 laptop) and it
> worked fine. Ditto DOS version 3 thru 6 and OS/2.
>
In principle, one could save a memory image on a physical storage device
then turn off the power. Upon startup, after hardware initialization,
all data areas would be overlayed with saved data. Note that when the
kernel has control, all user tasks (even code) are just data.

This has already been on VAXen at VAX/VMS version 6.0. The idea was
a "fast" restart.

There are at least two problems.

(1) Communications (like networking) with connections that have long ago
been abandoned.

(2) Time dependent things (the time changed).

When it comes to actually changing a kernel, you have a problem that
just might not be solvable. This has to do with the changes in sizes
and alignments of various data areas. Note that a single byte of code
added or subtracted, or the size of a single member of a structure, could
realign everything in some intractible way, like offsets by an entire
page, etc.

If, upon saving a memory image, you actually tokenized it to make it
independent of memory layout (such as foo.bar.whatever=0x1234), and
upon startup, you found all the changed offsets and inserted the correct
values, you would have a machine that would take many minutes to boot,
much longer than just doing `shutdown -r now`.

Cheers,
Dick Johnson
***** FILE SYSTEM MODIFIED *****
Penguin : Linux version 2.1.80 on an i586 machine (66.15 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.