Lably
Skip to content

HLT (x86 instruction)

Computer instruction which pauses execution

  • 2 min read
  • 3 chapters

Related on Lably

Through Operating system and CONFIG.SYS

Most operating systems execute a HLT instruction when there is no immediate work to be done, putting the processor into an idle state. In Windows NT, for example, this instruction is run in the "System Idle Process". On x86 processors, the opcode of HLT is 0xF4.

On ARM processors, the similar instructions are WFI (Wait For Interrupt) and WFE (Wait For Event).

History on x86

All x86 processors from the 8086 onward had the HLT instruction, but it was not used by MS-DOS prior to 6.0 and was not specifically designed to reduce power consumption until the release of the Intel DX4 processor in 1994. MS-DOS 6.0 provided a POWER.EXE that could be installed in CONFIG.SYS and in Microsoft's tests it saved 5%. Some of the first 100 MHz DX chips had a buggy HLT state, prompting the developers of Linux to implement a "no-hlt" option for use when running on those chips, but this was fixed in later chips.

Intel has since introduced additional processor-yielding instructions. These include:

  • PAUSE in SSE2 intended for spin loops. Available to userspace (low-privilege rings).
  • MONITOR/MWAIT in SSE3 for thread synchronization.
  • TPAUSE (timed pause) and UMONITOR/UMWAIT (userspace monitor/mwait). Available to userspace.

Sign in to keep reading

2 more chapters are free with a Lably account.

More in Computing and communication