<s>
In	O
computing	O
,	O
a	O
hang	O
or	O
freeze	B-General_Concept
occurs	O
when	O
either	O
a	O
process	B-Operating_System
or	O
system	O
ceases	O
to	O
respond	O
to	O
inputs	B-General_Concept
.	O
</s>
<s>
A	O
typical	O
example	O
is	O
when	O
computer	O
's	O
graphical	B-Application
user	I-Application
interface	I-Application
(	O
such	O
as	O
Microsoft	B-Application
Windows	I-Application
)	O
no	O
longer	O
responds	O
to	O
the	O
user	O
typing	O
on	O
the	O
keyboard	O
or	O
moving	O
the	O
mouse	O
.	O
</s>
<s>
The	O
term	O
covers	O
a	O
wide	O
range	O
of	O
behaviors	O
in	O
both	O
clients	B-Protocol
and	O
servers	B-Application
,	O
and	O
is	O
not	O
limited	O
to	O
graphical	B-Application
user	I-Application
interface	I-Application
issues	O
.	O
</s>
<s>
Hangs	O
have	O
varied	O
causes	O
and	O
symptoms	O
,	O
including	O
software	O
or	O
hardware	B-Architecture
defects	O
,	O
such	O
as	O
an	O
infinite	B-Algorithm
loop	I-Algorithm
or	O
long-running	O
uninterruptible	O
computation	O
,	O
resource	O
exhaustion	O
(	O
thrashing	B-General_Concept
)	O
,	O
under-performing	O
hardware	B-Architecture
(	O
throttling	O
)	O
,	O
external	O
events	O
such	O
as	O
a	O
slow	O
computer	B-Architecture
network	I-Architecture
,	O
misconfiguration	O
,	O
and	O
compatibility	B-Device
problems	O
.	O
</s>
<s>
The	O
fundamental	O
reason	O
is	O
typically	O
resource	O
exhaustion	O
:	O
resources	O
necessary	O
for	O
some	O
part	O
of	O
the	O
system	O
to	O
run	O
are	O
not	O
available	O
,	O
due	O
to	O
being	O
in	O
use	O
by	O
other	O
processes	B-Operating_System
or	O
simply	O
insufficient	O
.	O
</s>
<s>
A	O
hang	O
may	O
be	O
temporary	O
if	O
caused	O
by	O
a	O
condition	O
that	O
resolves	O
itself	O
,	O
such	O
as	O
slow	O
hardware	B-Architecture
,	O
or	O
it	O
may	O
be	O
permanent	O
and	O
require	O
manual	O
intervention	O
,	O
as	O
in	O
the	O
case	O
of	O
a	O
hardware	B-Architecture
or	O
software	O
logic	O
error	O
.	O
</s>
<s>
Many	O
modern	O
operating	B-General_Concept
systems	I-General_Concept
provide	O
the	O
user	O
with	O
a	O
means	O
to	O
forcibly	O
terminate	O
a	O
hung	O
program	O
without	O
rebooting	B-Device
or	O
logging	B-General_Concept
out	I-General_Concept
;	O
some	O
operating	B-General_Concept
systems	I-General_Concept
,	O
such	O
as	O
those	O
designed	O
for	O
mobile	O
devices	O
,	O
may	O
even	O
do	O
this	O
automatically	O
.	O
</s>
<s>
In	O
more	O
severe	O
hangs	O
affecting	O
the	O
whole	O
system	O
,	O
the	O
only	O
solution	O
might	O
be	O
to	O
reboot	B-Device
the	O
machine	O
,	O
usually	O
by	O
power	O
cycling	O
with	O
an	O
off/on	O
or	O
reset	O
button	O
.	O
</s>
<s>
A	O
hang	O
differs	O
from	O
a	O
crash	B-General_Concept
,	O
in	O
which	O
the	O
failure	O
is	O
immediate	O
and	O
unrelated	O
to	O
the	O
responsiveness	O
of	O
inputs	B-General_Concept
.	O
</s>
<s>
In	O
a	O
multitasking	O
operating	B-General_Concept
system	I-General_Concept
,	O
it	O
is	O
possible	O
for	O
an	O
individual	O
process	B-Operating_System
or	O
thread	B-Operating_System
to	O
get	O
stuck	O
,	O
such	O
as	O
blocking	O
on	O
a	O
resource	O
or	O
getting	O
into	O
an	O
infinite	B-Algorithm
loop	I-Algorithm
,	O
though	O
the	O
effect	O
on	O
the	O
overall	O
system	O
varies	O
significantly	O
.	O
</s>
<s>
In	O
a	O
cooperative	B-Operating_System
multitasking	I-Operating_System
system	O
,	O
any	O
thread	B-Operating_System
that	O
gets	O
stuck	O
without	O
yielding	O
will	O
hang	O
the	O
system	O
,	O
as	O
it	O
will	O
wedge	O
itself	O
as	O
the	O
running	O
thread	B-Operating_System
and	O
prevent	O
other	O
threads	B-Operating_System
from	O
running	O
.	O
</s>
<s>
By	O
contrast	O
,	O
modern	O
operating	B-General_Concept
systems	I-General_Concept
primarily	O
use	O
pre-emptive	O
multitasking	O
,	O
such	O
as	O
Windows	B-Application
2000	I-Application
and	O
its	O
successors	O
,	O
as	O
well	O
as	O
Linux	B-Application
and	O
Apple	O
Inc.	O
'	O
s	O
macOS	B-Application
.	O
</s>
<s>
In	O
these	O
cases	O
,	O
a	O
single	B-Operating_System
thread	I-Operating_System
getting	O
stuck	O
will	O
not	O
necessarily	O
hang	O
the	O
system	O
,	O
as	O
the	O
operating	B-General_Concept
system	I-General_Concept
will	O
preempt	O
it	O
when	O
its	O
time	O
slice	O
expires	O
,	O
allowing	O
another	O
thread	B-Operating_System
to	O
run	O
.	O
</s>
<s>
If	O
a	O
thread	B-Operating_System
does	O
hang	O
,	O
the	O
scheduler	O
may	O
switch	O
to	O
another	O
group	O
of	O
interdependent	O
tasks	O
so	O
that	O
all	O
processes	B-Operating_System
will	O
not	O
hang	O
.	O
</s>
<s>
However	O
,	O
a	O
stuck	O
thread	B-Operating_System
will	O
still	O
consume	O
resources	O
:	O
at	O
least	O
an	O
entry	O
in	O
scheduling	O
,	O
and	O
if	O
it	O
is	O
running	O
(	O
for	O
instance	O
,	O
stuck	O
in	O
an	O
infinite	B-Algorithm
loop	I-Algorithm
)	O
,	O
it	O
will	O
consume	O
processor	O
cycles	O
and	O
power	O
when	O
it	O
is	O
scheduled	O
,	O
slowing	O
the	O
system	O
though	O
it	O
does	O
not	O
hang	O
it	O
.	O
</s>
<s>
For	O
example	O
,	O
a	O
process	B-Operating_System
that	O
blocks	O
the	O
file	O
system	O
will	O
often	O
hang	O
the	O
system	O
.	O
</s>
<s>
Hardware	B-Architecture
can	O
cause	O
a	O
computer	O
to	O
hang	O
,	O
either	O
because	O
it	O
is	O
intermittent	O
or	O
because	O
it	O
is	O
mismatched	O
with	O
other	O
hardware	B-Architecture
in	O
the	O
computer	O
(	O
this	O
can	O
occur	O
when	O
one	O
makes	O
an	O
upgrade	B-General_Concept
)	O
.	O
</s>
<s>
Hardware	B-Architecture
can	O
also	O
become	O
defective	O
over	O
time	O
due	O
to	O
dirt	O
or	O
heat	O
damage	O
.	O
</s>
<s>
A	O
hang	O
can	O
also	O
occur	O
due	O
to	O
the	O
fact	O
that	O
the	O
programmer	O
has	O
incorrect	O
termination	O
conditions	O
for	O
a	O
loop	O
,	O
or	O
,	O
in	O
a	O
co-operative	B-Operating_System
multitasking	I-Operating_System
operating	B-General_Concept
system	I-General_Concept
,	O
forgetting	O
to	O
yield	O
to	O
other	O
tasks	O
.	O
</s>
<s>
Said	O
differently	O
,	O
many	O
software-related	O
hangs	O
are	O
caused	O
by	O
threads	B-Operating_System
waiting	O
for	O
an	O
event	O
to	O
occur	O
which	O
will	O
never	O
occur	O
.	O
</s>
<s>
This	O
is	O
also	O
known	O
as	O
an	O
infinite	B-Algorithm
loop	I-Algorithm
.	O
</s>
<s>
Another	O
cause	O
of	O
hangs	O
is	O
a	O
race	B-Operating_System
condition	I-Operating_System
in	O
communication	O
between	O
processes	B-Operating_System
.	O
</s>
<s>
One	O
process	B-Operating_System
may	O
send	O
a	O
signal	B-Operating_System
to	O
a	O
second	O
process	B-Operating_System
then	O
stop	O
execution	O
until	O
it	O
receives	O
a	O
response	O
.	O
</s>
<s>
If	O
the	O
second	O
process	B-Operating_System
is	O
busy	O
the	O
signal	B-Operating_System
will	O
be	O
forced	O
to	O
wait	O
until	O
the	O
process	B-Operating_System
can	O
get	O
to	O
it	O
.	O
</s>
<s>
However	O
,	O
if	O
the	O
second	O
process	B-Operating_System
was	O
busy	O
sending	O
a	O
signal	B-Operating_System
to	O
the	O
first	O
process	B-Operating_System
then	O
both	O
processes	B-Operating_System
would	O
wait	O
forever	O
for	O
the	O
other	O
to	O
respond	O
to	O
signals	O
and	O
never	O
see	O
the	O
other	O
’s	O
signal	B-Operating_System
(	O
this	O
event	O
is	O
known	O
as	O
a	O
deadlock	B-Operating_System
)	O
.	O
</s>
<s>
If	O
the	O
processes	B-Operating_System
are	O
uninterruptible	O
they	O
will	O
hang	O
and	O
have	O
to	O
be	O
shut	O
down	O
.	O
</s>
<s>
If	O
at	O
least	O
one	O
of	O
the	O
processes	B-Operating_System
is	O
a	O
critical	O
kernel	B-Operating_System
process	B-Operating_System
the	O
whole	O
system	O
may	O
hang	O
and	O
have	O
to	O
be	O
restarted	O
.	O
</s>
<s>
This	O
can	O
be	O
caused	O
by	O
too	O
many	O
programs	O
running	O
at	O
once	O
,	O
not	O
enough	O
memory	O
(	O
RAM	B-Architecture
)	O
,	O
or	O
memory	B-Architecture
fragmentation	I-Architecture
,	O
slow	O
hardware	B-Architecture
access	O
(	O
especially	O
to	O
remote	O
devices	O
)	O
,	O
slow	O
system	O
APIs	O
,	O
etc	O
.	O
</s>
<s>
Modern	O
operating	B-General_Concept
systems	I-General_Concept
provide	O
a	O
mechanism	O
for	O
terminating	O
hung	O
processes	B-Operating_System
,	O
for	O
instance	O
,	O
with	O
the	O
Unix	B-Application
kill	B-Operating_System
command	I-Operating_System
,	O
or	O
through	O
a	O
graphical	O
means	O
such	O
as	O
the	O
Task	O
Manager	O
's	O
"	O
end	O
task	O
"	O
button	O
in	O
Windows	B-Application
(	O
select	O
the	O
particular	O
process	B-Operating_System
in	O
the	O
list	O
and	O
press	O
"	O
end	O
task	O
"	O
)	O
.	O
</s>
<s>
On	O
older	O
systems	O
,	O
such	O
as	O
those	O
running	O
MS-DOS	B-Application
,	O
early	O
versions	O
of	O
Windows	B-Application
,	O
or	O
Classic	B-Application
Mac	I-Application
OS	I-Application
often	O
needed	O
to	O
be	O
completely	O
restarted	O
in	O
the	O
event	O
of	O
a	O
hang	O
.	O
</s>
<s>
On	O
embedded	B-Architecture
devices	I-Architecture
where	O
human	O
interaction	O
is	O
limited	O
,	O
a	O
watchdog	B-Application
timer	I-Application
can	O
reboot	B-Device
the	O
computer	O
in	O
the	O
event	O
of	O
a	O
hang	O
.	O
</s>
