虛擬機器
In general terms, 在计算机科学中的“虚拟机”是指一种特殊的软件,他可以在计算机平台和最终用户之间建立一种环境,而最终用户则是基于这个环境来操作软件。a virtual machine in computer science is software that creates an environment between the computer platform and the end user in which the end user can operate software.
确切的说,“虚拟机”这个术语有几个不同的含义:Specifically, the term virtual machine has severa7l distinct meanings:
定义
原始含义Original meaning
“虚拟机”最原始的含义是指The original meaning of virtual machine is the creation of a number of different identical execution environments on a single computer, each of which exactly emulates the host computer. This provides each user with the illusion of having an entire computer, but one that is their "private" machine, isolated from other users, all on a single physical machine. The host software which provides this capability is often referred to as a virtual machine monitor or hypervisor.
应用程序虚拟机Application virtual machine
The second, and now more common, meaning of virtual machine is a piece of computer software that isolates the application being used by the user from the computer. Because versions of the virtual machine are written for various computer platforms, any application written for the virtual machine can be operated on any of the platforms, instead of having to produce separate versions of the application for each computer and operating system. The application is run on the computer using an interpreter or Just In Time compilation.
操作系统虚拟机Operating system virtual machine
The term virtual machine is now also used to refer to the environment created by an emulator, where software is used to emulate an operating system for the end user, while the computer runs its own native operating system.
并行虚拟机Parallel virtual machine
More recently, the term virtual machine is also used to refer to a Parallel Virtual Machine (PVM). In this case, the virtual machine software allows a single environment to be created spanning multiple computers, so that the end user appears to be using only one computer rather than several.
技术Techniques
Emulation of the underlying raw hardware
Since each user can run whatever operating system they want, this type of virtual machine allows users to do things like run two different operating systems (sometimes referred to as "guests") on their "private" virtual computers. Also, experimental new versions of operating systems can be run at the same time as older, more stable, versions, each in a separate virtual machine. The process can even be recursive; IBM debugged new versions of its virtual machine operating system, VM, in a virtual machine running under an older version of VM.
One early user of this concept was the IBM VM/CMS time-sharing product, which used a relatively simple interactive computing single-user operating system, CMS, which ran on top of VM. In that way, CMS could be written simply, as if it were running alone, and the VM operating system quietly provided multitasking and resource management services behind the scenes.
Not all VM users had to run CMS, though; some preferred to run some form of OS/360 (or eventually MVS) in one or more virtual machines, to provide traditional batch processing services to those users who wanted that. VM is still used today on IBM mainframes, and in some which are used as Web servers, the operating system run in each of many virtual machines is Linux.
The VMware, twoOStwo and SVISTA packages do the same thing on modern PCs, trapping all hardware accesses and simulating all of a motherboard except for the processor.
In other case plex86 can run only Linux under Linux, using specific patched kernel, so it's not emulate processor, but uses bochs emulation of motherboard devices.
The x86 处理器架构 as used in modern PCs does not actually meet the Popek and Goldberg virtualization requirements. Notably, there is no execution mode where all privileged machine instructions always trap, which would allow per-instruction virtualization. As a result, VMware and similar virtualization software for the x86 must dynamically recompile privileged mode code. This technique incurs some performance overhead as compared to a VM running on a natively virtualizable architecture such as the IBM System/370 or Motorola MC68020. Intel and AMD have each announced plans to add x86 virtualization capabilities to future x86 processors (see Vanderpool).
Emulation of a non-native system
Some of this class of virtual machines are emulators; these allow software written for one machine to run on another. Emulation for computer systems can include emulation for both different machine architectures, and operating systems.
Others produce behaviors and capabilities of a machine that doesn't necessarily exist as an actual piece of hardware but may only be a detailed specification. For example, the p-Code machine specification (one of the first, used for support of Pascal) was a description of a specific set of capabilities and behaviors that programmers could use to write programs that would run on any computer running virtual machine software that correctly implemented the specification.
More modern examples include the specification of the Java virtual machine and the Common Language Infrastructure virtual machine at the heart of the Microsoft .NET initiative.
These allow diverse computers all to run software written to that specification; the virtual machine software itself must be written separately for each type of computer on which it runs.
List of virtual machines
- Common Language Runtime (Microsoft .NET)
- FAUmachine (emulates a PC)
- Glulx (for game playing, version not yet 1.0, similar to Z-machine)
- Forth virtual machine
- Java虚拟机 (JVM)
- MMIX (hypothetical CPU for describing algorithms)
- O-code machine (historical, used for BCPL, a fore-runner of C)
- p-Code machine (historical, mainly used to run Pascal programs)
- Perl (the virtual machine of Perl 5 is not separately accessible)
- Parrot (a virtual machine which is currently developed for interpreted dynamic languages (Perl 6, Ruby, ...).
- SECD machine (for Lisp-like languages)
- ScummVM (for playing adventure games, current GNU implemantations available)
- Smalltalk virtual machine
- Squeak virtual machine (VM for the Smalltalk variant Squeak)
- SVISTA (small powerful virtual machine, but project seems dead now)
- twoOStwo (small powerful virtual machine, but project seems dead now)
- Warren Abstract Machine (for executing Prolog programs)
- Inferno (simulates an Operating System)
- Ten15 virtual machine
- TrueType virtual machine
- User-mode Linux a virtual machine kernel modification for Linux.
- Virtual PC (Microsoft's virtual machine software)
- VMWare (powerful, professional-level virtual machine software)
- Xen
- Z-machine (historical, used for text adventure games)
See also
- Gerrit Blaauw (A significant designer of the IBM/360, an early virtual computing architecture)
- Threaded code (A common implementation technique for application virtual machines)
- Computing
- LLVM (The University of Illinois's Low Level Virtual Machine, a compiler toolset)