<s>
In	O
computing	O
,	O
preemption	B-Operating_System
is	O
the	O
act	O
of	O
temporarily	O
interrupting	B-Application
an	O
executing	B-General_Concept
task	B-General_Concept
,	O
with	O
the	O
intention	O
of	O
resuming	O
it	O
at	O
a	O
later	O
time	O
.	O
</s>
<s>
This	O
interrupt	B-Application
is	O
done	O
by	O
an	O
external	O
scheduler	O
with	O
no	O
assistance	O
or	O
cooperation	O
from	O
the	O
task	B-General_Concept
.	O
</s>
<s>
This	O
preemptive	B-Operating_System
scheduler	I-Operating_System
usually	O
runs	O
in	O
the	O
most	O
privileged	O
protection	B-Operating_System
ring	I-Operating_System
,	O
meaning	O
that	O
interruption	O
and	O
resuming	O
are	O
considered	O
highly	O
secure	O
actions	O
.	O
</s>
<s>
Such	O
a	O
change	O
in	O
the	O
currently	O
executing	B-General_Concept
task	B-General_Concept
of	O
a	O
processor	O
is	O
known	O
as	O
context	B-Operating_System
switching	I-Operating_System
.	O
</s>
<s>
This	O
usually	O
applies	O
to	O
kernel	B-Operating_System
functions	O
and	O
service	O
interrupts	B-Application
which	O
,	O
if	O
not	O
permitted	O
to	O
run	B-Algorithm
to	I-Algorithm
completion	I-Algorithm
,	O
would	O
tend	O
to	O
produce	O
race	B-Operating_System
conditions	I-Operating_System
resulting	O
in	O
deadlock	B-Operating_System
.	O
</s>
<s>
Barring	O
the	O
scheduler	O
from	O
preempting	O
tasks	O
while	O
they	O
are	O
processing	O
kernel	B-Operating_System
functions	O
simplifies	O
the	O
kernel	B-Operating_System
design	I-Operating_System
at	O
the	O
expense	O
of	O
system	B-Application
responsiveness	I-Application
.	O
</s>
<s>
The	O
distinction	O
between	O
user	B-Operating_System
mode	I-Operating_System
and	O
kernel	B-Operating_System
mode	O
,	O
which	O
determines	O
privilege	O
level	O
within	O
the	O
system	O
,	O
may	O
also	O
be	O
used	O
to	O
distinguish	O
whether	O
a	O
task	B-General_Concept
is	O
currently	O
preemptable	O
.	O
</s>
<s>
Most	O
modern	O
operating	B-General_Concept
systems	I-General_Concept
have	O
preemptive	O
kernels	B-Operating_System
,	O
which	O
are	O
designed	O
to	O
permit	O
tasks	O
to	O
be	O
preempted	O
even	O
when	O
in	O
kernel	B-Operating_System
mode	O
.	O
</s>
<s>
Examples	O
of	O
such	O
operating	B-General_Concept
systems	I-General_Concept
are	O
Solaris	B-Application
2.0/SunOS	O
5.0	O
,	O
Windows	B-Device
NT	I-Device
,	O
Linux	B-Operating_System
kernel	I-Operating_System
(	O
2.5.4	O
and	O
newer	O
)	O
,	O
AIX	B-Application
and	O
some	O
BSD	B-Operating_System
systems	O
(	O
NetBSD	B-Device
,	O
since	O
version	O
5	O
)	O
.	O
</s>
<s>
The	O
term	O
preemptive	O
multitasking	B-Operating_System
is	O
used	O
to	O
distinguish	O
a	O
multitasking	B-Operating_System
operating	I-Operating_System
system	I-Operating_System
,	O
which	O
permits	O
preemption	B-Operating_System
of	O
tasks	O
,	O
from	O
a	O
cooperative	B-Operating_System
multitasking	I-Operating_System
system	O
wherein	O
processes	O
or	O
tasks	O
must	O
be	O
explicitly	O
programmed	O
to	O
yield	B-Language
when	O
they	O
do	O
not	O
need	O
system	O
resources	O
.	O
</s>
<s>
In	O
simple	O
terms	O
:	O
Preemptive	O
multitasking	B-Operating_System
involves	O
the	O
use	O
of	O
an	O
interrupt	B-Application
mechanism	O
which	O
suspends	O
the	O
currently	O
executing	B-General_Concept
process	O
and	O
invokes	O
a	O
scheduler	O
to	O
determine	O
which	O
process	O
should	O
execute	O
next	O
.	O
</s>
<s>
In	O
preemptive	O
multitasking	B-Operating_System
,	O
the	O
operating	B-Operating_System
system	I-Operating_System
kernel	I-Operating_System
can	O
also	O
initiate	O
a	O
context	B-Operating_System
switch	I-Operating_System
to	O
satisfy	O
the	O
scheduling	O
policy	O
's	O
priority	O
constraint	O
,	O
thus	O
preempting	O
the	O
active	O
task	B-General_Concept
.	O
</s>
<s>
In	O
general	O
,	O
preemption	B-Operating_System
means	O
"	O
prior	O
seizure	O
of	O
"	O
.	O
</s>
<s>
When	O
the	O
high-priority	O
task	B-General_Concept
at	O
that	O
instance	O
seizes	O
the	O
currently	O
running	O
task	B-General_Concept
,	O
it	O
is	O
known	O
as	O
preemptive	B-Operating_System
scheduling	I-Operating_System
.	O
</s>
<s>
The	O
term	O
"	O
preemptive	O
multitasking	B-Operating_System
"	O
is	O
sometimes	O
mistakenly	O
used	O
when	O
the	O
intended	O
meaning	O
is	O
more	O
specific	O
,	O
referring	O
instead	O
to	O
the	O
class	O
of	O
scheduling	O
policies	O
known	O
as	O
time-shared	O
scheduling	O
,	O
or	O
time-sharing	B-General_Concept
.	O
</s>
<s>
Preemptive	O
multitasking	B-Operating_System
allows	O
the	O
computer	O
system	O
to	O
more	O
reliably	O
guarantee	O
each	O
process	O
a	O
regular	O
"	O
slice	O
"	O
of	O
operating	O
time	O
.	O
</s>
<s>
At	O
any	O
specific	O
time	O
,	O
processes	O
can	O
be	O
grouped	O
into	O
two	O
categories	O
:	O
those	O
that	O
are	O
waiting	O
for	O
input	O
or	O
output	O
(	O
called	O
"	O
I/O	B-General_Concept
bound	I-General_Concept
"	O
)	O
,	O
and	O
those	O
that	O
are	O
fully	O
utilizing	O
the	O
CPU	O
(	O
"	O
CPU	O
bound	O
"	O
)	O
.	O
</s>
<s>
In	O
early	O
systems	O
,	O
processes	O
would	O
often	O
"	O
poll	B-General_Concept
"	O
or	O
"	O
busy-wait	B-Operating_System
"	O
while	O
waiting	O
for	O
requested	O
input	O
(	O
such	O
as	O
disk	O
,	O
keyboard	O
or	O
network	O
input	O
)	O
.	O
</s>
<s>
With	O
the	O
advent	O
of	O
interrupts	B-Application
and	O
preemptive	O
multitasking	B-Operating_System
,	O
these	O
I/O	B-General_Concept
bound	I-General_Concept
processes	O
could	O
be	O
"	O
blocked	O
"	O
,	O
or	O
put	O
on	O
hold	O
,	O
pending	O
the	O
arrival	O
of	O
the	O
necessary	O
data	O
,	O
allowing	O
other	O
processes	O
to	O
utilize	O
the	O
CPU	O
.	O
</s>
<s>
As	O
the	O
arrival	O
of	O
the	O
requested	O
data	O
would	O
generate	O
an	O
interrupt	B-Application
,	O
blocked	O
processes	O
could	O
be	O
guaranteed	O
a	O
timely	O
return	O
to	O
execution	O
.	O
</s>
<s>
Although	O
multitasking	B-Operating_System
techniques	O
were	O
originally	O
developed	O
to	O
allow	O
multiple	O
users	O
to	O
share	O
a	O
single	O
machine	O
,	O
it	O
became	O
apparent	O
that	O
multitasking	B-Operating_System
was	O
useful	O
regardless	O
of	O
the	O
number	O
of	O
users	O
.	O
</s>
<s>
Many	O
operating	B-General_Concept
systems	I-General_Concept
,	O
from	O
mainframes	O
down	O
to	O
single-user	O
personal	O
computers	O
and	O
no-user	O
control	O
systems	O
(	O
like	O
those	O
in	O
robotic	O
spacecraft	O
)	O
,	O
have	O
recognized	O
the	O
usefulness	O
of	O
multitasking	B-Operating_System
support	O
for	O
a	O
variety	O
of	O
reasons	O
.	O
</s>
<s>
Multitasking	B-Operating_System
makes	O
it	O
possible	O
for	O
a	O
single	O
user	O
to	O
run	O
multiple	O
applications	O
at	O
the	O
same	O
time	O
,	O
or	O
to	O
run	O
"	O
background	O
"	O
processes	O
while	O
retaining	O
control	O
of	O
the	O
computer	O
.	O
</s>
<s>
The	O
period	O
of	O
time	O
for	O
which	O
a	O
process	O
is	O
allowed	O
to	O
run	O
in	O
a	O
preemptive	O
multitasking	B-Operating_System
system	O
is	O
generally	O
called	O
the	O
time	O
slice	O
or	O
quantum	O
.	O
</s>
<s>
The	O
length	O
of	O
each	O
time	O
slice	O
can	O
be	O
critical	O
to	O
balancing	O
system	O
performance	O
vs	O
process	O
responsiveness	B-Application
-	O
if	O
the	O
time	O
slice	O
is	O
too	O
short	O
then	O
the	O
scheduler	O
will	O
consume	O
too	O
much	O
processing	O
time	O
,	O
but	O
if	O
the	O
time	O
slice	O
is	O
too	O
long	O
,	O
processes	O
will	O
take	O
longer	O
to	O
respond	O
to	O
input	O
.	O
</s>
<s>
An	O
interrupt	B-Application
is	O
scheduled	O
to	O
allow	O
the	O
operating	B-Operating_System
system	I-Operating_System
kernel	I-Operating_System
to	O
switch	O
between	O
processes	O
when	O
their	O
time	O
slices	O
expire	O
,	O
effectively	O
allowing	O
the	O
processor	O
's	O
time	O
to	O
be	O
shared	O
among	O
a	O
number	O
of	O
tasks	O
,	O
giving	O
the	O
illusion	O
that	O
it	O
is	O
dealing	O
with	O
these	O
tasks	O
in	O
parallel	O
(	O
simultaneously	O
)	O
.	O
</s>
<s>
The	O
operating	B-General_Concept
system	I-General_Concept
which	O
controls	O
such	O
a	O
design	O
is	O
called	O
a	O
multi-tasking	O
system	O
.	O
</s>
<s>
Today	O
,	O
nearly	O
all	O
operating	B-General_Concept
systems	I-General_Concept
support	O
preemptive	O
multitasking	B-Operating_System
,	O
including	O
the	O
current	O
versions	O
of	O
Windows	B-Application
,	O
macOS	B-Application
,	O
Linux	B-Application
(	O
including	O
Android	B-Application
)	O
and	O
iOS	B-Application
.	O
</s>
<s>
Some	O
of	O
the	O
earliest	O
operating	B-General_Concept
systems	I-General_Concept
available	O
to	O
home	O
users	O
featuring	O
preemptive	O
multitasking	B-Operating_System
were	O
Sinclair	B-Operating_System
QDOS	I-Operating_System
(	O
1984	O
)	O
and	O
AmigaOS	B-Application
(	O
1985	O
)	O
.	O
</s>
<s>
These	O
both	O
ran	O
on	O
Motorola	O
68000-family	O
microprocessors	B-Architecture
without	O
memory	O
management	O
.	O
</s>
<s>
Amiga	B-Application
OS	I-Application
used	O
dynamic	B-Operating_System
loading	I-Operating_System
of	O
relocatable	O
code	O
blocks	O
(	O
"	O
hunks	O
"	O
in	O
Amiga	O
jargon	O
)	O
to	O
multitask	O
preemptively	O
all	O
processes	O
in	O
the	O
same	O
flat	O
address	O
space	O
.	O
</s>
<s>
Early	O
PC	O
operating	B-General_Concept
systems	I-General_Concept
such	O
as	O
MS-DOS	B-Application
and	O
PC	B-Operating_System
DOS	I-Operating_System
,	O
did	O
not	O
support	O
multitasking	B-Operating_System
at	O
all	O
,	O
however	O
alternative	O
operating	B-General_Concept
systems	I-General_Concept
such	O
as	O
MP/M	B-Operating_System
-86	I-Operating_System
(	O
1981	O
)	O
and	O
Concurrent	B-Operating_System
CP/M	I-Operating_System
-86	I-Operating_System
did	O
support	O
preemptive	O
multitasking	B-Operating_System
.	O
</s>
<s>
Other	O
Unix-like	B-Operating_System
systems	I-Operating_System
including	O
MINIX	B-Operating_System
and	O
Coherent	B-Operating_System
provided	O
preemptive	O
multitasking	B-Operating_System
on	O
1980s-era	O
personal	O
computers	O
.	O
</s>
<s>
Later	O
DOS	B-Device
versions	O
natively	O
supporting	O
preemptive	O
multitasking/multithreading	O
include	O
Concurrent	B-Operating_System
DOS	I-Operating_System
,	O
Multiuser	B-Operating_System
DOS	I-Operating_System
,	O
Novell	B-Operating_System
DOS	I-Operating_System
(	O
later	O
called	O
Caldera	B-Application
OpenDOS	I-Application
and	O
DR-DOS	B-Application
7.02	O
and	O
higher	O
)	O
.	O
</s>
<s>
Since	O
Concurrent	B-Operating_System
DOS	I-Operating_System
386	I-Operating_System
,	O
they	O
could	O
also	O
run	O
multiple	O
DOS	B-Device
programs	O
concurrently	O
in	O
virtual	O
DOS	B-Device
machines	O
.	O
</s>
<s>
The	O
earliest	O
version	O
of	O
Windows	B-Application
to	O
support	O
a	O
limited	O
form	O
of	O
preemptive	O
multitasking	B-Operating_System
was	O
Windows/386	O
2.0	O
,	O
which	O
used	O
the	O
Intel	B-General_Concept
80386	I-General_Concept
's	O
Virtual	B-Application
8086	I-Application
mode	I-Application
to	O
run	O
DOS	B-Device
applications	O
in	O
virtual	O
8086	O
machines	O
,	O
commonly	O
known	O
as	O
"	O
DOS	B-Device
boxes	O
"	O
,	O
which	O
could	O
be	O
preempted	O
.	O
</s>
<s>
In	O
Windows	B-Application
95	O
,	O
98	O
and	O
Me	O
,	O
32-bit	O
applications	O
were	O
made	O
preemptive	O
by	O
running	O
each	O
one	O
in	O
a	O
separate	O
address	O
space	O
,	O
but	O
16-bit	O
applications	O
remained	O
cooperative	O
for	O
backward	O
compatibility	O
.	O
</s>
<s>
In	O
Windows	B-Application
3.1x	O
(	O
protected	O
mode	O
)	O
,	O
the	O
kernel	B-Operating_System
and	O
virtual	O
device	O
drivers	O
ran	O
preemptively	O
,	O
but	O
all	O
16-bit	O
applications	O
were	O
non-preemptive	O
and	O
shared	O
the	O
same	O
address	O
space	O
.	O
</s>
<s>
Preemptive	O
multitasking	B-Operating_System
has	O
always	O
been	O
supported	O
by	O
Windows	B-Device
NT	I-Device
(	O
all	O
versions	O
)	O
,	O
OS/2	B-Application
(	O
native	O
applications	O
)	O
,	O
Unix	B-Application
and	O
Unix-like	B-Operating_System
systems	I-Operating_System
(	O
such	O
as	O
Linux	B-Application
,	O
BSD	B-Operating_System
and	O
macOS	B-Application
)	O
,	O
VMS	B-Operating_System
,	O
OS/360	B-Application
,	O
and	O
many	O
other	O
operating	B-General_Concept
systems	I-General_Concept
designed	O
for	O
use	O
in	O
the	O
academic	O
and	O
medium-to-large	O
business	O
markets	O
.	O
</s>
<s>
Although	O
there	O
were	O
plans	O
to	O
upgrade	O
the	O
cooperative	B-Operating_System
multitasking	I-Operating_System
found	O
in	O
the	O
classic	B-Application
Mac	I-Application
OS	I-Application
to	O
a	O
preemptive	O
model	O
(	O
and	O
a	O
preemptive	O
API	O
did	O
exist	O
in	O
Mac	B-Operating_System
OS	I-Operating_System
9	I-Operating_System
,	O
although	O
in	O
a	O
limited	O
sense	O
)	O
,	O
these	O
were	O
abandoned	O
in	O
favor	O
of	O
Mac	B-Application
OS	I-Application
X	O
(	O
now	O
called	O
macOS	B-Application
)	O
that	O
,	O
as	O
a	O
hybrid	O
of	O
the	O
old	O
Mac	O
System	O
style	O
and	O
NeXTSTEP	B-Application
,	O
is	O
an	O
operating	B-General_Concept
system	I-General_Concept
based	O
on	O
the	O
Mach	B-Operating_System
kernel	I-Operating_System
and	O
derived	O
in	O
part	O
from	O
BSD	B-Operating_System
,	O
which	O
had	O
always	O
provided	O
Unix-like	B-Operating_System
preemptive	O
multitasking	B-Operating_System
.	O
</s>
