Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Consider the following preemptive priority-scheduling algorithm based on dynamic

ID: 3736805 • Letter: C

Question

Consider the following preemptive priority-scheduling algorithm based on dynamically changing priorities. Larger numbers imply higher priority. Tasks are preempted whenever there is a higher priority task. When a task is waiting for CPU (in the ready queue, but not running), its priority changes at a rate of a:

P(t) = P0 + a × (t - t0)

where t0 is the time at which the task joins the ready queue and P0 is its initial priority, assigned when the task enters the ready queue or is preempted. Similarly, when it is running, the task’s priority changes at a rate b. The parameters a, b and P0 can be used to obtain many different scheduling algorithms.

c. Suppose tasks are assigned a priority 0 when they arrive, but they retain their priority when they are preempted. What happens if two tasks arrive at nearly the same time and a > 0 > b?

d. How should we adjust the algorithm to eliminate this pathology?

Explanation / Answer

Initially when tasks arrive, their priority is 0, which changes at the rate of a when it is in waiting state and changes at the rate of b when it is running.

Answer c.

Answer d.