0

There is a hibernation feature for computers. My understanding is that it saves the system state to disk and then restores it.

Why there is no similar feature to switch between operating systems by just saving and restoring the OS system state without the need to reboot and without any virtual machines, natively?

Blindspots
  • 3,472

2 Answers2

3

There is a hibernation feature for computers. My understanding is that it saves the system state to disk and then restores it.

Why there is no similar feature to switch between operating systems by just saving and restoring the OS system state without the need to reboot and without any virtual machines, natively?

There is; it's called "hibernation".

The Windows boot manager deliberately does not allow using this trick to switch between operating systems it manages, perhaps because it could potentially lead to malfunctions when two operating systems update the same filesystem structures behind each other's back (e.g. you resume OS 1 and suddenly a file that a program has been reading is gone because you removed it via OS 2 earlier).

However, it does work if you use another boot manager, such as if you have Linux installed alongside Windows and you have GRUB or EFI as the primary boot menu – then you can hibernate Windows, power the machine back on, and go straight into Linux. Later you reboot and resume the hibernated Windows system. (I used to do this on my desktop a long time ago.)

If you watch CRD, you'll hear about some PC manufacturers who actually used this trick on their systems out of the box, with a dedicated button that would hibernate Windows and switch into a built-in mini-Linux environment. (No, I don't remember which video that was in. Go watch them all.)

(In fact, there even was one manufacturer that devised a way to hold both operating systems in RAM using some unholy tricks built around the "Sleep" mode (suspend-to-RAM), showing that everything is possible... though of course it had the disadvantage that it needed to permanently divide physical RAM between the two systems, so it only really worked with the kind of micro-linux secondary OS that was the topic of that video series.)

grawity
  • 501,077
1

Your question boils down to: can I have virtualization without virtualization?

To run ANY OS on a PC, you FIRST need a software/ bootloader which closely follows the exact boot sequence defined by the BIOS / UEFI.

The boot sequence on a PC is a very complex process, as you can read in this example.

A lot of care is taken that the OS is kept in a coherent state durig execution, otherwise malware would have an easy way of corrupting your system.

So, to do what you ask for, would mean to create a "Mini-OS" (or software) which is able to switch between Windows and Linux, while (1) keeping a guarantee for the BIOS that everything is happening in a coherent way and (2) giving to you as a user a menu to choose the OS from.

This basically is the way virtualization works. I am sure it is possible to create a minimum linux distro which is able to simulate what you are asking for. But you can't get around virtualization.

This is a very "basic" explanation for why what you ask is not really possible. To get a clearer understanding, you'll need to read through the links provided, and learn more about how an OS works.

EDIT

Heck, you could probably code this into UEFI and put a hardware switch on your machine to switch between OS'es, but it would not change the underlying principle: you need an underlying OS which can take the command from the user to switch between OS'es. That's what's called virtualization.

But the hardware knob could be a cool business idea

1NN
  • 10,044