x86-64 and Arm: two instruction families
Video 024 of 140 in Virtualization Foundations, in the unit “CPUs: sockets, cores, threads and caches”. 4:07, with English and Hindi audio.
Every processor understands its own set of machine instructions, a kind of language. Two main families matter today: x86-64 and Arm. A program built for one family cannot simply run on the other, and that choice matters for virtual machines and for the images you download. This article explains what an instruction family is, how the two differ, why a virtual machine cares, and how to check the family of your own machine.
What you will learn
- x86-64 and Arm are two instruction families, and a program is built for one of them.
- A virtual machine runs close to native speed only on a host of the same family.
- Several names mean the same family, such as amd64 and x64 for x86-64.
- Check the family with uname -m and dpkg --print-architecture before you move a workload.
From source code to a program that one chip can run
A programmer writes source code in a language such as C. A compiler then translates it into machine instructions. Those instructions are for one family of processors, and the compiler is told which family to aim at.
A program built for one family cannot simply run on the other. Its instructions mean nothing to a different chip. The two families are not interchangeable, so a program must be built again for each family it will run on.
How x86-64 and Arm differ in practice
- x86-64 is common in most PCs and most data-centre servers today. Its chips include Intel Xeon and AMD EPYC.
- Arm64 is common in phones, Apple laptops and a growing share of cloud servers. Its chips include Ampere, and some cloud providers sell their own Arm chips.
Several names mean the same family. Intel 64, AMD64, amd64 and x64 all point to x86-64. On the Arm side, AArch64 and arm64 both mean the 64-bit Arm family. Software downloads and cloud images carry these labels, so reading them correctly prevents a wrong choice.
Why a virtual machine cares about the family
A virtual machine is a software computer. It runs its own operating system, called the guest, on a slice of a real server. When the host is the same family, the guest's instructions run directly on the real chip, so the work runs close to native speed.
If the families differ, the host must emulate the instructions in software. Emulation is a workable way to run another family, but the translation happens in software, so the program runs much more slowly than native code. Check the family first.
How to check your machine's family
Run uname with the machine option. On an Intel or AMD server it prints the 64-bit x86 family name, x86_64.
uname -mOn Ubuntu, dpkg gives the package name for the same family, which is amd64 on x86-64 machines.
dpkg --print-architectureNote: On an Arm machine, uname prints aarch64 and dpkg prints arm64. Copying an Arm image onto an x86-64 host is a common mistake, and the program then fails to start.
Check the family of your machine
You need a Linux terminal on the machine you want to check. Run both commands, because each one names the family in a different style.
Print the machine hardware family. This is the name the processor reports for itself.
uname -mWhat you should see: x86_64 on an Intel or AMD machine, or aarch64 on an Arm machine.
Print the package architecture that Ubuntu uses to choose downloads. This names the same family in package style.
dpkg --print-architectureWhat you should see: amd64 on an x86-64 machine, or arm64 on an Arm machine.
Terms
- Instruction family
- A set of machine instructions that a family of processors understands, such as x86-64 or Arm64.
- Compiler
- A program that translates source code into machine instructions for one processor family.
- Emulation
- Running instructions for one processor family on another by translating them in software, which is much slower.
- Guest
- The operating system that runs inside a virtual machine.
Check yourself
Why can an Arm program not run on an x86-64 host?
The chip cannot read the instructions of the other family, so the program fails to start unless it is built again or run through slow emulation.
What does uname -m print on an Intel or AMD server?
x86_64, the name of the 64-bit x86 family.
Why does the host family matter for a virtual machine?
On the same family the guest runs directly on the real chip, close to native speed. On a different family, the host must emulate each instruction in software, which is much slower.
Previous: Pipelines and branch prediction, in brief. Next: CPU feature flags: what the chip can do.