50

I would like the highest performance in both OSes and the ability to switch between them without a reboot. I have plenty of memory (32 GB) and disk space.

The two easy options are:

  1. Dual boot - This doesn't allow for an instant or almost instant switch between operating systems
  2. Use a VM (e.g., VirtualBox) - This hurts the performance of the hosted OS significantly, especially for graphics

It would be great to (say via a keyboard shortcut or some other similar method) switch between the two OSes, one of which is hot and the other is "warm on standby."

4

17 Answers 17

162

There are two additional ways of running Windows and Linux side by side that you haven't mentioned in your question:

  1. You could install Windows Subsystem for Linux if you are running 64-bit Windows 10. This will let you run some Linux software natively on Windows.
  2. You could run both operating systems side by side (literally) as per this example: enter image description here
20
  • 24
    With regard to Windows Subsystem for Linux, it is a joke performance wise. See the up to date (2018) wonderful review of its horrible performance compared to even VirtualBox at Phoronix: Windows 10 WSL vs. Linux Performance For Early 2018. With regard to having two laptops side by side, that was not what I was looking for. I would like to use one powerful PC and toggle between OSs, without the overhead of a VM or at least with absolutely the lowest overhead possible, especially when it comes to 2D graphics. May 1, 2018 at 18:32
  • 104
    @PowerDeveloper What you're looking for is simply not possible because of the way operating systems are designed. OS's are not designed to share control of a computer. Your choices are to either virtualize one or both operating systems, reboot to switch operating systems, or use two computers. May 1, 2018 at 19:45
  • 55
    If you're using the literal side-by-side option, you could use a single keyboard/mouse and a KVM switch (or software option like Synergy), which would give you the option of using a keyboard shortcut to switch between machines. May 1, 2018 at 19:47
  • 14
    @JulieinAustin You're right that most modern OSs are hypervisor aware but that doesn't seem to be what the OP is really asking about. They want to be able to switch between live OS's as easily as I'm flipping between Slack and Chrome right now. There are no OSs designed to do this. Besides, they've also indicated that they don't want to take a performance hit from virtualization. I realize that hypervisors have gotten much better in this department but there is still a performance penalty vs running on raw metal. May 1, 2018 at 20:16
  • 15
    @PowerDeveloper, I'm not convinced you fully read the entire performance article you linked to. It appears to me that, other than I/O, WSL is doing a respectable job, often beating competitors in a few cases. I admit I don't do massive workload under WSL but it's allowed me to retire VBox, VmWare and CygWin in one fell swoop. YMMV.
    – user53528
    May 2, 2018 at 1:13
53

I believe that the solution with the least overhead would be using Linux as your primary OS and using KVM (kernel-based virtual machine, not a KVM switch though that could be used as well) to virtualize Windows. You can get Performance comes pretty close to running on bare metal nowadays, and you can even pass through a secondary GPU to the VM or have a single dedicated GPU and use an integrated GPU for the host. You can also use Looking Glass for a much more responsive solution than using spice (which is what virt manager uses by default and is essentially the same as using remote desktop.) https://forum.level1techs.com/t/looking-glass-guides-help-and-support/122387

The only tricky part is hardware compatibility. There are a lot of quirks, like needing a CPU and motherboard compatible with Intel VT-D or the AMD equivalent, needing a new enough GPU that has a UEFI VBIOS (or getting the VBIOS from the manufacturer,) what chips your IO goes through which helps with dedicating peripherals to the VM, etc.

I would recommend reading this blog post to get an idea for what you'd have to do to get it set up. It's definitely not as simple as using virtualbox or VMWare, but if you set it up thorugh virt manager you can skip a lot of the manual steps this guy went through. There's also a lot more information on all of this on the Arch wiki under KVM, QEMU, and VFIO. https://heiko-sieger.info/running-windows-10-on-linux-using-kvm-with-vga-passthrough/

With a 2600k, you'd need to downgrade to the non-K version and check to see if your motherboard supports VT-D as well. I had this same issue with a 3700k and an incompatible motherboard and had to switch them both out, but I ended up making a little bit of money through the ebay purchases and sales.

To elaborate a bit on some of the terminology I used, here are some short descriptions.

Virt-manager (or Virtual Machine Manager) is a GUI application for managing your virtual machines using KVM. You can think of this as making your experience a lot closer to what it would be like if you were using VMWare or VirtualBox. It gives you a wizard for setting up the VM, allows you to change the hardware that's being passed through, shows you graphs of resource usage, and lets you manage power. More info and screenshots are available on the website here: https://virt-manager.org/

