Anonymous edits have been disabled on the wiki. If you want to contribute please login or create an account.


Warning for game developers: PCGamingWiki staff members will only ever reach out to you using the official press@pcgamingwiki.com mail address.
Be aware of scammers claiming to be representatives or affiliates of PCGamingWiki who promise a PCGW page for a game key.

Difference between revisions of "Virtualization"

From PCGamingWiki, the wiki about fixing PC games
m (dramatically > drastically)
Line 80: Line 80:
 
{{W|Compatibility layer|'''''Compatibility layers'''''}} are another common but less known type of virtualization which allows applications of a legacy or foreign system to run in environments it was never intended for. The layer intercepts system calls made by the application during runtime and manipulates or translates them into a more appropriate equivalent if necessary. This can range from just fixing up a few individual system calls that was changed in later versions of the OS than the application was developed for, to translating ''all'' system calls to alternate APIs allowing the application to run on completely foreign systems. If a direct one-to-one translation is not possible between the original and replacement APIs, the compatibility layer also emulates the behaviors of the original API as much as possible through multiple calls to the replacement API.
 
{{W|Compatibility layer|'''''Compatibility layers'''''}} are another common but less known type of virtualization which allows applications of a legacy or foreign system to run in environments it was never intended for. The layer intercepts system calls made by the application during runtime and manipulates or translates them into a more appropriate equivalent if necessary. This can range from just fixing up a few individual system calls that was changed in later versions of the OS than the application was developed for, to translating ''all'' system calls to alternate APIs allowing the application to run on completely foreign systems. If a direct one-to-one translation is not possible between the original and replacement APIs, the compatibility layer also emulates the behaviors of the original API as much as possible through multiple calls to the replacement API.
  
The performance impact of a compatibility layer comes down to the extent of translation required, whether direct one-to-one translation is possible or if more complex translation is needed, as well as other factors involved such as the accuracy and performance of the translation and use of any custom behavior to optimize and fix unnecessary performance issues and overhead caused by unoptimized calls made by the application. As a result applications running through a compatibility layers is often capable of reaching close to native performance, and in some cases even capable of outperforming native systems due to the aforementioned optimizations made by the compatibility layer.
+
The performance impact of a compatibility layer comes down to the extent of translation required, whether direct one-to-one translation is possible or if more complex translation is needed, as well as other factors involved such as the accuracy and performance of the translation and use of any custom behavior to optimize and fix unnecessary performance issues and overhead caused by unoptimized calls made by the application. As a result applications running through a compatibility layers is often capable of reaching close to native performance, and in some cases even outperform native systems due to the aforementioned optimizations made by the compatibility layer.
  
 
Some common compatibility layers are:
 
Some common compatibility layers are:

Revision as of 09:01, 18 September 2022

This page is for a general overview of virtualization. For software emulating a gaming console, see Emulation.

Virtualization refers to various methods used to creating a virtual version of something at the same abstraction level. This is not to be confused with emulation, which is the replication of the same or different hardware via software (e.g. a NES emulator running on a PC) and has significant performance penalties due to conversion through an interpreter compared to virtualization methods.

Key points

Allows the use of older software which may have problems running natively on newer OSes or hardware.
3D acceleration support varies drastically between virtualization type as well as software.
Virtualization will generally run slower than software running natively unless the virtualization layer includes or enables optimizations that the software benefits from.

General information

Virtualization
quickhakker - Program Tutorial: Running 16 bit programs on 64 bit operating systems - YouTube

Hardware virtualization

Removes the need to install another OS to the host system and having to separately boot into it.
Snapshot or save state features allow saving a virtual machines current state, which can be useful for troubleshooting or testing.

Virtualization is commonly used to refers to hardware virtualization, the act of creating and running an operating system within a virtual machine (VM) alongside code belong to other virtual machine(s) running on the same architecture and hardware (without converting; no emulation). As few elements as possible are emulated, therefore most of the expected CPU performance can be obtained with a variable overhead depending on the system. The underlying machine used for the virtualization is referred to as the host, and the software that creates these virtual machines is called the hypervisor or virtual machine monitor (VMM), while the virtual machines themselves are often referred to as guests.

