<s>
An	O
O(1 )	O
scheduler	O
(	O
pronounced	O
"	O
O	O
of	O
1	O
scheduler	O
"	O
,	O
"	O
Big	O
O	O
of	O
1	O
scheduler	O
"	O
,	O
or	O
"	O
constant	O
time	O
scheduler	O
"	O
)	O
is	O
a	O
kernel	B-Operating_System
scheduling	O
design	O
that	O
can	O
schedule	O
processes	B-Operating_System
within	O
a	O
constant	O
amount	O
of	O
time	O
,	O
regardless	O
of	O
how	O
many	O
processes	B-Operating_System
are	O
running	O
on	O
the	O
operating	B-General_Concept
system	I-General_Concept
.	O
</s>
<s>
This	O
is	O
an	O
improvement	O
over	O
previously	O
used	O
O(n )	O
schedulers	O
,	O
which	O
schedule	O
processes	B-Operating_System
in	O
an	O
amount	O
of	O
time	O
that	O
scales	B-Algorithm
linearly	O
based	O
on	O
the	O
amounts	O
of	O
inputs	O
.	O
</s>
<s>
In	O
the	O
realm	O
of	O
real-time	B-Operating_System
operating	I-Operating_System
systems	I-Operating_System
,	O
deterministic	O
execution	O
is	O
key	O
,	O
and	O
an	O
O(1 )	O
scheduler	O
is	O
able	O
to	O
provide	O
scheduling	O
services	O
with	O
a	O
fixed	O
upper-bound	O
on	O
execution	O
times	O
.	O
</s>
<s>
The	O
O(1 )	O
scheduler	O
was	O
used	O
in	O
Linux	B-Operating_System
releases	O
2.6.0	O
thru	O
2.6.22	O
(	O
2003-2007	O
)	O
,	O
at	O
which	O
point	O
it	O
was	O
superseded	O
by	O
the	O
Completely	B-Application
Fair	I-Application
Scheduler	I-Application
.	O
</s>
<s>
The	O
Linux	B-Operating_System
scheduler	O
was	O
overhauled	O
completely	O
with	O
the	O
release	O
of	O
kernel	B-Operating_System
2.6	O
in	O
2003	O
.	O
</s>
<s>
The	O
algorithm	O
used	O
by	O
the	O
O(1 )	O
scheduler	O
relies	O
on	O
active	O
and	O
expired	O
arrays	O
of	O
processes	B-Operating_System
to	O
achieve	O
constant	O
scheduling	O
time	O
.	O
</s>
<s>
Each	O
process	O
is	O
given	O
a	O
fixed	O
time	O
quantum	O
,	O
after	O
which	O
it	O
is	O
preempted	B-Operating_System
and	O
moved	O
to	O
the	O
expired	O
array	O
.	O
</s>
<s>
This	O
allows	O
the	O
Linux	B-Operating_System
kernel	I-Operating_System
to	O
efficiently	O
handle	O
massive	O
numbers	O
of	O
tasks	O
without	O
increasing	O
overhead	O
costs	O
as	O
the	O
number	O
of	O
tasks	O
grows	O
.	O
</s>
<s>
There	O
are	O
two	O
key	O
data	O
structures	O
in	O
the	O
Linux	O
2.6.8.1	O
scheduler	O
that	O
allow	O
for	O
it	O
to	O
perform	O
its	O
duties	O
in	O
O(1 )	O
time	O
,	O
and	O
its	O
design	O
revolves	O
around	O
them	O
:	O
runqueues	B-Application
and	O
priority	O
arrays	O
.	O
</s>
<s>
The	O
main	O
issue	O
with	O
this	O
algorithm	O
is	O
the	O
complex	O
heuristics	O
used	O
to	O
mark	O
a	O
task	O
as	O
interactive	B-General_Concept
or	O
non-interactive	O
.	O
</s>
<s>
The	O
algorithm	O
tries	O
to	O
identify	O
interactive	B-General_Concept
processes	B-Operating_System
by	O
analyzing	O
average	O
sleep	O
time	O
(	O
the	O
amount	O
of	O
time	O
the	O
process	O
spends	O
waiting	O
for	O
input	O
)	O
.	O
</s>
<s>
Processes	B-Operating_System
that	O
sleep	O
for	O
long	O
periods	O
of	O
time	O
probably	O
are	O
waiting	O
for	O
user	O
input	O
,	O
so	O
the	O
scheduler	O
assumes	O
they	O
're	O
interactive	B-General_Concept
.	O
</s>
<s>
The	O
scheduler	O
gives	O
a	O
priority	O
bonus	O
to	O
interactive	B-General_Concept
tasks	O
(	O
for	O
better	O
throughput	O
)	O
while	O
penalizing	O
non-interactive	O
tasks	O
by	O
lowering	O
their	O
priorities	O
.	O
</s>
<s>
All	O
the	O
calculations	O
to	O
determine	O
the	O
interactivity	O
of	O
tasks	O
are	O
complex	O
and	O
subject	O
to	O
potential	O
miscalculations	O
,	O
causing	O
non-interactive	O
behavior	O
from	O
an	O
interactive	B-General_Concept
process	O
.	O
</s>
<s>
In	O
2.6.23	O
(	O
October	O
2007	O
)	O
,	O
the	O
Completely	B-Application
Fair	I-Application
Scheduler	I-Application
was	O
introduced	O
,	O
replacing	O
the	O
O(1 )	O
Scheduler	O
.	O
</s>
