Monday, October 5, 2020

Priority Based Scheduling or Event Driven Scheduling Algorithm

 

   What  do  you  mean  by  Priority  Based Scheduling ?

   A priority is associated  with  each process and   the scheduler always picks 

   up the highest priority process for execution from the ready queue . A major

   problem with the priority based scheduling is that there is indefinite blocking

   of  a   lost  priority  process  by a high priority  process. A solution to this

  problem is aging priority.. Aging Priority is a technique  of gradually  increasing

  the priority  of  a   process   that  wait  in  the  system  for  a  long  time.

  Eventually  the  older  process  attain  a higher  priority  and are endured of 

  completion in a finite term.


Let us understand with the help of an example:


             Process          Processing Time              Priority

                P1                     10                                     3

                P2                      1                                      1

                P3                      2                                      4

                P4                      1                                      5

                P5                      5                                      2   


Using Priority scheduling we would be scheduling the processes  according  

to  the following  Gantt Chart .

 

                          P2           P5                          P1                        P3         P4

                      0       1                   6                                       16         18         19       

 

Time            Process  Completed           Turn Around Time               Waiting Time

   0                             -----                                     ----                                   ----

   1                              P2                                    1-0=1                                 1-1=0

   6                              P5                                    6-0 =6                                6-2=4

  16                             P1                                   16-0=16                            16-10=6

  18                             P3                                   18-2=16                            18-2=16

  19                             P4                                   19-1=18                            19-1=18 


Average Turn around Time= 1+6+16+16+18/5 = 60/5 = 12

Average waiting Time = 6+0+16+18+1/5= 8.2

Throughput = 5/19 = 0.26

Processor  utilization = 30/30 * 100 = 100%


       

    

 

No comments:

Post a Comment