<s>
In	O
the	O
x86	B-Operating_System
computer	B-General_Concept
architecture	I-General_Concept
,	O
HLT	B-Language
(	O
halt	O
)	O
is	O
an	O
assembly	B-Language
language	I-Language
instruction	O
which	O
halts	O
the	O
central	B-General_Concept
processing	I-General_Concept
unit	I-General_Concept
(	O
CPU	O
)	O
until	O
the	O
next	O
external	O
interrupt	B-Application
is	O
fired	O
.	O
</s>
<s>
Interrupts	B-Application
are	O
signals	O
sent	O
by	O
hardware	O
devices	O
to	O
the	O
CPU	O
alerting	O
it	O
that	O
an	O
event	O
occurred	O
to	O
which	O
it	O
should	O
react	O
.	O
</s>
<s>
For	O
example	O
,	O
hardware	O
timers	O
send	O
interrupts	B-Application
to	O
the	O
CPU	O
at	O
regular	O
intervals	O
.	O
</s>
<s>
Most	O
operating	B-General_Concept
systems	I-General_Concept
execute	O
a	O
HLT	B-Language
instruction	I-Language
when	O
there	O
is	O
no	O
immediate	O
work	O
to	O
be	O
done	O
,	O
putting	O
the	O
processor	O
into	O
an	O
idle	B-Algorithm
state	I-Algorithm
.	O
</s>
<s>
In	O
Windows	B-Device
NT	I-Device
,	O
for	O
example	O
,	O
this	O
instruction	O
is	O
run	O
in	O
the	O
"	O
System	O
Idle	B-Algorithm
Process	I-Algorithm
"	O
.	O
</s>
<s>
On	O
x86	B-Operating_System
processors	O
,	O
the	O
opcode	B-Language
of	O
HLT	B-Language
is	O
0xF4	O
.	O
</s>
<s>
All	O
x86	B-Operating_System
processors	O
from	O
the	O
8086	O
onward	O
had	O
the	O
HLT	B-Language
instruction	I-Language
,	O
but	O
it	O
was	O
not	O
used	O
by	O
MS-DOS	B-Application
prior	O
to	O
6.0	O
and	O
was	O
not	O
specifically	O
designed	O
to	O
reduce	O
power	O
consumption	O
until	O
the	O
release	O
of	O
the	O
Intel	B-Device
DX4	I-Device
processor	O
in	O
1994	O
.	O
</s>
<s>
MS-DOS	B-Application
6.0	O
provided	O
a	O
POWER.EXE	O
that	O
could	O
be	O
installed	O
in	O
CONFIG.SYS	B-Device
and	O
in	O
Microsoft	O
's	O
tests	O
it	O
saved	O
5%	O
.	O
</s>
<s>
Some	O
of	O
the	O
first	O
100MHz	O
DX	O
chips	O
had	O
a	O
buggy	O
HLT	B-Language
state	O
,	O
prompting	O
the	O
developers	O
of	O
Linux	B-Application
to	O
implement	O
a	O
"	O
no-hlt	O
"	O
option	O
for	O
use	O
when	O
running	O
on	O
those	O
chips	O
,	O
but	O
this	O
was	O
fixed	O
in	O
later	O
chips	O
.	O
</s>
<s>
in	O
SSE2	B-General_Concept
intended	O
for	O
spin	O
loops	O
.	O
</s>
<s>
/	O
in	O
SSE3	B-General_Concept
for	O
thread	O
synchronization	O
.	O
</s>
<s>
Almost	O
every	O
modern	O
processor	O
instruction	B-General_Concept
set	I-General_Concept
includes	O
an	O
instruction	O
or	O
sleep	O
mode	O
which	O
halts	O
the	O
processor	O
until	O
more	O
work	O
needs	O
to	O
be	O
done	O
.	O
</s>
<s>
In	O
interrupt-driven	O
processors	O
,	O
this	O
instruction	O
halts	O
the	O
CPU	O
until	O
an	O
external	O
interrupt	B-Application
is	O
received	O
.	O
</s>
<s>
On	O
most	O
architectures	O
,	O
executing	O
such	O
an	O
instruction	O
allows	O
the	O
processor	O
to	O
significantly	O
reduce	O
its	O
power	O
usage	O
and	O
heat	O
output	O
,	O
which	O
is	O
why	O
it	O
is	O
commonly	O
used	O
instead	O
of	O
busy	B-Operating_System
waiting	I-Operating_System
for	O
sleeping	O
and	O
idling	O
.	O
</s>
<s>
In	O
most	O
processors	O
,	O
halting	O
(	O
instead	O
of	O
looping	O
)	O
also	O
reduces	O
the	O
latency	B-General_Concept
of	O
the	O
next	O
interrupt	B-Application
.	O
</s>
<s>
Since	O
issuing	O
the	O
HLT	B-Language
instruction	I-Language
requires	O
ring	B-Operating_System
0	I-Operating_System
access	O
,	O
it	O
can	O
only	O
be	O
run	O
by	O
privileged	O
system	O
software	O
such	O
as	O
the	O
kernel	B-Operating_System
.	O
</s>
<s>
Because	O
of	O
this	O
,	O
it	O
is	O
often	O
best	O
practice	O
in	O
application	O
programming	O
to	O
use	O
the	O
application	B-General_Concept
programming	I-General_Concept
interface	I-General_Concept
(	O
API	B-General_Concept
)	O
provided	O
for	O
that	O
purpose	O
by	O
the	O
operating	B-General_Concept
system	I-General_Concept
when	O
no	O
more	O
work	O
can	O
be	O
done	O
,	O
such	O
as	O
Linux	B-Application
's	O
sched_yield( )	O
.	O
</s>
<s>
This	O
allows	O
the	O
operating	B-General_Concept
system	I-General_Concept
's	O
scheduler	O
to	O
decide	O
whether	O
other	O
processes	O
are	O
runnable	O
;	O
if	O
not	O
.	O
</s>
<s>
If	O
every	O
process	O
is	O
sleeping	O
or	O
waiting	O
,	O
it	O
will	O
normally	O
execute	O
a	O
HLT	B-Language
instruction	I-Language
to	O
cut	O
power	O
usage	O
until	O
the	O
next	O
hardware	O
interrupt	B-Application
.	O
</s>