Spice provides you with remote access to your VM. It's very similar to using remote desktop, both in use and in performance, but it's used by virt manager by default. I wish I could be more specific with my description but I haven't used it much and even the website is pretty vague as to what it is specifically. https://spice-space.org/

Looking glass is an alternative to using something like Spice but with extremely low latency. It copies the frame buffer from your GPU to your system memory and then spits it out on the screen. It's still very early in development but works very well and is much more suitable for applications that require a more responsive solution. A very comprehensive guide for setup is available on the project's website: https://looking-glass.hostfission.com/quickstart

The other alternative to Spice and Looking Glass is just connecting a display to one of the outputs of a passed through GPU. This is more responsive but will require another display or switching inputs on the same display.

0
11

As all the other answers to this question have mentioned, virtualization is the way to go. One way to minimize the performance penalty would be to run Windows as your primary OS, and virtualize a lightweight Linux distro. Off the top of my head, you might try:

By choosing a lightweight distro, you may be able to mitigate the performance enough to set up a system you're happy with.

9
  • 9
    Arch Linux is nice and light-weight; you can install your choice of GUI desktop. e.g. KDE without compositing works well and has powerful window-switching but doesn't need 3D graphics hardware. May 2, 2018 at 2:39
  • 2
    This is the solution I use because a) most of my performance needs lie with Windows, b) it is very easy to set up and use, and c) it costs zero dollars.
    – tecu
    May 2, 2018 at 15:56
  • @PeterCordes Arch is not lightweight. Bit of a pet peeve of mine, but Arch is significantly heavier than a netinstall of any other distro thanks to their packaging policies. Arch isn't lightweight, it just has not much out of the box. Go for Alpine or Void or like Debian if you need a lightweight system. May 4, 2018 at 17:38
  • 2
    @Different55: Measured in what way, though? Are you still just talking about filesystem space required? Or are you saying Arch is also "heavy" in terms of number of processes running or the memory and/or CPU usage footprint? Because for use in a VM, the latter is the kind of weight that matters more; disk space is cheap (and mostly irrelevant for performance when you never read those files.) May 4, 2018 at 18:47
  • 1
    The kind of expanding disk files you're talking about don't help much when the space is actually being used, just unwisely. Whether or not that's actually a concern or not is up to the situation. Throwing money at things, even just $40-50 isn't always an option either. May 7, 2018 at 13:50
7

Unix/Linux GUI applications that use the X11 technology stack (most of them) are inherently capable of being displayed on a remote machine (including the scenario of a network-connected VM and its host).

You can install an X11 display server (there are multiple free and non-free options) on your windows machine, run your linux system (or even multiple linux systems) in a VM, and have the actual graphics heavy-lifting happen in the windows-side X11 server. The GUI apps in the linux system will connect to the X11 display server via local networking (how to set this up is beyond scope here, as there are many different ways to do that. Pointers: The DISPLAY environment variable, ssh with X11 forwarding, XDMCP).

1
  • 4
    Yes in theory, but modern GUI programs (and windowing libraries) use the X11 protocol mostly to send pixmaps to the server, not small requests like\ XDrawRectangle. Fonts may still be handled server side in some software, though. Anyway, running X11 without shared-memory between client and server works, but is potentially slower than you'd like even running over an unencrypted TCP connection from VM guest to host. Especially given that a Windows X11 server has to translate X11 requests back into Windows drawing functions instead of using / being a video driver directly. May 2, 2018 at 2:43
7

I have done this in a high-performance circumstance and achieved near-enough to native performance for the applications we were running. This isn't so much a 'here's how to do it', but two examples of where I have done this and achieved adequate performance and solved a problem.

For Data Science and Software Development

My current workstations (a laptop and my workstation), have Windows 10 and Ubuntu installed side-by-side on two separate partitions. Upon booting up my machine, I can select Windows or Ubuntu and boot into either operating system. Within Ubuntu, I use VirtualBox to boot the native Windows partition and run it like any other virtual machine (see here).

Everything works: drag and drop, shared clip-board, and file sharing. I run large, multi-threaded Excel spreadsheets constantly (don't shoot - I didn't build them!) in my virtual machine and everything is hunky dory.

For Geophysical, Geological and Engineering Works

