Download Operating systems 1

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Nazareth-Conferences wikipedia , lookup

Control chart wikipedia , lookup

Transcript
Operating systems 1
CSC 203
Group 6
Multilevel Feedback Queue
12/27/2014
Ekpikhe John Elizabeth
Multilevel Queue Scheduling
multilevel queue
A multilevel queue scheduling algorithm partitions the ready queue in several separate queues.
In a multilevel queue scheduling processes are permanently assigned to one queue. The
processes are permanently assigned to one another, based on some property of the process,
such as

Memory size

Process priority

Process type
For instance, what happens if several processes get assigned the same priority? This is a realistic
possibility since picking a unique priority level for each of possibly hundreds or thousands of
processes on a system may not be feasible.
We can group processes into priority classes and assign a separate run queue for each class.
This allows us to categorize and separate system processes, interactive processes, low-priority
interactive processes, and background non-interactive processes. The scheduler picks the
highest-priority queue (class) that has at least one process in it. In this sense, it behaves like a
priority scheduler. It then picks a process from the queue. Each queue may use a different
scheduling algorithm, if desired (round-robin, the most common per level) and may also
choose a different quantum. For example, low-priority non-interactive processes could be
given a longer quantum. They won’t get to run as often since they are in a low priority queue
but, when they do, the scheduler will let them run longer. Linux, on the other hand, does the
opposite. It gives a longer quantum to high-priority processes on the assumption that they are
important and that they are likely to be interactive so they will usually block long before using
up their time slice. Multi-level queues are generally used as a top-level scheduling discipline
to separate broad classes of processes, such as real-time, kernel threads, interactive, and
background processes. Specific schedulers within each class determine which process gets to
run within that class. Most operating systems, including Windows, Linux, and OS X support a
form of multilevel queues and scheduling classes.
Multilevel feedback Queue scheduling
multilevel feedback queue
The main goal of the multilevel feedback queue scheduling is to automatically place processes
into priority levels based on their CPU burst behavior. I/O-intensive processes will end up on
higher priority queues and CPU-intensive processes will end up on low priority queues.
The scheduler may choose from a variety of algorithms to determine a priority level (e.g., the
weighted average that we discussed). One approach is to give high priority queues short time
slices. The time slice increases for each decreasing priority queue. A process initially starts in
the highest priority queue. Once it gets scheduled to run, it will either run or then block on
some event or it will run until the quantum expires. If the process blocks then the scheduler
will move the process onto the same priority queue when it is ready to run again. If, however,
the process runs to expiration (i.e., the scheduler sees that the process is still running when its
quantum expires) then the scheduler preempts the process and punishes it by placing it in the
queue at the next lower priority level.
As long as a process uses the full quantum at each level, it continues to drop to lower priority
levels (eventually reaching the lowest level, where it circulates round robin). At each lower
priority level, the quantum is increased (so the process does not get the CPU often, but gets to
use more of it when it does get it). The rationale for this is that processes at lower levels have
demonstrated that they are compute bound rather than I/O bound. By giving them a fatter
chunk of the CPU, but only when there are no higher priority processes to run, we can
minimize the context switch overhead and get more efficient use of the CPU.
A process that waits too long to be scheduled may be moved up to a high-priority queue
(process aging). That will give it a chance to run. If it does not use up its entire time slice, it will
remain at that level. If it does use up its time slice, it will drop the lower level and keep
dropping as long as it continues to use up its time slice. This mechanism is also a way to allow
interactive processes to get rescheduled back to a high priority even if they had to do some
CPU-intensive work for a while.
While it is most common for each queue to circulate processes round-robin, as with multilevel
queues, each queue may have its own scheduling algorithm to determine the order in which
the scheduler removes a process from the queue
The multi-level feedback queue is an excellent example of a system that learns from the past to
predict the future. Such approaches are common in operating systems (and many other places
in Computer Science, including hardware branch predictors and caching algorithms). Such
approaches work when jobs have phases of behavior and are thus predictable; of course, one
must be careful with such techniques, as they can easily be wrong and drive a system to make
worse decisions than they would have with no knowledge at all.
The multilevel feedback queues scheduling is an enhancement of multilevel queue scheduling
where process can move between the queues. In approach, the ready queue is partitioned into
multiple queues of different priorities. The system use to assign processes to queue based on
their CPU burst characteristic. If a process consumes too much CPU time, it is placed into a
lower priority queue. It favors Input/output bound jobs to get good input/output device
utilization. A technique called aging promotes lower priority processes to the next higher
priority queue after a suitable interval of time.
Multi-level feedback queues work well in favoring Input/output bound processes with
frequent scheduling by keeping them at high priorities. What would happen if an Input/output
intensive process such as a text editor first needed to perform some CPU-intensive work (such
as initializing a lot of structures and tables)? Although it would get scheduled at a high priority
initially, it would find itself using up its quantum and demoted to a lower level. There too, it
may not be done with its processing and be demoted to yet lower levels before it eventually
performs a blocking Input/output request. Now it will be doomed to run at a low priority level,
providing inadequate interactive performance. Some systems, such as MIT’s Compatible TimeSharing System (CTSS), dealt with this problem by always raising the priority of a process
whenever it blocked on Input/output. Process aging, as we discussed, is another way to rescue
an interactive process that had a period of CPU-intensive activity and was therefore punished
down to a lower priority queue. A drawback with the multi-level feedback queue approach is
the users could game the system by inserting useless Input/output operations into their
programs just to fool the schedule.
Multilevel feedback queue-scheduling algorithm allows a process to move between queues. It
uses many ready queues and associates a different priority with each queue. The Algorithm
chooses to process with highest priority from the occupied queue and run that process either
preemptively or non-preemptively. If the process uses too much CPU time it will moved to a
lower-priority queue. Similarly, a process that waits too long in the lower-priority queue may
be moved to a higher-priority queue or may be moved to a highest-priority queue. However it
is to be noted that this form of aging prevents starvation.
Advantages

A process that waits too long in a lower priority queue may be moved to a higher priority queue

Multi-level feedback queues are good for separating processes into categories based on their
need for a CPU. They favor I/O bound processes by letting them run often. Versions of this
scheduling policy that increases the quantum at lower priority levels also favor CPU bound
processes by giving them a larger chunk of CPU time when they are allowed to run.
Disadvantages

Moving the process around queue produce more CPU overhead.

The priority scheme here is one that is controlled by the system rather than by the
administrator or users. A process is deemed important not because it is, but because it
happens to do a lot of I/O. This scheduler also has the drawback that I/O bound
processes that become CPU bound or CPU bound processes that become I/O bound will
not get scheduled well.

One problem with feedback queues is that the process needs to be assigned to the most suitable
priority queue a priori. If a CPU-bound process is assigned to a short-quantum, high-priority
queue, that’s not optimal for either the process or for overall throughput