Why we emulated the devices that we do?
Inside of Virtual PC we provide a number of 'emulated' devices - like the S3 Trio video card and the Intel 21140 network card. People regularly ask me why we emulate these specific devices - and there are a number of reasons. It is important to know that writing an emulated hardware device is relatively challenging - so the emulated devices we have were carefully chosen as it is a non-trivial task to change these devices.
- Compatibility – a very important consideration when looking at devices to emulate is how broadly supported it is. Today Virtual PC supports DOS through Windows XP, and OS/2. Further more Virtual PC is capable of running 100's of other operating systems. With this in mind it would not be a good idea for us to emulate a device that did not have drivers available for all these platforms.
- Functionality - kind of a no-brainer, but the devices that we emulate need to provide *all* of the possible functionality that we need. For example - emulating a SCSI card that was not capable of clustering would have been a bad idea - as this was one of our primary motivations for emulating a SCSI card.
- Performance - we need to try and emulate devices that will provide the best performance for the virtual machine. And this is where things get complicated. One key concept to understand is that with an emulated device - the computation that would normally be performed by the physical device is actually performed by the computers CPU - with a significant performance overhead. This ends us up in the interesting scenario where a virtual machine’s emulated devices are actually competing with the virtual machine’s virtual processor for the same core resource - the physical CPU. Furthermore, as we emulate more and more advanced devices, they require more and more processing power to emulate. This means that emulating a more advanced device that would perform better in the real world can actually result in slower performance in the virtual world. At the end of the day we end up needing to choose the simplest possible device that provides the compatibility and functionality that we need.
Cheers,
Ben
Comments
Anonymous
January 26, 2005
I don't think the performance angle is as clear cut as you say. Firstly you can offload to devices or optimised code sequences on the host computer. One example would be drawing ellipses on the graphics card. If the card you emulate cannot draw them, then the guest OS will sit there drawing it pixel by pixel. On the other hand if the emulated card can draw ellipses you can recognise that instruction and tell the host card to draw an ellipse. In all cases, the host CPU or the host graphics card drawing the ellipses will be faster than the guest OS drawing them pixel by pixel. (BTW I think you got the video card right in VPC).
Similar things will apply for other hardware (eg TCP checksums on network cards). For disk controllers you'd want to emulate a card that can be supplied multiple outstanding large requests so you can hand that off to the host operating system to deal with. The host is way better at scheduling the real CPU, memory, hard disk and other peripherals and can do concurrently.
You also have the option of emulating two devices. One can be based on real hardware meeting the criteria you give above, and the other can be optimised for VPC and require specific guest device drivers. VMWare do this for network cards (although bizarrely only for the Linux hosted version, not the Windows hosted version). You can set whether each emulated network card is the emalated AMD PCNet 32 or the vmxnet one.Anonymous
January 27, 2005
Was performance the reason you emulated the Intel 21140 instead of an Intel 8255x (say a Pro 100B)?
As the 8255x family is probably the most common PCI network card in existence. I had never seen nor heard of an Intel 21140 before messing with Virtual Server.
I like the idea of a choice of hardware emulation, it seems like it might make migrating from physical hardware to a virtual machine easier.Anonymous
January 27, 2005
The 21140 predecessors were also packaged up by DEC (prior to becoming Compaq prior to becoming HP). I encountered many many of them as real hardware.
Note that I wasn't advocating choosing between two real pieces of hardware. It was between one real piece and one virtual (never existed) where the latter requires VPC specific device drivers. That gives you a choice between maximum compatibility and maximum performance.Anonymous
January 27, 2005
I have one specific question about the emulated sound card . Many DOS games require the information which interrupt&port&DMA the sound card is using. We're either required to set a environment variable "BLASTER" or given a setup tool to select from a list of choices. So what is these settings to the VPC sound card?
Also is there a DOS driver for the emulated sound card?Anonymous
January 27, 2005
try this one:
set BLASTER=A220 I5 D1 H5 P330 T6
I even got the SB16 Driver for Windows 3.1x to work, so that I could run WinPlay3 for listening to an mp3. :)
And I also think the choise of the DEC 21x4x is very nice, too because now I can run the QNX 1.44 Floppy Challenge. A full Operating System (QNX 4), a GUI, a Webbrowser and Webserver on one floppy disk. The network version supports three nic's: 3c509, ne2k and dec 21x4x. And it's quite fun to surf the net for a while with it, even though it's from about '98/'99. It's a bit hard to get, since QNX has stopped it's distribution, but it's available on the Ultimate Boot CD (http://www.ultimatebootcd.com).Anonymous
January 28, 2005
That's very useful information. Many thanks SvOlliAnonymous
February 02, 2005
Here's a question. Why not emulate Intel graphics, so there can be Direct3D and OpenGL support as well (only the most basic of course...)?Anonymous
February 02, 2005
Robert -
The DEC 21140 chipset is an older chipset and as a result has better support for legacy platforms.
Th2 -
This comes back to the performance issue - and Intel graphics chipset is much more complex than the S3 Trio - and hence overall performance would be slower.
Cheers,
BenAnonymous
February 03, 2005
The comment has been removedAnonymous
February 14, 2005
Okay, if Intel Graphics is too much, then why not do an ATI MACH64? Or perhaps an 8 MB Matrox Millenium card? Why not emulate 3D graphics (Direct3D and OpenGL), so that legacy games will not run too fast in a modernized computer system?Anonymous
January 03, 2011
The comment has been removedAnonymous
January 05, 2011
Htos1 - You can read about where to get the drivers (and how to setup networking on Windows 3.11) here: blogs.msdn.com/.../networking-windows-3-11-under-virtual-pc.aspx Cheers, BenAnonymous
March 01, 2011
The comment has been removedAnonymous
October 05, 2012
Is there anyway to write our own emulated hardware?Anonymous
October 05, 2012
Bloss - No, this is not possible Cheers, BenAnonymous
June 17, 2013
Hi Ben, I have installed parallel Windows XP via VM on my iMAC so I can run flight simulators. However, when I launch the simulator program, an error message pops up saying..."cannot directly access video memory in primary display". Is there anything that I can do to fix this? Thanks.