A few years ago, I built a similar setup using CentOS and Windows 7. This was so that my colleagues could run expensive, performance-hungry geophysical simulations in Linux while still being able to access similarly performance-hungry 2D and 3D mapping software in Windows 7 (along with Outlook and the rest of the Microsoft suite). We trialled VirtualBox, but with money to spend, we ultimately solved the problem using VMware Workstation and GPU pass-through (the cost was trivial compared to salaries and software licensing). For our applications, we achieved close-enough to native performance in Windows and everybody was very happy with the setup.

These were quite meaty machines for their time (circa 2010): Quadro 4000, dual quad-core Xeons and 32 GB of memory. The most arduous part of assembling these setups (as far as I recall), was something to do with a hardware RAID controller. I maintained about a dozen machines using this setup and we never had a single issue throughout the lifetime of the project these machines were purchased for (~2 years). This was a fantastic result for us because if a single machine was down for say, a week, that would have cost us more in lost productivity than the workstation itself!

Conclusion

You can achieve very good performance using the dual boot option described above. I've done this using VirtualBox and VMware of different occasions, using a combination in Linux distributions (Mint, Ubuntu, and CentOS), and Windows versions (7, 10), and always achieved adequate performance for my needs.

The other advantage of this setup is that you can nuke either partition and leave Windows or Linux behind if a) your circumstances change, or b) this setup isn't adequate for your needs. If performance isn't cutting it, you also have the escape-hatch of simply booting directly into the operating system where you need that little bit more performance.

Finally, a note on licensing: If you boot Windows natively it will see different hardware and interrogate you about licenses. This is less of a problem with Windows 10, which will simply nag you as you get along with your work. I can't recall how we solved this for those geophysical workstations; I do recall we had a volume license and possibly some help from a Microsoft representative.

Epilogue: Remote X and VirtualGL

I've also set up workstations using VirtualGL and a GPU cluster for high-performance petroleum simulations. I've even done this in AWS, but I don't recommend it for a number of reasons: cost, performance and convenience.

5

Hardware virtualization is just too problematic. While it is good for 90% of things, the other 10% sometimes blocks you and ends up making you scrap the whole concept.

Someone alluded to this in one of the comments, but I do think that side-by-side machines using a KVM switch is the most efficient way to do what you are asking for.

I have for a couple years now run two side-by-side Linux and Windows machines. I have two 32" monitors sitting next to each other; one plugged into the Linux machine, the other connected to the Windows machine.

I have a rolling adjustable keyboard/mouse table that allows me to stand or sit and center myself in front of either (or both) monitors with my keyboard/mouse.

The kicker is that the KVM switch allows you to switch immediately between controlling the Linux box or controlling the Windows box.

You can also go one step further and purchase Synergy which eliminates the need for the KVM switch completely by using software to switch your mouse and keyboard between machines.

No more annoying dual boots, KVM / VirtualBox / VMWare overhead or incompatibilities, and you still feel like it's a single computer.

6
  • 1
    Not to discount your suggestion at all as I agree that a KVM switch or synergy are also good solutions, but can you elude to that 10%? I've been using this setup for a while and haven't had any problems with it (well, it broke once but I'm using Arch so that's a given.) May 2, 2018 at 2:04
  • Well I just through out a BS number 10% based on a rough number of times I've not been able to use it. SharePoint doesn't work on virtualized enviornments so I can't use it for that, that's a big one. When I was using a Linux VM on Windows, the build and running of the app i was working on was 30% slower to startup. Can't play StarCraft2 over a virtual session. Clipboard copy-paste got very annoying was inconsistent. Using the VNC instead but that was quirky and wasn't as fluid as a real desktop session May 2, 2018 at 12:56
  • 2
    @NicholasDiPiazza: you can definitely play Starcraft2 now with GPU passthrough. May 2, 2018 at 15:37
  • woah sick. will look into that May 2, 2018 at 17:56
  • @NicholasDiPiazza Out of those three, KVM is the only one which in my experience can manage close to native performance on a desktop. But there are a whole bunch of caveats and hardware requirements. And if you want decent graphics performance you need to sacrifice the shared copy paste etc entirely and run the VM on a second GPU and screen. In which case I have managed essentially native performance on everything but hard disk performance.
    – Vality
    May 3, 2018 at 23:08
5

Depending on what you're trying to achieve, you could try Wine.

From https://www.winehq.org/:

