<s>
In	O
computing	O
,	O
multitasking	B-Operating_System
is	O
the	O
concurrent	B-Operating_System
execution	O
of	O
multiple	O
tasks	O
(	O
also	O
known	O
as	O
processes	B-Operating_System
)	O
over	O
a	O
certain	O
period	O
of	O
time	O
.	O
</s>
<s>
As	O
a	O
result	O
,	O
a	O
computer	O
executes	O
segments	O
of	O
multiple	O
tasks	O
in	O
an	O
interleaved	O
manner	O
,	O
while	O
the	O
tasks	O
share	O
common	O
processing	O
resources	O
such	O
as	O
central	B-General_Concept
processing	I-General_Concept
units	I-General_Concept
(	O
CPUs	O
)	O
and	O
main	O
memory	O
.	O
</s>
<s>
Multitasking	B-Operating_System
automatically	O
interrupts	O
the	O
running	O
program	O
,	O
saving	O
its	O
state	O
(	O
partial	O
results	O
,	O
memory	O
contents	O
and	O
computer	O
register	O
contents	O
)	O
and	O
loading	O
the	O
saved	O
state	O
of	O
another	O
program	O
and	O
transferring	O
control	O
to	O
it	O
.	O
</s>
<s>
This	O
"	O
context	B-Operating_System
switch	I-Operating_System
"	O
may	O
be	O
initiated	O
at	O
fixed	O
time	O
intervals	O
(	O
pre-emptive	O
multitasking	B-Operating_System
)	O
,	O
or	O
the	O
running	O
program	O
may	O
be	O
coded	O
to	O
signal	O
to	O
the	O
supervisory	O
software	O
when	O
it	O
can	O
be	O
interrupted	O
(	O
cooperative	B-Operating_System
multitasking	I-Operating_System
)	O
.	O
</s>
<s>
Multitasking	B-Operating_System
does	O
not	O
require	O
parallel	B-Operating_System
execution	I-Operating_System
of	O
multiple	O
tasks	O
at	O
exactly	O
the	O
same	O
time	O
;	O
instead	O
,	O
it	O
allows	O
more	O
than	O
one	O
task	O
to	O
advance	O
over	O
a	O
given	O
period	O
of	O
time	O
.	O
</s>
<s>
Even	O
on	O
multiprocessor	B-Operating_System
computers	O
,	O
multitasking	B-Operating_System
allows	O
many	O
more	O
tasks	O
to	O
be	O
run	O
than	O
there	O
are	O
CPUs	O
.	O
</s>
<s>
Multitasking	B-Operating_System
is	O
a	O
common	O
feature	O
of	O
computer	B-General_Concept
operating	I-General_Concept
systems	I-General_Concept
since	O
at	O
least	O
the	O
1960s	O
.	O
</s>
<s>
It	O
allows	O
more	O
efficient	O
use	O
of	O
the	O
computer	O
hardware	O
;	O
when	O
a	O
program	O
is	O
waiting	O
for	O
some	O
external	O
event	O
such	O
as	O
a	O
user	B-General_Concept
input	I-General_Concept
or	O
an	O
input/output	B-General_Concept
transfer	O
with	O
a	O
peripheral	O
to	O
complete	O
,	O
the	O
central	O
processor	O
can	O
still	O
be	O
used	O
with	O
another	O
program	O
.	O
</s>
<s>
In	O
a	O
time-sharing	B-General_Concept
system	I-General_Concept
,	O
multiple	O
human	O
operators	O
use	O
the	O
same	O
processor	O
as	O
if	O
it	O
was	O
dedicated	O
to	O
their	O
use	O
,	O
while	O
behind	O
the	O
scenes	O
the	O
computer	O
is	O
serving	O
many	O
users	O
by	O
multitasking	B-Operating_System
their	O
individual	O
programs	O
.	O
</s>
<s>
In	O
multiprogramming	O
systems	O
,	O
a	O
task	O
runs	O
until	O
it	O
must	O
wait	O
for	O
an	O
external	O
event	O
or	O
until	O
the	O
operating	B-General_Concept
system	I-General_Concept
's	O
scheduler	O
forcibly	O
swaps	O
the	O
running	O
task	O
out	O
of	O
the	O
CPU	O
.	O
</s>
<s>
Real-time	B-General_Concept
systems	I-General_Concept
such	O
as	O
those	O
designed	O
to	O
control	O
industrial	O
robots	O
,	O
require	O
timely	O
processing	O
;	O
a	O
single	O
processor	O
might	O
be	O
shared	O
between	O
calculations	O
of	O
machine	O
movement	O
,	O
communications	O
,	O
and	O
user	O
interface	O
.	O
</s>
<s>
Often	O
multitasking	B-Operating_System
operating	I-Operating_System
systems	I-Operating_System
include	O
measures	O
to	O
change	O
the	O
priority	O
of	O
individual	O
tasks	O
,	O
so	O
that	O
important	O
jobs	O
receive	O
more	O
processor	O
time	O
than	O
those	O
considered	O
less	O
significant	O
.	O
</s>
<s>
Depending	O
on	O
the	O
operating	B-General_Concept
system	I-General_Concept
,	O
a	O
task	O
might	O
be	O
as	O
large	O
as	O
an	O
entire	O
application	O
program	O
,	O
or	O
might	O
be	O
made	O
up	O
of	O
smaller	O
threads	B-Operating_System
that	O
carry	O
out	O
portions	O
of	O
the	O
overall	O
program	O
.	O
</s>
<s>
A	O
processor	O
intended	O
for	O
use	O
with	O
multitasking	B-Operating_System
operating	I-Operating_System
systems	I-Operating_System
may	O
include	O
special	O
hardware	O
to	O
securely	O
support	O
multiple	O
tasks	O
,	O
such	O
as	O
memory	B-General_Concept
protection	I-General_Concept
,	O
and	O
protection	B-Operating_System
rings	I-Operating_System
that	O
ensure	O
the	O
supervisory	O
software	O
cannot	O
be	O
damaged	O
or	O
subverted	O
by	O
user-mode	B-Operating_System
program	O
errors	O
.	O
</s>
<s>
The	O
term	O
"	O
multitasking	B-Operating_System
"	O
has	O
become	O
an	O
international	O
term	O
,	O
as	O
the	O
same	O
word	O
is	O
used	O
in	O
many	O
other	O
languages	O
such	O
as	O
German	O
,	O
Italian	O
,	O
Dutch	O
,	O
Romanian	O
,	O
Czech	O
,	O
Danish	O
and	O
Norwegian	O
.	O
</s>
<s>
When	O
the	O
computer	O
ran	O
a	O
program	O
that	O
needed	O
access	O
to	O
a	O
peripheral	O
,	O
the	O
central	B-General_Concept
processing	I-General_Concept
unit	I-General_Concept
(	O
CPU	O
)	O
would	O
have	O
to	O
stop	O
executing	O
program	O
instructions	O
while	O
the	O
peripheral	O
processed	O
the	O
data	O
.	O
</s>
<s>
The	O
first	O
computer	O
using	O
a	O
multiprogramming	O
system	O
was	O
the	O
British	O
Leo	O
III	O
owned	O
by	O
J	O
.	O
Lyons	O
and	O
Co	O
.	O
During	O
batch	B-General_Concept
processing	I-General_Concept
,	O
several	O
different	O
programs	O
were	O
loaded	O
in	O
the	O
computer	O
memory	O
,	O
and	O
the	O
first	O
one	O
began	O
to	O
run	O
.	O
</s>
<s>
The	O
use	O
of	O
multiprogramming	O
was	O
enhanced	O
by	O
the	O
arrival	O
of	O
virtual	B-Architecture
memory	I-Architecture
and	O
virtual	B-Architecture
machine	I-Architecture
technology	O
,	O
which	O
enabled	O
individual	O
programs	O
to	O
make	O
use	O
of	O
memory	O
and	O
operating	B-General_Concept
system	I-General_Concept
resources	O
as	O
if	O
other	O
concurrently	O
running	O
programs	O
were	O
,	O
for	O
all	O
practical	O
purposes	O
,	O
nonexistent	O
.	O
</s>
<s>
Early	O
multitasking	B-Operating_System
systems	O
used	O
applications	O
that	O
voluntarily	O
ceded	O
time	O
to	O
one	O
another	O
.	O
</s>
<s>
This	O
approach	O
,	O
which	O
was	O
eventually	O
supported	O
by	O
many	O
computer	B-General_Concept
operating	I-General_Concept
systems	I-General_Concept
,	O
is	O
known	O
today	O
as	O
cooperative	B-Operating_System
multitasking	I-Operating_System
.	O
</s>
<s>
Although	O
it	O
is	O
now	O
rarely	O
used	O
in	O
larger	O
systems	O
except	O
for	O
specific	O
applications	O
such	O
as	O
CICS	B-Application
or	O
the	O
JES2	B-Application
subsystem	O
,	O
cooperative	B-Operating_System
multitasking	I-Operating_System
was	O
once	O
the	O
only	O
scheduling	O
scheme	O
employed	O
by	O
Microsoft	B-Application
Windows	I-Application
and	O
classic	B-Application
Mac	I-Application
OS	I-Application
to	O
enable	O
multiple	O
applications	O
to	O
run	O
simultaneously	O
.	O
</s>
<s>
Cooperative	B-Operating_System
multitasking	I-Operating_System
is	O
still	O
used	O
today	O
on	O
RISC	B-Operating_System
OS	I-Operating_System
systems	O
.	O
</s>
<s>
As	O
a	O
cooperatively	O
multitasked	O
system	O
relies	O
on	O
each	O
process	O
regularly	O
giving	O
up	O
time	O
to	O
other	O
processes	B-Operating_System
on	O
the	O
system	O
,	O
one	O
poorly	O
designed	O
program	O
can	O
consume	O
all	O
of	O
the	O
CPU	O
time	O
for	O
itself	O
,	O
either	O
by	O
performing	O
extensive	O
calculations	O
or	O
by	O
busy	B-Operating_System
waiting	I-Operating_System
;	O
both	O
would	O
cause	O
the	O
whole	O
system	O
to	O
hang	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
to	O
each	O
process	O
a	O
regular	O
"	O
slice	O
"	O
of	O
operating	O
time	O
.	O
</s>
<s>
Operating	B-General_Concept
systems	I-General_Concept
were	O
developed	O
to	O
take	O
advantage	O
of	O
these	O
hardware	O
capabilities	O
and	O
run	O
multiple	O
processes	B-Operating_System
preemptively	O
.	O
</s>
<s>
Preemptive	O
multitasking	B-Operating_System
was	O
implemented	O
in	O
the	B-Operating_System
PDP-6	I-Operating_System
Monitor	I-Operating_System
and	O
Multics	B-Application
in	O
1964	O
,	O
in	O
OS/360	O
MFT	O
in	O
1967	O
,	O
and	O
in	O
Unix	B-Application
in	O
1969	O
,	O
and	O
was	O
available	O
in	O
some	O
operating	B-General_Concept
systems	I-General_Concept
for	O
computers	O
as	O
small	O
as	O
DEC	O
's	O
PDP-8	O
;	O
it	O
is	O
a	O
core	O
feature	O
of	O
all	O
Unix-like	B-Operating_System
operating	I-Operating_System
systems	I-Operating_System
,	O
such	O
as	O
Linux	B-Application
,	O
Solaris	B-Application
and	O
BSD	B-Operating_System
with	O
its	O
derivatives	B-Operating_System
,	O
as	O
well	O
as	O
modern	O
versions	O
of	O
Windows	O
.	O
</s>
<s>
At	O
any	O
specific	O
time	O
,	O
processes	B-Operating_System
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
primitive	O
systems	O
,	O
the	O
software	O
would	O
often	O
"	O
poll	B-General_Concept
"	O
,	O
or	O
"	O
busywait	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	O
and	O
preemptive	O
multitasking	B-Operating_System
,	O
I/O	B-General_Concept
bound	I-General_Concept
processes	B-Operating_System
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	B-Operating_System
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	O
,	O
blocked	O
processes	B-Operating_System
could	O
be	O
guaranteed	O
a	O
timely	O
return	O
to	O
execution	O
.	O
</s>
<s>
The	O
earliest	O
preemptive	O
multitasking	B-Operating_System
OS	O
available	O
to	O
home	O
users	O
was	O
Sinclair	B-Operating_System
QDOS	I-Operating_System
on	O
the	O
Sinclair	B-Device
QL	I-Device
,	O
released	O
in	O
1984	O
,	O
but	O
very	O
few	O
people	O
bought	O
the	O
machine	O
.	O
</s>
<s>
Commodore	O
's	O
Amiga	B-Device
,	O
released	O
the	O
following	O
year	O
,	O
was	O
the	O
first	O
commercially	O
successful	O
home	O
computer	O
to	O
use	O
the	O
technology	O
,	O
and	O
its	O
multimedia	O
abilities	O
make	O
it	O
a	O
clear	O
ancestor	O
of	O
contemporary	O
multitasking	B-Operating_System
personal	O
computers	O
.	O
</s>
<s>
Microsoft	O
made	O
preemptive	O
multitasking	B-Operating_System
a	O
core	O
feature	O
of	O
their	O
flagship	O
operating	B-General_Concept
system	I-General_Concept
in	O
the	O
early	O
1990s	O
when	O
developing	O
Windows	B-Device
NT	I-Device
3.1	I-Device
and	O
then	O
Windows	B-Application
95	I-Application
.	O
</s>
<s>
In	O
1988	O
Apple	O
offered	O
A/UX	B-Operating_System
as	O
a	O
UNIX	O
System	O
V-based	O
alternative	O
to	O
the	O
Classic	B-Application
Mac	I-Application
OS	I-Application
.	O
</s>
<s>
In	O
2001	O
Apple	O
switched	O
to	O
the	O
NeXTSTEP-influenced	O
Mac	B-Operating_System
OS	I-Operating_System
X	I-Operating_System
.	O
</s>
<s>
A	O
similar	O
model	O
is	O
used	O
in	O
Windows	O
9x	O
and	O
the	O
Windows	B-Device
NT	I-Device
family	I-Device
,	O
where	O
native	O
32-bit	O
applications	O
are	O
multitasked	O
preemptively	O
.	O
</s>
<s>
64-bit	O
editions	O
of	O
Windows	O
,	O
both	O
for	O
the	O
x86-64	B-Device
and	O
Itanium	B-General_Concept
architectures	O
,	O
no	O
longer	O
support	O
legacy	O
16-bit	O
applications	O
,	O
and	O
thus	O
provide	O
preemptive	O
multitasking	B-Operating_System
for	O
all	O
supported	O
applications	O
.	O
</s>
<s>
Another	O
reason	O
for	O
multitasking	B-Operating_System
was	O
in	O
the	O
design	O
of	O
real-time	B-General_Concept
computing	I-General_Concept
systems	O
,	O
where	O
there	O
are	O
a	O
number	O
of	O
possibly	O
unrelated	O
external	O
activities	O
needed	O
to	O
be	O
controlled	O
by	O
a	O
single	O
processor	O
system	O
.	O
</s>
<s>
As	O
multitasking	B-Operating_System
greatly	O
improved	O
the	O
throughput	O
of	O
computers	O
,	O
programmers	O
started	O
to	O
implement	O
applications	O
as	O
sets	O
of	O
cooperating	O
processes	B-Operating_System
(	O
e.g.	O
,	O
one	O
process	O
gathering	O
input	B-General_Concept
data	I-General_Concept
,	O
one	O
process	O
processing	O
input	B-General_Concept
data	I-General_Concept
,	O
one	O
process	O
writing	O
out	O
results	O
on	O
disk	O
)	O
.	O
</s>
<s>
This	O
,	O
however	O
,	O
required	O
some	O
tools	O
to	O
allow	O
processes	B-Operating_System
to	O
efficiently	O
exchange	O
data	O
.	O
</s>
<s>
Threads	B-Operating_System
were	O
born	O
from	O
the	O
idea	O
that	O
the	O
most	O
efficient	O
way	O
for	O
cooperating	O
processes	B-Operating_System
to	O
exchange	O
data	O
would	O
be	O
to	O
share	O
their	O
entire	O
memory	O
space	O
.	O
</s>
<s>
Thus	O
,	O
threads	B-Operating_System
are	O
effectively	O
processes	B-Operating_System
that	O
run	O
in	O
the	O
same	O
memory	O
context	O
and	O
share	O
other	O
resources	O
with	O
their	O
parent	O
processes	B-Operating_System
,	O
such	O
as	O
open	O
files	O
.	O
</s>
<s>
Threads	B-Operating_System
are	O
described	O
as	O
lightweight	O
processes	B-Operating_System
because	O
switching	O
between	O
threads	B-Operating_System
does	O
not	O
involve	O
changing	O
the	O
memory	O
context	O
.	O
</s>
<s>
While	O
threads	B-Operating_System
are	O
scheduled	O
preemptively	O
,	O
some	O
operating	B-General_Concept
systems	I-General_Concept
provide	O
a	O
variant	O
to	O
threads	B-Operating_System
,	O
named	O
fibers	O
,	O
that	O
are	O
scheduled	O
cooperatively	O
.	O
</s>
<s>
On	O
operating	B-General_Concept
systems	I-General_Concept
that	O
do	O
not	O
provide	O
fibers	O
,	O
an	O
application	O
may	O
implement	O
its	O
own	O
fibers	O
using	O
repeated	O
calls	O
to	O
worker	O
functions	O
.	O
</s>
<s>
Fibers	O
are	O
even	O
more	O
lightweight	O
than	O
threads	B-Operating_System
,	O
and	O
somewhat	O
easier	O
to	O
program	O
with	O
,	O
although	O
they	O
tend	O
to	O
lose	O
some	O
or	O
all	O
of	O
the	O
benefits	O
of	O
threads	B-Operating_System
on	O
machines	B-Operating_System
with	I-Operating_System
multiple	I-Operating_System
processors	I-Operating_System
.	O
</s>
<s>
Some	O
systems	O
directly	O
support	O
multithreading	B-General_Concept
in	I-General_Concept
hardware	I-General_Concept
.	O
</s>
<s>
Essential	O
to	O
any	O
multitasking	B-Operating_System
system	O
is	O
to	O
safely	O
and	O
effectively	O
share	O
access	O
to	O
system	O
resources	O
.	O
</s>
<s>
In	O
general	O
,	O
memory	O
access	O
management	O
is	O
a	O
responsibility	O
of	O
the	O
operating	B-General_Concept
system	I-General_Concept
kernel	O
,	O
in	O
combination	O
with	O
hardware	O
mechanisms	O
that	O
provide	O
supporting	O
functionalities	O
,	O
such	O
as	O
a	O
memory	B-General_Concept
management	I-General_Concept
unit	I-General_Concept
(	O
MMU	O
)	O
.	O
</s>
<s>
In	O
a	O
well	O
designed	O
and	O
correctly	O
implemented	O
multitasking	B-Operating_System
system	O
,	O
a	O
given	O
process	O
can	O
never	O
directly	O
access	O
memory	O
that	O
belongs	O
to	O
another	O
process	O
.	O
</s>
<s>
An	O
exception	O
to	O
this	O
rule	O
is	O
in	O
the	O
case	O
of	O
shared	O
memory	O
;	O
for	O
example	O
,	O
in	O
the	O
System	B-Operating_System
V	I-Operating_System
inter-process	O
communication	O
mechanism	O
the	O
kernel	O
allocates	O
memory	O
to	O
be	O
mutually	O
shared	O
by	O
multiple	O
processes	B-Operating_System
.	O
</s>
<s>
Inadequate	O
memory	B-General_Concept
protection	I-General_Concept
mechanisms	O
,	O
either	O
due	O
to	O
flaws	O
in	O
their	O
design	O
or	O
poor	O
implementations	O
,	O
allow	O
for	O
security	O
vulnerabilities	O
that	O
may	O
be	O
potentially	O
exploited	O
by	O
malicious	O
software	O
.	O
</s>
<s>
Use	O
of	O
a	O
swap	B-Architecture
file	I-Architecture
or	O
swap	O
partition	O
is	O
a	O
way	O
for	O
the	O
operating	B-General_Concept
system	I-General_Concept
to	O
provide	O
more	O
memory	O
than	O
is	O
physically	O
available	O
by	O
keeping	O
portions	O
of	O
the	O
primary	O
memory	O
in	O
secondary	O
storage	O
.	O
</s>
<s>
While	O
multitasking	B-Operating_System
and	O
memory	O
swapping	O
are	O
two	O
completely	O
unrelated	O
techniques	O
,	O
they	O
are	O
very	O
often	O
used	O
together	O
,	O
as	O
swapping	O
memory	O
allows	O
more	O
tasks	O
to	O
be	O
loaded	O
at	O
the	O
same	O
time	O
.	O
</s>
<s>
Typically	O
,	O
a	O
multitasking	B-Operating_System
system	O
allows	O
another	O
process	O
to	O
run	O
when	O
the	O
running	O
process	O
hits	O
a	O
point	O
where	O
it	O
has	O
to	O
wait	O
for	O
some	O
portion	O
of	O
memory	O
to	O
be	O
reloaded	O
from	O
secondary	O
storage	O
.	O
</s>
<s>
Processes	B-Operating_System
that	O
are	O
entirely	O
independent	O
are	O
not	O
much	O
trouble	O
to	O
program	O
in	O
a	O
multitasking	B-Operating_System
environment	O
.	O
</s>
<s>
Most	O
of	O
the	O
complexity	O
in	O
multitasking	B-Operating_System
systems	O
comes	O
from	O
the	O
need	O
to	O
share	O
computer	O
resources	O
between	O
tasks	O
and	O
to	O
synchronize	O
the	O
operation	O
of	O
co-operating	O
tasks	O
.	O
</s>
<s>
Various	O
concurrent	B-Architecture
computing	I-Architecture
techniques	O
are	O
used	O
to	O
avoid	O
potential	O
problems	O
caused	O
by	O
multiple	O
tasks	O
attempting	O
to	O
access	O
the	O
same	O
resource	O
.	O
</s>
<s>
Bigger	O
systems	O
were	O
sometimes	O
built	O
with	O
a	O
central	O
processor(s )	O
and	O
some	O
number	O
of	O
I/O	B-Device
processors	I-Device
,	O
a	O
kind	O
of	O
asymmetric	B-Operating_System
multiprocessing	I-Operating_System
.	O
</s>
<s>
Over	O
the	O
years	O
,	O
multitasking	B-Operating_System
systems	O
have	O
been	O
refined	O
.	O
</s>
<s>
Modern	O
operating	B-General_Concept
systems	I-General_Concept
generally	O
include	O
detailed	O
mechanisms	O
for	O
prioritizing	O
processes	B-Operating_System
,	O
while	O
symmetric	B-Operating_System
multiprocessing	I-Operating_System
has	O
introduced	O
new	O
complexities	O
and	O
capabilities	O
.	O
</s>
