<s>
Two-level	B-Operating_System
scheduling	I-Operating_System
is	O
a	O
computer	B-General_Concept
science	I-General_Concept
term	O
to	O
describe	O
a	O
method	O
to	O
more	O
efficiently	O
perform	O
process	O
scheduling	O
that	O
involves	O
swapped	O
out	O
processes	B-Operating_System
.	O
</s>
<s>
Consider	O
this	O
problem	O
:	O
A	O
system	O
contains	O
50	O
running	O
processes	B-Operating_System
all	O
with	O
equal	O
priority	O
.	O
</s>
<s>
However	O
,	O
the	O
system	O
's	O
memory	B-General_Concept
can	O
only	O
hold	O
10	O
processes	B-Operating_System
in	O
memory	B-General_Concept
simultaneously	O
.	O
</s>
<s>
Therefore	O
,	O
there	O
will	O
always	O
be	O
40	O
processes	B-Operating_System
swapped	O
out	O
written	O
on	O
virtual	B-Architecture
memory	I-Architecture
on	O
the	O
hard	O
disk	O
.	O
</s>
<s>
With	O
straightforward	O
Round-robin	B-Algorithm
scheduling	I-Algorithm
,	O
every	O
time	O
a	O
context	B-Operating_System
switch	I-Operating_System
occurs	O
,	O
a	O
process	O
would	O
need	O
to	O
be	O
swapped	O
in	O
(	O
because	O
only	O
the	O
10	O
least	O
recently	O
used	O
processes	B-Operating_System
are	O
swapped	O
in	O
)	O
.	O
</s>
<s>
Choosing	O
randomly	O
among	O
the	O
processes	B-Operating_System
would	O
diminish	O
the	O
probability	O
to	O
80%	O
(	O
40/50	O
)	O
.	O
</s>
<s>
That	O
is	O
where	O
two-level	B-Operating_System
scheduling	I-Operating_System
enters	O
the	O
picture	O
.	O
</s>
<s>
It	O
uses	O
two	O
different	O
schedulers	O
,	O
one	O
lower-level	O
scheduler	O
which	O
can	O
only	O
select	O
among	O
those	O
processes	B-Operating_System
in	O
memory	B-General_Concept
to	O
run	O
.	O
</s>
<s>
The	O
other	O
scheduler	O
is	O
the	O
higher-level	O
scheduler	O
whose	O
only	O
concern	O
is	O
to	O
swap	O
in	O
and	O
swap	O
out	O
processes	B-Operating_System
from	O
memory	B-General_Concept
.	O
</s>
<s>
Thus	O
,	O
the	O
higher-level	O
scheduler	O
selects	O
among	O
those	O
processes	B-Operating_System
in	O
memory	B-General_Concept
that	O
have	O
run	O
for	O
a	O
long	O
time	O
and	O
swaps	O
them	O
out	O
.	O
</s>
<s>
They	O
are	O
replaced	O
with	O
processes	B-Operating_System
on	O
disk	O
that	O
have	O
not	O
run	O
for	O
a	O
long	O
time	O
.	O
</s>
<s>
Exactly	O
how	O
it	O
selects	O
processes	B-Operating_System
is	O
up	O
to	O
the	O
implementation	O
of	O
the	O
higher-level	O
scheduler	O
.	O
</s>
<s>
If	O
this	O
variable	O
is	O
not	O
considered	O
resource	B-Operating_System
starvation	I-Operating_System
may	O
occur	O
and	O
a	O
process	O
may	O
not	O
complete	O
at	O
all	O
.	O
</s>
<s>
Size	O
of	O
the	O
process	O
:	O
Larger	O
processes	B-Operating_System
must	O
be	O
subject	O
to	O
fewer	O
swaps	O
than	O
smaller	O
ones	O
because	O
they	O
take	O
longer	O
time	O
to	O
swap	O
.	O
</s>
<s>
Because	O
they	O
are	O
larger	O
,	O
fewer	O
processes	B-Operating_System
can	O
share	O
the	O
memory	B-General_Concept
with	O
the	O
process	O
.	O
</s>
<s>
Priority	O
:	O
The	O
higher	O
the	O
priority	O
of	O
the	O
process	O
,	O
the	O
longer	O
it	O
should	O
stay	O
in	O
memory	B-General_Concept
so	O
that	O
it	O
completes	O
faster	O
.	O
</s>