Wine (originally an acronym for "Wine Is Not an Emulator") is a compatibility layer capable of running Windows applications on several POSIX-compliant operating systems, such as Linux, macOS, & BSD.

This would allow you to run Linux and (some) Windows applications side-by-side on Linux.

A list of Windows applications which are known to work with Wine can be found at https://appdb.winehq.org/.

Personally I use it to run some games on Linux which use DirectX, which doesn't have a Linux version. Applications like Microsoft Office are known to work with it.

4

I am not aware of any method of doing this which doesn't have some big caveats associated with it.

If it were a Chromebook, you could use Crouton to accomplish something like this. but what this does is share the kernel between Chrome OS and another distro, nominally Ubuntu. Since Windows and Linux use different kernels, this approach wouldn't be possible. They wouldn't play nicely together.

To boot the operating system, the kernel needs to have low-level access to the hardware, and running two different kernels (Windows and Linux) side-by-side would not be very easy to accomplish at all, if not impossible.

Some kind of virtualisation is probably your only recourse if you insist on using a single computer. I don't use a Mac but from what I have seen, Parallels is pretty seamless - you can "switch" between operating systems with a hotkey then. I have used VMWare on both Windows and Linux and have been surprised by the performance of the hosted (guest) operating system, it is very near native (though granted I haven't tested graphically intense workloads). VirtualBox is open-source and free, it works okay, but VMWare works a lot better. I think there is a limited free version.

If you insist on having native performance for both operating systems, then dual-booting is the only way to accomplish that. If you have a fast SSD (say a Samsung 960 or similar) then rebooting needn't take that long.

4

Technically you can enable hibernation on both systems and resume a system from hibernation after you put another system to hibernation. This will be faster and more convenient than actual rebooting. I'm doing it on my current machine.

There doesn't seem to be any issue so far since Linux uses the special swap area to store hibernation image while Windows uses the system partition.

4

You want coLinux. It fits your requirements almost perfectly - Linux kernel running as a special privileged process under Windows, with no performance impact within the kernel (though the peripherals are still virtualized, and graphics goes through the X11 protocol). But, unfortunately, the project is no longer being developed... and other approaches (VirtualBox, etc.) matured since then and offer much better user experience.

4

Everything has pros and cons. Here are the ones that work for me as of May 2018:

  • VirtualBox: This works. Now. Every day. I run a Windows host and an Ubuntu VM. Everything is great, including multi-monitor support and networking (I use Bridged mode so each VM just shows up on the network separate from the host). I'm no fan of solutions controlled by "the big guys" but honestly Oracle has done this product right (at least at the moment).

  • Run multiple computers, it's a great way to go! Synergy can even let you push the mouse and keyboard across them all. DDM USB KVM's are nice too, but they are expensive!

  • Dual boot: I run quad or more booting on most of my computers. You'll have to learn about GPT and legacy MBT partitions and how each of your OSes mangle them up. Refind does an amazing job of helping you get it right, especially if you have semi-modern hardware. Even though I always set up Windows-Ubuntu(-Mac) booting on all my PCs, in practice I never really reboot to a different OS. It's just too disruptive. Instead always end up dedicating each computer to a specific set of tasks on one OS.

  • Run an X server in Windows, and pull in Linux windows from a network VM. It can be done; I ran x2go successfully for a while. But see the next item for why I wouldn't go this route.

  • Use a VM across (any) network: I've tried doing development off an AWS VM, off vSphere VMs and all kinds of other combinations, and you will always give up on that within a short time, because you are a slave to network problems that you will NOT want to deal with in the middle of your development. Don't even think about it, even if you have insanely amazing network resources.

As a final note, I should mention that I always develop on a dedicated Ubuntu machine whenever possible. The VirtualBox solutions have saved my butt in corporate America. Walk in with a VM image in your pocket, install VirtualBox on your crappy new Windows lappie, go!

2
  • Are you allowed to walk in with a VM image in your pocket in corporate America? May 4, 2018 at 2:39
  • @Peter Not always I suppose. A complicated matter of trust.
    – moodboom
    May 4, 2018 at 15:01
2

In addition to the other solutions proposed here, there is also a “cross-virtualization” approach which I once tried:

  • Dual-boot setup, the machine can boot into either Windows or Linux
  • Data partition (/home and Documents and Settings) separate from system partition
  • Virtualization (VirtualBox, VMware etc.) installed on each of the two OSes, with a ‘clone’ of the respective other OS setup as a VM
  • Network interface is in bridged mode, so host and guest appear to each other like two separate computer on the same LAN
  • VM images reside on a partition that is separate from the data partitions
  • Each VM can access the data partition for the guest OS as a raw device (rather than a disk image)

