Page 82 - DCAP403_Operating System
P. 82

Unit 5: Scheduling




          5.3.1 First-Come, First-Served (FCFS)                                                 Notes

          This is a Non-Preemptive scheduling algorithm. FCFS strategy assigns priority to processes in

          the order in which they request the processor. The process that requests the CPU first is allocated

          the CPU first. When a process comes in, add its PCB to the tail of ready queue. When running
          process terminates, dequeue the process (PCB) at head of ready queue and run it.
                                      Figure 5.2: FCFS Scheduling


                     P            P          P           P           P           P
                      1            2          3           4           5           6
                    3 time      4 time      2 time      3 time      3 time      5 time
                    units       units       units       units       units       units






          Advantage

          Very simple

          Disadvantages

          1.   Long average and worst-case waiting times

          2.   Poor dynamic behavior (convoy effect - short process behind long process)
                                       Figure 5.3: Convey Effects

                                                      CPU


                                                       I/O
                                              empty!


                          CPU-bound
                          I/O-bound
                                                      CPU
                                              empty!


                                                       I/O




                Example:


                                   Process           Burst Time
                                     P                  24
                                      1
                                     P                  3
                                      2
                                     P 3                3





                                           LOVELY PROFESSIONAL UNIVERSITY                                    75
   77   78   79   80   81   82   83   84   85   86   87