You’ve probably heard more than once about “virtual machines” and, if you’re reading this text, you’re probably not sure what exactly they are. Don’t be fooled by its mysterious name, because although its internal workings are very complex, the concept itself is simple and you use them every day .
A virtual machine is nothing more than software capable of loading another operating system inside, making it believe that it is a real PC. As its name indicates, the concept is as simple as creating a machine (PC, console, mobile, or whatever) that instead of being physical is virtual or emulated.
What is a virtual machine?
Now that it’s clear to us that a virtual machine isn’t some machine full of gears with a virtual reality headset, but software, let’s go into more detail about what virtual machines are.
The first thing you should know is that there are two types of virtual machines differentiated by their functionality: system ones and process ones, although the vast majority of the times that you hear about a virtual machine they will almost certainly be referring to those of system.
System virtual machines
A system virtual machine emulates a complete computer. In plain words, it is software that can impersonate another device -such as a PC- in such a way that you can run another operating system inside it. It has its own hard drive, memory, graphics card, and other hardware components, although they are all virtual.
That its components are virtual does not necessarily mean that they do not exist. For example, a virtual machine might have reserved resources of 2 GB of RAM and 20 GB of hard disk, which come from somewhere: the PC where the virtual machine is installed, also sometimes called the hypervisor, the host, or the host. Other devices may be physically non-existent, such as a CD-ROM that is the content of an ISO image instead of a real CD drive.
To the operating system running inside the virtual machine, all of this emulation is transparent and invisible. Everything works the same as if it were running on a normal PC, without you knowing that you are bubbled up within another operating system. Nothing prevents you from doing like in the movie Inception / Origin and creating another virtual machine inside the previous virtual machine.
In its bubble, the virtual machine cannot access the rest of the data on the host machine despite being physically running on it, they are isolated. However, the main virtual machine applications such as VirtualBox or VMWare have shortcuts and tools to facilitate the task of moving files from one machine to another.
To function, a virtual machine maps the virtual devices it offers its guests to the actual devices present on the physical machine. For example, the machine may be emulating a 16-bit Sound Blaster sound card, although it’s connected to your laptop’s motherboard’s internal Realtek sound card.
Virtualization can be software or hardware-supported, in which case better performance is achieved. Since 2005 it has been common for processors to have hardware virtualization technology, although it is not always activated by default in the BIOS.
Compute virtual machines
A process virtual machine is less ambitious than a system one. Instead of completely emulating a PC, it runs a specific process, such as an application, in its runtime environment. It sounds a bit esoteric, but you use it every time you run a Java-based or .NET Framework-based application.
This is useful when developing applications for various platforms because instead of having to program specifically for each system, the execution environment (that is, the virtual machine) is in charge of dealing with the operating system.
Compute virtual machines allow you to enjoy applications that behave the same on platforms different from Windows, Mac, or Linux, but you as a user usually don’t pay much attention to them. For this reason, unless you are a programmer, generally when we talk about virtual machines we are referring to system ones.
What are virtual machines used for?
This is all well and good, but why would anyone want to create a virtual PC inside their PC? Although this may seem like a somewhat trivial idea at first, the truth is that virtual machines have a wide variety of uses both in the professional environment and in that of the final consumer. These are the main uses:
To be able to test other operating systems. Installing an operating system on your PC is a long, boring process that is difficult to reverse if you are not satisfied with the results. Thus, when there is a new version of Windows, it is easier and safer to test it by installing it on a virtual machine than on your hard drive. If something goes wrong, you delete it and that’s it, without risking losing a lot of time or your data.
To run old programs. What happens when your business depends on software that hasn’t been updated for 20 years? If you cannot modernize the software, you have no choice but to continue loading it in an operating system of its time. With a virtual machine, this old system can run on current hardware instead of a junk PC. The same can be applied to old games that have stopped working on modern hardware or software.
To use applications available for other systems. It is also possible that you need a virtual machine to run applications that have been developed for another operating system than the one you are using. For example, to use a Linux application from Windows, or vice versa.
To test an application on different systems. As an application developer, you want it to work correctly in as many configurations as possible, and that includes different versions of operating systems. One option is to have half a dozen PCs installed with different versions of Windows… or just one with virtual machines of each version.
As additional security. Being isolated from the rest, a virtual machine provides you with additional security in precise tasks in which you want to be sure that an application will not have access to the rest of your data. That is why they are often used to do dangerous things like installing viruses and malware to study them.
To take advantage of its great dynamism. By their nature, virtual machines are very useful on occasions where you need extreme dynamism in the system. You can save states (exact copies of their data), extend them, and move them to completely different hardware and they will continue to work without problems. For this reason, they are essential, for example, in companies with web servers that host a multitude of machines with their clients’ web pages.
All of these uses come with one main drawback: performance. As you might expect if your PC’s hardware is used to run two operating systems at once instead of one, performance suffers. Also, although the applications to create virtual machines are becoming more efficient and the hardware more powerful, emulating a system always requires an extra effort that is not necessary if the software could communicate directly with the hardware, without intermediaries.
How to use a virtual machine
To use a virtual machine, the first thing you need is to install an application on your PC capable of creating it or at least reproducing it. There are several well-known applications capable of doing this, although the most famous are VMWare, VirtualBox, QEMU, and Parallels.
The importance of a virtual machine to ensure the operation of old software is so great that Microsoft has released various programs for Windows over the years for this purpose. This is the case with Virtual PC, Windows XP Mode, or the new HyperV.
Due to its open-source nature, and wide compatibility with a multitude of host and guest operating systems, we are going to focus on VirtualBox, but you will probably get similar results with other programs.
Virtual machine applications are usually on the heavy side, and VirtualBox is no exception. From the download page choose the one that corresponds to your operating system and system architecture and download it. The file is just over 100 MB.
The installation is not complicated, although some of the options windows can make you wonder what components you want or don’t want to install. The solution is simple: leave everything activated as it is and press Next .
Don’t worry, VirtualBox is a legit application and its installer does not include any nasty surprises. The only thing you have to keep in mind is that at one point during the installation, your Internet connection will be lost for a few seconds to install the virtual network driver. The installation itself notifies you before this happens.
During the installation, you may be asked for confirmation to install drivers for the different virtual devices. Once again, don’t panic, everything is completely normal and necessary. You accept.
After a while, the installation will be finished. Congratulations, you now have everything you need to start using your virtual machine.
Create your virtual machine
To start playing God with your PC and create virtual worlds, you have two options: either create a virtual machine from scratch or import one already created. More often than not, you want to start from scratch, as it is more common for you to have an ISO image with the operating system than a complete virtual hard drive image.
Press the New button to start the creation. In the first step, you must choose the operating system you plan to install. In my tests and for the love of science and retro, I’m going to install Windows 3.1 on my virtual machine.
In the following steps of the wizard, you must specify how many resources of your PC you are going to allocate to the virtual machine. First, it asks you for RAM, where you must choose a balanced value so as not to choke your main operating system. For Windows 3.1 I have no problem (its official requirements are 2 MB of RAM), but if you are installing something newer like Windows 10 you should allocate at least 1 GB of RAM.
The next step is a bit more complicated: the virtual hard drive. Virtual hard drives can be reused from one virtual machine to another, or import already created hard drives in almost any possible format (VHD, VMDK, HDD…) Most often you want to create a new one, in which case you are prompted you choose a format and a size.
The preselected options are correct in most cases. Even though the Dynamically Reserved option is selected, you still need to choose a fixed size in the next window. The difference is that if you choose a fixed size, that maximum size will always be occupied on your host PC (even if it is empty on the virtual machine).
Again, it depends on what system you are installing so you need more or less virtual hard drive space. Take into account not only what the operating system occupies, but also any other applications that you are going to install temporary files, and user files. Better have a little left over than not enough, don’t leave the guest system suffocated with no space.
After this, the virtual machine is created… Well, more or less. The only thing we have created is the environment to be able to install a certain operating system, but as such there is nothing inside it… yet.
Connect the installation ISO
The most common method of installing an operating system in a virtual machine is to simulate an installation CD using ISO disk images. If you have an actual installation DVD, you can use that as well.
The first thing you should do is mount the installation CD or DVD in your newly created virtual machine. To do this, select it and choose Settings. There are plenty of sections here that you can play with later to fine-tune your system emulation, but for now, just head over to Storage.
Here VirtualBox should have already prepared a CD, DVD, or floppy drive for you depending on which operating system and version the virtual machine is based on. In any case, the operation is the same: Choose the device and click on the icon next to its name to load the disk image that you want to mount in its place. In my case I have three disk images to install MS-DOS first, so I have mounted the first one.
Now it’s time to boot the virtual machine for the first time.
It’s ready, now to install…
Go back to the main VirtualBox window and hit Start for the magic to begin. If everything goes well, the installation process of the operating system that you have mounted on the CD, DVD, USB, or floppy drive will be loaded, and from that moment you simply have to follow the instructions on the screen.
From the bottom bar of the window, you have shortcuts to quickly change various emulation-related options. For example, by right-clicking on the floppy disk icon I can change the disk image to continue the MS-DOS installation.
One thing to keep in mind is keyboard and mouse capture. When you move the mouse or type with the keyboard inside the virtual machine, VirtualBox captures the keyboard and mouse to send it to the virtual machine and not to your normal PC. This is all very well, but it can cause you to get “locked” inside the virtual machine without being able to get back to your PC. For example, if you press Alt+Tab you do it in the virtual machine and not on your PC.
That’s why there’s the key to escape capture, which unless you’ve changed it is generally the Control key on the right of your keyboard. At the bottom of the VirtualBox window, it tells you in any case. Pressing that key will return the keyboard and mouse to the host PC.
Another interesting option for virtual machines is that you can save their state as is, and the next time you continue using it, without having to wait for Windows to close or similar. To do this, all you have to do is choose Save State when asked to close the virtual machine.
Another option that may be of great interest to you is Snapshots. If you’ve installed an operating system and configured it and left everything beautiful, why risk losing this harmony after installing apps? A snapshot is a copy of the state of a virtual machine, which you can retrieve at any time.
In this way, you can create a snapshot of perfectly installed Windows and then open an evil virus that corrupts all your files. The files will be corrupted and deleted, yes, but you will be able to recover the snapshot that will leave everything as it was when you created it. In VirtualBox snapshots (also called snapshots) are a bit hidden, to the right of the window.
As you can see, it’s not complicated at all to create and use a virtual machine. Of course, there are more complex options within the VirtualBox configuration and the virtual machine itself, but in the vast majority of cases, you will not need to touch anything else to be able to use one operating system within another, which, as we have already seen, has lots of cool apps.
Sharlene Meriel is an avid gamer with a knack for technology. He has been writing about the latest technologies for the past 5 years. His contribution in technology journalism has been noteworthy. He is also a day trader with interest in the Forex market.