Another, more portable, model of compilation makes use of a special layer of software called a virtual machine (VM) that resides ‘on top of’ an operating system. A virtual machine mimics the behaviour of a computer and has its own instruction set, just like a real CPU. In this model of compilation, the high-level language source code is not compiled to a hardware-dependent machine code. Instead, it is compiled to an intermediate code, which is the machine code of the virtual machine. In Java environments, the virtual machine code is called bytecode because each instruction is a byte in size. Using this intermediate code approach allows low-level, essentially executable, code to be moved unchanged between different computer systems (see Figure 4).
- 2 more items...