[Tutor] Virtual Machine Terminology

Gonçalo Rodrigues op73418 at mail.telepac.pt
Wed Apr 21 18:30:52 EDT 2004


Em Wed, 21 Apr 2004 14:28:20 -0500, Vicki Stanfield
<vicki at thepenguin.org> atirou este peixe aos pinguins:

>Is Python itself or wxPython or a program written in Python considered to be a
>virtual machine? Confused by the term itself, I went online and found this
>definition:
>
>A virtual machine is a machine written in software, which provides an abstract
>layer to applications. In a layered application the virtual machine acts as the
>lowest layer, providing abstraction over the native environment. If an
>application is be ported to another environment only the virtual machine needs
>to be re implemented. The application layers written above it remain unchanged,
>as they use the same abstract interface to the virtual machine.
>
>This definition seems to fit almost any programming or scripting language. Is a
>BASH script which handles printing also then a virtual machine? Or even the
>operating system? Can anyone shed some light on this for me?
>

Yes, the definition is a little too vague...

Think of a virtual machine (VM) as an application simulating an
idealized computer. As you know, the original language of every CPU is
assembler, and just as a program in C, say, is translated to this
assembler language so that it can be run on your home computer, a
Python program (and a Java, and a Perl, and...) is compiled to the
"assembler language" of the Python virtual machine, so that Python's
VM (another program) can run it.

As the above definition states, this provides a layer of abstraction.
You can change the implementation of the VM without all the programs
targetting it. Also, note that the "assembler language" of Python
is/was especially designed with the Python language in mind. It is
considerably at a "higher level" than your usual raw asembler (copy
this address of memory to the register, push this address to the
stack, pop from the stack, etc..) with bytecodes (the names of the
single Python "assembler language" instructions) for fetching an
attribute, calling a method, etc.

Hope it helps, with my best regards,
G. Rodrigues



More information about the Tutor mailing list