Mente

virtual_machine.htm

Virtual Machines

A virtual machine is a program that acts like a computer. It simulates a CPU along with a few other hardware components.

VMs allow us to port programs into several CPUs.

https://www.jmeiners.com/lc3-vm/img/vm.gif

The only cost is the overhead of the VM itself and the further abstraction from the machine. This is a trade-off that's taken.

Ethereum smart contracts are examples of virtual machines. They are run inside of a VM that has no access to the file system, network, disc, etc...

Instruction Set

Instructions have both an opcode and a set of parameters.

Each opcode represents tasks the CPU "knows" how to do.

Examples:

enum