Consider a situation where a scheduling call (called a schedule () ) occurs.
❖
When the process needs to be blocked because the resource it needs
is unavailable at this time. In this case, its control unit is first added to
the
corresponding waiting queue, and then the redevelopment takes
place
❖
With the
delayed start ( lazy invocation ). The delayed startup is
that at a certain point in time, special field needs _
reached process
structures are assigned a value of 1. This is echoed in the following
cases: when the current process has exhausted its quantum; when a
process whose priority is higher than
the current one goes into
standby; when the process is clearly inferior to its right to execute
through an appropriate system call. This redevelopment happens
immediately, but later, when the process must regain control after the
interrupt, it checks whether the field is needed _ reached unit.
If equal,
the scheduling process is started
Planning Procedure
This procedure first checks that the current process is not in the standby
state, and if so, removes it from the process queue.
Then a process is
selected for execution. To do this, view the queue of finished processes, for
each process evaluate the dynamic priority and select the process and with
its maximum value. For a process that has run out of its quantum of time, it
will be zero. If no process has been selected, the current process
continues.
When the choice is made, the context is switched to a new
process .
The Beginning Of A New Era
A special situation arises when for all processes in the queue of ready
processes the value
of dynamic priority is zero, that is, they have all
exhausted their quantum, and it is time to start a new era. However, this
does not mean that the system does not
have processes for which the
quantum is not exhausted - they can be queued (most often, these are
processes that are limited by I / O.
When a new era opens, the quantum is recalculated for all system processes
(not just standby processes). In this case, the length of the quantum for each
process is set equal to the sum of its base priority and half of the remaining
quantum in it:
for each_task (p)
p.counter = (p.counter / 2) + p.nice;
Since the beginning of a new era of quantum remains nonzero only in
processes that are
not in a state of readiness, this algorithm provides an
advantage to processes disabilities output. In this case, the quantum value
for the process can never be greater than twice its base priority value .