Friday, July 11 2008, 12:56
Emulation vs Virtualization
For years, developers thought their programs would always run on newer platforms, with the desperate hope that Intel and Microsoft would build their new components and operating systems based on the previous ones, with full retro-compatibility. They were wrong. Whether retro-compatibility is a good or bad thing is an extensive topic. Dropping it is a good way to enforce good habits among developers and end-users. But these people may not want to have their habits enforced by an external company, even if it is the platform provider. This is an endless debate we can have, and will probably have on this blog… someday.
To understand these differences, let’s imagine first that we want to run the old DOS game on Windows Vista. To make it simple, what we call a compatibility issue is that the operating system cannot understand the content of the executable program: the way they communicate with each other is broken. This is a natural change, like if you wanted to insert a VHS into a DVD player. Nevertheless, we want to play our game, and we need a mediator to help the communication between the operating system and the game.
Standard: the program runs natively on the operating system.
A possible mediator is an emulator, like DOSBox. When you run your game through DOSBox, it is not run by the operating system but by the emulator itself. Display, sound, input, every instruction is caught, interpreted and executed by the emulator, which then passes its own instructions to the operating system. No DOS operating system, no old machine actually runs in the background.
Emulation: the program is interpreted by the emulator.
Another possible mediator is a virtual machine, like Virtual PC. If you install a good old MS-DOS on a virtual machine, and then install Lands of Lore on this virtualized operating system, the program will run natively. Basically, it is more or less as if you installed MS-DOS and ran the game directly on your physical computer (which is already quite creepy in some sense when your computer is a Core2Duo with gigabytes of RAM).
Virtualization: the program runs natively on the virtual machine.
But concretely, what are the visible differences between these two options?
- The emulator interprets the executable whereas the virtual machine runs it natively. Therefore, the execution is much slower on an emulator. However, the original DOS programs were supposed to run on very old processors, about 100 times slower than current ones. Then, we can expect a smooth execution in DOSBox.
- Conversely, a virtual machine is another instance of your machine. All programs running in it will run at full CPU speed (even if the process itself may have a lower priority). Therefore, for some old games whose execution timing was based on CPU clock, we can expect a very very fast, probably much too fast execution (some programs, like Moslo, exist to address this issue).
- Running the actual MS-DOS on a virtual machine triggers the same base memory problems as 15 years ago. Did you remember that you had only 640 ko of base memory and that everything low-level had to fit inside? If you don’t, be assured that your games will! On the other hand, DOSBox handles the base memory issue in the background (as Windows 98 did also in some sense).
From these characteristics, we can already imagine that emulation is more suited for executing old individual programs, whereas virtualization is more suited for running full configurations, usually more recent (“recent” being very relative here). The experiment and the answer soon on Romhack.Net…