Emulation

Emulation runs software built for one kind of hardware on another by imitating the original hardware in software.

Emulation is the imitation of one machine by another. An emulator reads each instruction written for the original processor and carries it out with the host's own instructions. It also imitates the original devices, such as disks and screens. This lets programs for one CPU architecture, such as Arm, run on another, such as x86.

Emulation is flexible but slow, since each original instruction becomes several host instructions. Translating blocks of code once and reusing them, as QEMU and Apple's Rosetta do, recovers much of the speed. Virtualization is different: it runs the guest's instructions directly on a processor of the same architecture. Emulation is used when the architectures differ, and virtualization when they match.

Sandboxes normally run on hardware of their own architecture, so their code runs at full speed under virtualization. Emulation lets a sandbox run a program built for another architecture, such as an x86 tool on an Arm host, at a cost in speed. Hypervisors also emulate simple devices for their guests, such as a serial port or a basic disk. Platforms keep this emulated part small, since it is code that untrusted guests can reach.