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.

  • This is what Hypervisors like HyperV and VMWare work.. With the exception that the Hypervisor handles both OSs running. I can't speak for VMWare, but HyperV lets you pause an OS and resume it as needed. essentially doing as you describe. – MikeAWood Nov 5 '13 at 2:50
  • I haven't tried such setup, but you're looking for a bare metal hypervisor. – gronostaj Nov 5 '13 at 2:54
  • 1
    In my mind, there would be almost no virtualization apart from setting artificial limits to ram. Direct access to hardware is something for better compatability. HyperV is mostly used for servers, correct? I was thinking of a more practical solution for any operating system on any hardware. Also, I thought VMWare was a a glorified virtual machine. – Hebon Nov 5 '13 at 2:55
  • 1
    HyperV and VMWare both make versions for "desktop" use like you are describing, but in truth HyperV's implementation is for running a second VM while running windows. Otherwise you'd need to run HyperV Server. VMWare is basically the same, VMWare Workstation works the same way. – MikeAWood Nov 5 '13 at 3:05
  • 1
    superuser.com/questions/303869/software-to-switch-between-os/… I answered a very similar question previously, and it may be of interest. – Journeyman Geek Nov 5 '13 at 3:35

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.

  • Wouldnt it be possible to "purge and reboot" said devices at the compatability layer? That way, they would be "Fresh" on boot. Maybe the software on the OS that handles switching could also handle any strange device issues to make it more stable (such as not notifying the user that new hardware was found). – Hebon Nov 5 '13 at 3:02
  • @Hebon, Adding a "compatibility layer" would only slow things down. Letting the Hypervisor handle the VM lets your VMs talk directly to the hardware when they need to for things like memory and hardware. Intel VT-d's explanation might help shed some light on it for you. software.intel.com/en-us/blogs/2009/06/25/… – MikeAWood Nov 5 '13 at 3:09
  • @MikeAWood I use "compatibility layer" in a very ignorant sense, as I don't know what to use to describe my thought other than that. – Hebon Nov 5 '13 at 3:43

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.