For the conventional time –shared
processes, Linux uses a prioritized, credit-based algorithm. Each process
possesses a certain number of scheduling credits; when a new task must be
chosen to run, the process with most credits is selected. Every time that a
timer interrupt occurs, the currently running process loses one credit; when
its credits reaches zero, it is suspended and another process is chosen.
If no runnable processes have any credits,
then Linux performs a recrediting operation, adding credits to every process in
the system (rather than just to the runnable ones), according to the following
rule:
Credits
= credits/2 + priority
The above scheduling
class is used for time-shared process and the in Linux for the real-time
scheduling is simpler it uses scheduling classes: first come, first served
(FCFS), and round-robin (RR) .In both cases, each process has a priority in
addition to its scheduling class. In time-sharing scheduling, however,
processes of different priorities can still compete with one another to some
extent; in real-time scheduling, the scheduler always runs the process with the
highest priority. Among processes of equal priority, it runs the process that
has been waiting longest. The only difference between FCFS and RR scheduling is
that FCFS processes continue to run until they either exit or block, whereas a
round-robin process will be preempted after a while and will be moved to the
end of the scheduling queue, so round-robin processes of equal priority will
automatically time share among themselves.
Linux’s real-time
scheduling is soft-real time rather than hard-real time. The scheduler offers
strict guarantees about the relative priorities of real-time processes, but the
kernel does not offer any guarantees about how quickly a real-time process will
be scheduled once that process becomes runnable.
Thus the
Linux uses different scheduling classes for time-shared and real-time
processes.
No comments:
Post a Comment