2

I'm sick of needing to reboot my computer every time I wish to use another OS, or run a virtual machine that skimps on power. With the onset of large amounts of memory for computers nowadays I began to think that there must be some way to run two OS's in memory with a way to switch between the two. In my mind, it doesn't seem too difficult;

  • a compatibility layer boots up after bios, which in turn boots to OS1. While in OS1, software is run that triggers a save to ram boots back to the compatability layer, and then boots to OS2. This way, the OS's can be used side by side and boot times are cut drastically short since both OSs are already in ram.

Both OS's have their own designated and protected memory so there is no problem there... I mean, it seems fine, but no one has done it, so there must be some reason as to why. I would love some insight into this please.

Hebon
  • 401

2 Answers2

4

What you say is totally possible, except that switching the states of peripheral devices unexpectedly will not be tolerated by most OSes.

Example - OS1 is running, you suspend it to RAM, and then boot OS2. All the devices, such as PCI, USB, etc. are in a specific state, yet OS2 will change this state. When you return to OS1 all the device drivers will be working with devices in unexpected states from OS1's point of view. OS1 will probably crash as its device drivers will be doing things the devices don't like, since the devices are not in the proper states.

It's not always possible to save and restore states of devices in the same manner as you would RAM. Devices can be quirky. Typically for an OS to interact with a device its driver will have to be used. Drivers can have bugs, etc.

Now, you might think you could assign devices exclusive to one OS or another. Problem is, to get to a device, you'll need to traverse a bus, and on standard PC hardware you are only going to have 1 or 2 PCI-E buses, for example, that all PCI-E cards are connected to. So at the very least the bus will have to be shared between your OS instances. One OS could "step on" another OSes devices unless there's some active layer (like a hypervisor) in the middle. It's very difficult to completely separate hardware between two OSes.

Virtualization is really the best you can do.

LawrenceC
  • 75,182
1

sounds like kexec.But it is only available in *nix based OSes.

Kexec is a system call that enables you to load and boot into another kernel from the currently running kernel. This is useful for kernel developers or other people who need to reboot very quickly without waiting for the whole BIOS boot process to finish.

Ashildr
  • 2,770
  • 5
  • 28
  • 45