HLT
Encyclopedia
In the x86 computer architecture
Computer architecture
In computer science and engineering, computer architecture is the practical art of selecting and interconnecting hardware components to create computers that meet functional, performance and cost goals and the formal modelling of those systems....

, HLT (halt) is an assembly language
Assembly language
An assembly language is a low-level programming language for computers, microprocessors, microcontrollers, and other programmable devices. It implements a symbolic representation of the machine codes and other constants needed to program a given CPU architecture...

 instruction which halts the CPU until the next external interrupt
Interrupt
In computing, an interrupt is an asynchronous signal indicating the need for attention or a synchronous event in software indicating the need for a change in execution....

 is fired. Such interrupts are used by devices in order to signal to the CPU that an event occurred which the CPU shall react on. Also, hardware timers can signal an interrupt to the CPU in order to execute timed work.

The HLT instruction is executed by the operating system
Operating system
An operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

 when there is no immediate work to be done, and the system enters its idle state
Idle (CPU)
A computer processor is described as idle when it is not being used by any program.Programs which make use of CPU Idle Time mean that they run at a low priority so as not to impact programs that run at normal priority...

. In Windows NT
Windows NT
Windows NT is a family of operating systems produced by Microsoft, the first version of which was released in July 1993. It was a powerful high-level-language-based, processor-independent, multiprocessing, multiuser operating system with features comparable to Unix. It was intended to complement...

, for example, this instruction is run in the "System Idle Process
System idle process
In Windows NT operating systems, the System Idle Process contains one or more kernel threads which run when no other runnable thread can be scheduled on a CPU. For example, there may be no runnable thread in the system, or all runnable threads are already running on a different CPU...

".

On x86 processors, the opcode
Opcode
In computer science engineering, an opcode is the portion of a machine language instruction that specifies the operation to be performed. Their specification and format are laid out in the instruction set architecture of the processor in question...

 of HLT is 0xF4.

Process

Almost every reasonably modern processor instruction set
Instruction set
An instruction set, or instruction set architecture , is the part of the computer architecture related to programming, including the native data types, instructions, registers, addressing modes, memory architecture, interrupt and exception handling, and external I/O...

 includes an instruction or sleep mode which halts the processor until more work needs to be done. In interrupt driven processors, this instruction halts the CPU until an external interrupt is received. On most architectures, executing such an instruction allows the processor to significantly reduce its power usage and heat output, which is why it is commonly used instead of busy waiting
Busy waiting
In software engineering, busy-waiting or spinning is a technique in which a process repeatedly checks to see if a condition is true, such as whether keyboard input is available, or if a lock is available. Spinning can also be used to generate an arbitrary time delay, a technique that was necessary...

 to reduce power consumption and heat.

Use in operating systems

Since issuing the HLT instruction requires ring 0 access, it can only be run by privileged system software, such as the kernel. Because of this, it is often best practice in application programming to use the API provided for that purpose by the operating system when no more work can be done. This is referred to as "yielding" the processor. This allows the operating system's scheduler
Scheduling (computing)
In computer science, a scheduling is the method by which threads, processes or data flows are given access to system resources . This is usually done to load balance a system effectively or achieve a target quality of service...

 to decide if other processes are runnable; if not, it will normally issue the HLT instruction to cut power usage.

See also

  • Halt and Catch Fire
    Halt and Catch Fire
    Halt and Catch Fire, known by the mnemonic HCF, refers to several computer machine code instructions that cause the CPU to cease meaningful operation...

  • Idle task
  • X86
  • Computer architecture
    Computer architecture
    In computer science and engineering, computer architecture is the practical art of selecting and interconnecting hardware components to create computers that meet functional, performance and cost goals and the formal modelling of those systems....

  • Instruction set
    Instruction set
    An instruction set, or instruction set architecture , is the part of the computer architecture related to programming, including the native data types, instructions, registers, addressing modes, memory architecture, interrupt and exception handling, and external I/O...

  • System Idle Process
    System idle process
    In Windows NT operating systems, the System Idle Process contains one or more kernel threads which run when no other runnable thread can be scheduled on a CPU. For example, there may be no runnable thread in the system, or all runnable threads are already running on a different CPU...

  • NOP
    NOP
    In computer science, NOP or NOOP is an assembly language instruction, sequence of programming language statements, or computer protocol command that effectively does nothing at all....

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK