Understand process management
• CPU Scheduling Algorithms, FCFS




                                    1
HOME     PREVIOUS TOPIC
NEXT
PREVIOUS QUESTION PAPERS
FOR OS
CPP TUTORIALS




                           2
Recap

In last class, you have learnt
• CPU scheduling

• Scheduling criteria
   – CPU utilization

   – Through put

   – Turn around time

   – Waiting time

   – Response time
                                 3
Objectives

On completion of this class, you would be able to know
• Types of scheduling algorithms

• FCFS scheduling algorithm




                                                    4
Scheduling algorithms

• The CPU scheduling, selects a process in the ready
  queue, for execution using scheduling algorithms
• Scheduling algorithm can be classified into
   – First come, first served scheduling
   – Shortest job first scheduling
   – Priority scheduling
   – Round robin scheduling
   – Multilevel queue scheduling
   – Multilevel feedback queue scheduling
                                                       5
FCFS Scheduling Algorithm

•It is the simplest scheduling algorithm

• A process that requests the CPU first is allocated first

   Hence the name First come, First serve

• It is implemented by First in First out (FIFO) Queue

• Whenever the process enters into the ready queue PCB is
linked onto the tail of the queue
                                                         6
FCFS
  Consider an example of processes P1, P2, P3 arriving at
time instant 0 and their CPU burst times are shown below:
     Process                Burst time (msecs)
      P1                       24
      P2                       3
      P3                      3
      The Gantt chart below shows the result

            P1                     P2         P3
0                             24         27        30
                                                        7
FCFS
• Average waiting time and average turn around time are
  calculated using the example in previous slide
   – Waiting time = stating time – arrival time
   – The waiting time for process P1
   – P1= 0 – 0 = 0msec
   – The waiting time for process P2
   – P2 = 24 – 0 = 24msec
   – The waiting time for process P3
   – P3 = 27 – 0 = 27msec

• Average waiting time=(0+24+27)/3=17msec
                                                    8
FCFS ( Disadvantages )
• Average turn around time=(24+27+30)=27msec

• The average waiting time measured under FCFS policy is long
    (i.e. 17 m sec)
• For example in previous slide if processes arrive in the order P2,
    P3, P1 it results in the following Gantt chart

      P2          P3                   P1
     0          3                     6                   30

•   The average waiting time is (6+0+3)/3=3msec


                                                               9
FCFS (Disadvantages)

• FCFS scheduling algorithm is Non preemptive
   – So, trouble some for time sharing system

• Each user gets a share of CPU at regular intervals
  in timesharing system
• It is disastrous to allow are process to keep the
  keep the CPU for an extended period


                                                       11
Summary

In this class, you have learnt
• Types of scheduling algorithms

• FCFS algorithm

• Disadvantages of FCFS algorithm




                                    12
Frequently Asked Questions

1. List the types of CPU scheduling algorithm

2. Explain FCFS algorithm

3. Write the disadvantages of FCFS algorithm




                                                13
Quiz

1. FCFS algorithm is implemented by _________
a) Job queue
b) FIFO queue
c) Ready queue
d) None




                                                14
Quiz

2. When the process enters into ready queue PCB is linked in
     to __________ of queue

a)   Head

b)   Tail

c)   None




                                                           15
Quiz

3. Average waiting time on FCFS algorithm is ________

a)   Long

b)   Short

c)   None




                                                        16
Quiz


4. FCFS algorithm is ______________
a) Preemptive
b) Non preemptive
c) None




                                      17
Other subject materials
•   Web designing
•   Micro processors
•   C++ tutorials
•   java

home

9 cm402.18

  • 1.
    Understand process management •CPU Scheduling Algorithms, FCFS 1
  • 2.
    HOME PREVIOUS TOPIC NEXT PREVIOUS QUESTION PAPERS FOR OS CPP TUTORIALS 2
  • 3.
    Recap In last class,you have learnt • CPU scheduling • Scheduling criteria – CPU utilization – Through put – Turn around time – Waiting time – Response time 3
  • 4.
    Objectives On completion ofthis class, you would be able to know • Types of scheduling algorithms • FCFS scheduling algorithm 4
  • 5.
    Scheduling algorithms • TheCPU scheduling, selects a process in the ready queue, for execution using scheduling algorithms • Scheduling algorithm can be classified into – First come, first served scheduling – Shortest job first scheduling – Priority scheduling – Round robin scheduling – Multilevel queue scheduling – Multilevel feedback queue scheduling 5
  • 6.
    FCFS Scheduling Algorithm •Itis the simplest scheduling algorithm • A process that requests the CPU first is allocated first Hence the name First come, First serve • It is implemented by First in First out (FIFO) Queue • Whenever the process enters into the ready queue PCB is linked onto the tail of the queue 6
  • 7.
    FCFS Consideran example of processes P1, P2, P3 arriving at time instant 0 and their CPU burst times are shown below: Process Burst time (msecs) P1 24 P2 3 P3 3 The Gantt chart below shows the result P1 P2 P3 0 24 27 30 7
  • 8.
    FCFS • Average waitingtime and average turn around time are calculated using the example in previous slide – Waiting time = stating time – arrival time – The waiting time for process P1 – P1= 0 – 0 = 0msec – The waiting time for process P2 – P2 = 24 – 0 = 24msec – The waiting time for process P3 – P3 = 27 – 0 = 27msec • Average waiting time=(0+24+27)/3=17msec 8
  • 9.
    FCFS ( Disadvantages) • Average turn around time=(24+27+30)=27msec • The average waiting time measured under FCFS policy is long (i.e. 17 m sec) • For example in previous slide if processes arrive in the order P2, P3, P1 it results in the following Gantt chart P2 P3 P1 0 3 6 30 • The average waiting time is (6+0+3)/3=3msec 9
  • 11.
    FCFS (Disadvantages) • FCFSscheduling algorithm is Non preemptive – So, trouble some for time sharing system • Each user gets a share of CPU at regular intervals in timesharing system • It is disastrous to allow are process to keep the keep the CPU for an extended period 11
  • 12.
    Summary In this class,you have learnt • Types of scheduling algorithms • FCFS algorithm • Disadvantages of FCFS algorithm 12
  • 13.
    Frequently Asked Questions 1.List the types of CPU scheduling algorithm 2. Explain FCFS algorithm 3. Write the disadvantages of FCFS algorithm 13
  • 14.
    Quiz 1. FCFS algorithmis implemented by _________ a) Job queue b) FIFO queue c) Ready queue d) None 14
  • 15.
    Quiz 2. When theprocess enters into ready queue PCB is linked in to __________ of queue a) Head b) Tail c) None 15
  • 16.
    Quiz 3. Average waitingtime on FCFS algorithm is ________ a) Long b) Short c) None 16
  • 17.
    Quiz 4. FCFS algorithmis ______________ a) Preemptive b) Non preemptive c) None 17
  • 18.
    Other subject materials • Web designing • Micro processors • C++ tutorials • java home