Modern personal computers have additional hardware capabilities to assist in virtualization such as Intel VT-x and AMD-V, commonly just referred to as hardware-assisted virtualization. While hardware virtualization can be used even without these features enabled, they are often recommended or required to allow virtual machines to achieve their most optimal performance.

A common use case for hardware virtualization is to circumvented compatibility issues with older software by running the software inside a suitable VM. One example is 16-bit program compatibility as support for these is not included in 64-bit variants of Windows. However since modern CPUs still support 16-bit execution through the virtual 8086 mode when running in legacy mode, hardware virtualization allows 16-bit execution through a suitable guest VM with a 16-bit or 32-bit operating system installed.

Hardware virtualization also has plenty of other use cases such as for e.g. running an isolated environment (sandbox), running older software, or a different OS without dual booting the host machine. Modern versions of Hyper-V also features the ability to natively boot some OSes from virtual hard disks, giving the user the benefits of dual booting different OSes without having to manage separate boot launchers or hard drive partitions.

When running an older version of an OS in a VM, the same security risks apply when installing & running that OS natively, so there will always be a possibility of viruses and malware that can take advantage of the guest OSes vulnerabilities; even of the VM software itself. If the software in question does not need access to internet, it is usually safer to disable all connections from the VM to the host computer. When using shared folders, it is safer to mark the folder as read-only if moving files to the host is not required. Taking these security measures into consideration can make running a guest OS considerably more secure.

Application virtualization

Application virtualization is a form of software technology where a virtualization layer is used to isolate applications files and/or registry keys from the host machine, allowing the ability to make programs completely portable between different computers or system configurations. Instead of virtualizing the entire operating system, as with a VM through hardware virtualization, only the files and/or registry keys of the application are virtualized. This method allows for a wide range of isolation options, such as the application being able to merge with the existing system, select parts of it, or to be completely isolated from the rest of the system. Necessary prerequisites or runtimes can also be bundled within the virtual application bundle itself instead of having to be natively installed on the host machine.

This type of technology is most often used for enterprise purposes where a third-party application suite comprising of a management tool, distribution channel, and client agent is used to create, distribute, and run virtualized applications. The closely related consumer option is the so called Portable application creators which allows users to create portable applications which does not require an installation to be run on a system. These portable applications are most often agentless in that they do not rely on a pre-installed client agent on a computer to run.

Examples of some common solutions:

Software Primary Audience Platforms Homepage
Citrix Virtual Apps Enterprise
Windows
Link
Cameyo Enterprise
Windows
Link
Microsoft App-V Enterprise
Windows
Link
PortableApps.com Consumer
Windows
Link
Sandboxie Plus Consumer
Windows
Link
Turbo Studio Enterprise
Windows
Link
VMware ThinApp Enterprise
Windows
Link

Compatibility/translation layers

Compatibility layers are another common but less known type of virtualization which allows applications of a legacy or foreign system to run in environments it was never intended for. The layer intercepts system calls made by the application during runtime and manipulates or translates them into a more appropriate equivalent if necessary. This can range from just fixing up a few individual system calls that was changed in later versions of the OS than the application was developed for, to translating all system calls to alternate APIs allowing the application to run on completely foreign systems. If a direct one-to-one translation is not possible between the original and replacement APIs, the compatibility layer also emulates the behaviors of the original API as much as possible through multiple calls to the replacement API.

The performance impact of a compatibility layer comes down to the extent of translation required, whether direct one-to-one translation is possible or if more complex translation is needed, as well as other factors involved such as the accuracy and performance of the translation and use of any custom behavior to optimize and fix unnecessary performance issues and overhead caused by unoptimized calls made by the application. As a result applications running through a compatibility layers is often capable of reaching close to native performance, and in some cases even outperform native systems due to the aforementioned optimizations made by the compatibility layer.