This still means you will have the virtualization overhead for one of the two OSes. But you can decide on boot which one gets to be the host and which is the guest.

Data is shared via the network (e.g. by installing Samba on the Linux box).

You will need to maintain each OS setup twice (the host installation and the VM one)—technically you have four computers, unless you use the shortcut described below.

Since Linux (at least the various flavors of Ubuntu) easily adapts to changing hardware (to the point that I could rip the disk out of my old laptop, install it in the new one and only had the network adapters to reconfigure), you could also have the Linux VM boot the system from a raw partition. That way, changes made to the Linux host would also be reflected in the VM and vice versa, the only exceptions being settings tied to a particular hardware device.

Windows licensing might be a caveat here. (Back then, I was on Windows 2000, where all of this was easier.) As far as Windows is concerned, you are running it on two different hardware configurations (processor, disk, network adapter). While I am not sure about the legal implications, but the product activation procedure might require you to get two licenses. (If you can get Windows to run off a raw partition in a VM, it will probably detect a hardware change and require re-activation each time you switch between host and guest configuration.)

2

I do this (although I switch between macOS and Windows) by having Windows on a VM in the cloud and not hosted on my Mac. I did previously use Boot Camp for dual booting and then a locally host VM using VMware Fusion, but I found that having a cloud based Windows and using Remote Desktop Connection was the most convenient at switching.

(I just can use CMD-TAB to switch desktops instantly.)

I hoped this experience is helpful to you.

3
  • 1
    That must take quite a lot of network bandwidth, though? Is the latency non-terrible? May 2, 2018 at 2:45
  • 1
    @PeterCordes I use something similar (accessing powerful work PC via VNC on an old slow notebook), though it's linux->linux in my case. With tuned VNC parameters, latency is almost negligible if the ping time stays under 30ms, and bandwidth is modest - maybe kilobytes per second averaged during normal work. You can even play youtube video through this setup, but then it shoots up to many megabits per second, of course. May 2, 2018 at 13:06
  • I'm in an environment where the internet connectivity is rather high and no ISP is involved and our connection is fibre triangulated.... May 2, 2018 at 20:47
2

Forget VMs, Wine, and dual booting. I strongly recommend simply having two machines, the Windows one headless, and remote desktop from the Linux one using something like Remmina.

It is reasonably seamless via shared clipboard and home folders. That might not be practical for some who need just a laptop, but it's a great option if you can just be at your desk. They don't have to be new machines; just get older ones circa 2012 you might have laying around.

1

Some way-out-of-the-box suggestions that might fit certain niche use cases:

If you run headless, Linus runs almost anywhere and is amazingly light-weight. I've run it as a windows service before and been able to connect to it from an ssh client or X server running in windows (So all the Linux GUIs just display).

Along those same lines, you can duct-tape a raspberry pi to the back of your laptop, plug it into your USB port and have both computers run at the same time. Again you have to use your windows machine to access your Linux machine, but with this solution you can still run headless for X/ssh access but you could also remote desktop (RDP) into the PI and use it's X implementation which should get you a better linux desktop experience (Last time I checked, free X servers for windows were slow, difficult to set up and error-prone)

Neither of these will give you a high-speed full-screen Linux workstation, but for certain situations they make interesting solutions.

And I was just kidding about the duct tape...

mostly.

0

While I would recommend a VM (the seamless modes of VirtualBox and VMWare are really useful for better integration), there is another possiblity:

There are X-Servers for windows like Xming and powerful remote desktop solutions like xpra.
Using one of them you can run a linux in a VM (or even a solution like AndLinux which runs a linux kernel on windows) and display the applications in the native Display Server or via the remote desktop tool.
This way you may get more native windows and depending on the VM a better performance for UI applications.

0

Use a GNU/Linux system of your choice on your host and then a PaaS solution. One which is feasible for you would be "Shadow".

Shadow is a powerful Windows 10 PC to play, work, browse.

Do everything you love to do with a computer. But better.

It basically runs as an app on your host then but is actually a computer in the cloud. You just can switch over to the app seamlessly, just like you would focus any other app.

https://youtu.be/vVOKBaIxXVA?t=6

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .