Thursday, October 1, 2020

Shortest Job First Algorithm in CPU

 

    What  do  you  mean  by Shortest  Job  First  Scheduling  Algorithm ?

    This algorithm is applied in a process which has smallest  CPU processing time .

    Basically this algorithm is applied in Batch Processing system.  

     Example:

                                    Process    Processing Time

                                      P1                   06

                                      P2                   08

                                      P3                   07

                                      P4                   03

 

    Using Shortest Job First as the Shortest Job will be used first the Gantt Chart

    will be as follows:

                            P4             P1          P3              P4

                    0               3              9                 16            24 

 

      Time        Process Completed        Turn Around Time                 Waiting Time    

           0                    -                                       -                                               -

           3                   P4                                    3                                              0

           9                   P1                                    9                                              3

          16                  P3                                   16                                             9

          24                  P2                                   24                                            16

                                                          

     Point To Note

    Turn  around Time : Process Completed  - Process submitted

    Waiting Time- :  Turn around Time - Processing Time

    Average Turn around Time = (3+9+16+24)/4  =13

    Average Waiting Time = (0+3+9+16)/4 =7

    Processor Utilization = (24/24)*100 = 100%

    Throughput  = 4/24 = 0.16

No comments:

Post a Comment