Some common compatibility layers are:

  • Wine (originally an acronym for "Wine Is Not an Emulator") is a compatibility layer that translates and allows running Windows applications on Linux, macOS, and other Unix-like systems.
  • Display wrappers such as dgVoodoo2 are a type of compatibility layer that translates calls made in one graphics API to another API.
  • 32-bit versions of Windows included WOW (Windows on Windows) which provided support for running legacy 16-bit programs written for Windows 3.x or earlier. This compatibility layer was never included in 64-bit versions of Windows despite the underlying component NTVDM including full emulation capabilities of 16-bit CPU instructions.[1][2]
  • 64-bit versions of Windows includes WOW64 (Windows 32-bit on Windows 64-bit) which provides support for running 32-bit applications.
  • Windows Compatibility Mode is an underlying compatibility engine within Windows that uses compatibility shims to apply fixes and changes for applications that might otherwise not function properly.
  • D3D9On12 is a mapping layer in Windows 10 and 11 that maps calls made by the D3D9 API to the D3D9 display driver interface (the role D3D9On12 fills in this case) over to their respective D3D12 API equivalent. It is automatically used by Windows for display drivers that lack native D3D9 drivers and allows D3D9 applications to still be used provided the driver supports D3D12. It differs from more typical display wrappers as the original D3D9 API and runtime is still present and doing its thing — D3D9On12 essentially sits "below" those at the driver level.

Virtualization and emulation software for PC

These are a number of hardware virtualization and emulation software for PC.

Software Type Platforms Wikipedia Homepage Cost
DOSBox Emulation
Windows
macOS (OS X)
Linux
Link Free
Parallels Virtualization
macOS (OS X)
Link Costs
PCem Emulation
Windows
Linux
Link Free
QEMU Virtualization or Emulation
Windows
macOS (OS X)
Linux
Link Free
VirtualBox Virtualization
Windows
macOS (OS X)
Linux
Link Free
VMware Virtualization
Windows
macOS (OS X)
Linux
Link Basic free
Premium costs

DOSBox

Suitable for DOS era gaming (pre-1998).
DOSBox emulates DOS.
For more information see DOSBox.

PCem

Suitable for Windows 95/98 gaming.
3D hardware acceleration is supported on Windows 9x (3dfx Voodoo 3 3000 emulation)
All emulation is done with the CPU.[citation needed] Pentium 3 350-500 MHz + TnT2 equivalent performance is possible on Ryzen 3xxx- Intel 10th Gen CPUs.
The developer has quit from the project. [citation needed]
Only supports for 4:3 resolutions [citation needed]
Mouse movement can be sluggish

QEMU

On Linux, using QEMU virtualisation + KVM + GPU-passthrough can achieve almost native performance (80-90%).
On Linux, GPU-passthrough requires multiple GPUs.
Greater compatibility with programs due to emulation.
High performance penalties when emulating.

VirtualBox

Mostly open-source with non-open source material free for personal use.
Due to incomplete 3D hardware acceleration (and instruction set support issues on AMD), it is not suitable for 3D gaming, however DOS and software-rendered 3D games can run.

VMware

Superior 3D hardware acceleration support in Windows XP and later OSes.
For Windows hosts, VMware is generally the best option for gaming.
Only supports 60Hz refresh-rate. [citation needed]
Only supports stereo sound output. [citation needed]
VMware has stopped developing its virtual 3D drivers for Windows XP and Vista. The final drivers for Windows XP runs some DirectX 6-7-8 games very slowly. For lightweight games, Windows XP has enough performance, and for more demanding games, using Vista or 7 guests are strongly recommended.


References

  1. Wikipedia - Virtual DOS machine - Windows NTVDM - last accessed on 2022-09-17
    "Since virtual 8086 mode is not available on non-x86-based processors (more specifically, MIPS, DEC Alpha, and PowerPC) NTVDM was instead implemented as a full emulator in these versions of NT, using code licensed from Insignia's SoftPC. Up to Windows NT 3.51, only 80286 emulation was available. With Windows NT 4.0, 486 emulation was added."
  2. GitHub - leecher1337/ntvdmx64 - last accessed on 2022-09-17
    "NTVDMx64 is a port of the well-known Windows NTVDM, which is used by windows to run DOS-Applications, to 64bit Windows, so that you can run your DOS-Applications on 64bit Windows too. This is a proof-of-concept that it is possible to run the NTVDM on 64bit Windows"