Hi Vampyre
I found this question in TL501 of 2009. See the question and answer below. It's very similar to Q4:
"Consider the following preemptive priority scheduling algorithm based on dynamically changing
priorities. When a process is waiting for the CPU (in the ready queue, but not running), its priority
changes at a rate alpha; when it is running its priority changes at a rate beta. (alpha and beta represent real
numbers):
Do While (jobs in ready queue)
Start the job with the numerically highest
priority;
If (end of quantum or request for I/O)
then
Suspend the job currently running;
Add alpha to the priority of each waiting job;
Add beta to the priority of the job that has just been running
End_If
Accept any new jobs into the ready queue with priority 0
End_Do
Assume that a numerically larger value represents a higher priority.
All processes are given a priority of 0 when they enter the ready queue. The parameters á and â
can be set to give many different scheduling algorithms. If the number of jobs in the ready queue
is n, discuss fully the scheduling algorithms that result from each of the following settings of á
and â:
(a) beta > alpha > 0
(b) alpha < beta < 0
Answer:
(a) The priorities of the processes in the ready queue change at rate alpha, while the priority of the job that
was executed during the last time quantum is increased by beta. Both alpha and beta are greater than 0, but
beta > alpha. Therefore, the priority of the job which was executed during the last time quantum is increased
by more than any of the priorities of the waiting jobs, and will in the absence of an I/O request, never
be preempted. New processes join the system with priority 0 and therefore join the back of the ready
queue. The process that is currently running will run to completion without being interrupted by
another process. This leads a FCFS policy.
(b) Both alpha and beta are negative, and since we have alpha < beta it follows that á is a larger negative value than
beta. This implies that the priorities of the jobs waiting in the ready queue actually decrease relative to
the priority of the job which was run during the last time quantum. So, this appears to be again a
FCFS scheduling algorithm.
However, new processes enter the system with priority 0, and this is at any point in time the highest
priority for any of these jobs. Such new processes obtain, with the very next time slice, immediate
access to the CPU and therefore this reduces to a Last Come First Served (LCFS) algorithm. A LCFS
scheduling algorithm may lead to the starvation of older jobs, since the older a job, the lower its
priority."
PM me your email address and I can send the TL to you for other examples and questions.