A priority is associated with each process. SJF algorithm is a special case of PRI. Processes with equal priorities may be scheduled in accordance with FCFS.

PRI (L, M, H (RR))                                                    

fifo_queue fQ[3]                                                         // data structure

add_task(proc, pri)
          fQ[pri].add_tail(proc)

reschedule(why)
          if (why == timer)
                   add_task(current, current.pri);
          set_timer(TQ);
          for pri=H to L
                   if(fQ[pri].empty())
                             return fQ[pri].remove_head();

 

TQ=6

 

PRI

Utilization

26/(26+4CS)

Response

(0+8+14+21+4CS)/4 = 10.75 ignoring CS

PRI (L, M, H (RR) + aging):

fifo_queue fQ[3]

add_task(proc.pri)
          fQ[pri].add_task(proc)

reschedule(why)
          if (why=timer)
                   add_task(current, current.pri);
          set_timer(TQ);
          for pri=M to L
                   for p in fQ[pri]
                             if now-p.list> limit
                                      remove(p)
                                      add_task(p, pri+1)
          for pri=H to L
                   if(fQ[pri].empty())
                             return fQ[pri].remove_head();

Limit=12

Note: in this case, it’s the same as the regular pri, but that’s not always the case. For this specific case, it’s the same because C goes before D in M pri when D gets aged to M. There is a problem with PRI, which is indefinite blocking (or starvation). The technique of aging, which gradually increase the priorities of the waiting processes, is used to solve the problem.