MU-MIT
CPU SCHEDULING ALGORITHIM
GROUP ONE MEMBERS
Name : ID : Department:
1.Filmon Haile MIT/0039/06 CSE
2.Haile Tekulu MIT/0068/06CSE
3.Kasahun Tadesse MIT/0077/06 CSE
4.Kibrom Tesfay MIT/0078/06CSE
5.Mebrat W/gewergs MIT/0089/06 CSE
CONTENTS CPU SCHEDULING ALGORITHIM
1. FCFS SCHEDULING ALGORITHIM
2. SJF SCHDULING ALGORITHIM
3. PRIORITY SCHEDULING ALGORITHIM
4. RR SCHEDULING ALGORITHIM
5. MULTI LEVEL SCHEDULING ALGORITHIM
 CPU Scheduler algorithm
 Selects from among the processes in memory that are ready
to execute, and allocates the CPU to one of them.
 There are different non-preemptive algorithms to schedule CPU algorithms
those are As follows :-
1.FCFS SCHEDULING ALGORITHM
For FCFS scheduling algorithm, read the number of processes/jobs in the
system, their CPU burst times.
The scheduling is performed on the basis of arrival time of the processes
irrespective of their other parameters. Each process will be executed according
to its arrival time. Calculate the waiting time and turnaround time of each of
the processes accordingly.
FCFS Scheduling algorithm
 Goal: To write a program for implementing FCFS scheduling algorithm.
ALGORITHM:
1) Firstly, read the number of processes/jobs in the system, and their
CPU burst time .
2) The scheduling performed on the basis of arrival time of the processes irrespective
of their other parameters.
3) Each process will be executed according to its arrival time.
4 ) finally, Calculate the waiting time and turnaround time of each the processes
accordingly.
 Example1: FCFS
 process Burst Time
P0 24
P1 3
P2 3
Suppose that the processes arrive in the order: P0 ,P1,P2.
 DESCRIPTION to the above running program
N.B. Turnaround time – amount of time to execute a particular process
Waiting time – amount of time a process has been waiting in the ready queue.
let see the calculation how can we gained or the formula of the above result
A. Waiting time:p0=0,p1=0+24=24,p2=0+24+3=27
B. Turnaround time=burst time +waiting time
C. Total waiting time=total waiting time + waiting time
D. Total Turnaround time= Total Turnaround time+Turnaroundtime
E. Average waiting time=total waiting time/total n
F. Average turnaround time= Total Turnaround time/total n
where n is total number of process.
2. SJF CPU SCHEDULING ALGORITHM
 For SJF scheduling algorithm, read the number of processes/jobs in the system,
their CPU burst times. Arrange all the jobs in order with respect to their burst
times.
 There may be two jobs in queue with the same execution time, and then FCFS
approach is to be performed.
 Each process will be executed according to the length of its
burst time.
 Then calculate the waiting time and turnaround time of each of the processes
accordingly.


SJF Scheduling algorithm
goal: To write a program for implementing SJF scheduling algorithm.
ALGORITHM:
1) Firstly, read the number of processes/jobs in the system, and their CPU burst
time .
2) Arrange all the jobs in order with respect to their burst times.
3) There may be two jobs in queue with the same execution time, and then
FCFS approach is to be performed.
4) Each process will be executed according to the length of its burst time.
5)finally calculate the waiting time and turnaround time of each of the
processes accordingly.
 It is the same as FCFS in the above example 1 ,but the only difference is
Arrange all the jobs in order with respect to their burst times. There may be two
jobs in queue with the same execution time, and then FCFS approach is to be
performed.
 Associate with each process the length of its next CPU burst. Use
these lengths to schedule the process with the shortest time.
A. Waiting time:p1=0,p2=0+3=3,p0=0+3+3=6
B. Turnaround time=burst time +waiting time
C. Total waiting time=total waiting time + waiting time
D. Total Turnaround time= Total Turnaround time+Turnaroundtime
E. Average waiting time=total waiting time/total n
F. Average turnaround time= Total Turnaround time/total n
where n is total number of process.
 3.PRIORITY CPU SCHEDULING ALGORITHM
 For priority scheduling algorithm, read the number of processes/jobs in the system,
their CPU burst times, and the priorities. Arrange all the jobs in order with respect to
their priorities.
 There may be two jobs in queue with the same priority, and then FCFS approach is to
be performed. Each process will be executed according to its priority.
 Calculate the waiting time and turnaround time of each of the processes accordingly.
 Priority scheduling algorithm
Goal: To write a program for implement the priority scheduling algorithm.
ALGORITHM:
1) read the number of processes/jobs in the system, their CPU burst times, and the
priorities.
2) Arrange all the jobs in order with respect to their priorities.
3) There may be two jobs in queue with the same priority, and then FCFS approach
is to be performed.
4) Each process will be executed according to its priority.
5) Calculate the waiting time and turnaround time of each of the processes
accordingly.
 In this one by adding priority Process is ordered based on priority. the smallest number of
priority comes first ,then see to the burst time that are matched to the process. The other part is
semis like the above algorithm.
 The CPU is allocated to the process with the highest priority (smallest
integer = highest priority).
Waiting time:p2=0,p1=0+3=3,p0=0+3+3=6
A. Turnaround time=burst time +waiting time
B. Total waiting time=total waiting time + waiting time
C. Total Turnaround time= Total Turnaround time+Turnaroundtime
D. Average waiting time=total waiting time/total n
E. Average turnaround time= Total Turnaround time/total n
where n is total number of process.
 4.ROUND ROBIN CPU SCHEDULING
ALGORITHM
 For round robin scheduling algorithm, read the number of processes/jobs in the
system, their CPU burst times, and the size of the time slice.
 Time slices are assigned to each process in equal portions and in circular order,
handling all processes execution.
 This allows every process to get an equal chance.
 Calculate the waiting time and turnaround time of each of the processes
accordingly.
 Round Robin Scheduling algorithm
Goal: to write a program for to implementing the round robin scheduling algorithm
ALGORITHM:
1) Firstly, read the number of processes/jobs in the system, their CPU burst times,
and the size of the time slice.
2) Time slices are assigned to each process in equal portions and in circular order,
handling all processes execution.
3) This allows every process to get an equal chance.
4) Calculate the waiting time and turnaround time of each of the processes accordingly.
 The only difference with the above algorithms that we are taking example is in this one we
are going to use size of the time slice. This time slices is used to assigned to each process in
equal portions and in circular order, handling all processes execution. This allows every
process to get an equal chance. Let we use from the above example1.the time slice for instance
tq=2.
 5. Multi-Level Queue Scheduling Algorithm
 Multi-level queue scheduling algorithm is used in scenarios where the processes can be
classified into groups based on property like process type, CPU time, IO access, memory
size, etc.
 In a multilevel queue scheduling algorithm, there will be 'n' number of queues, where 'n'
is the number of groups the processes are classified into. Each queue will be assigned a
priority and will have its own scheduling algorithm like FCFS.
 For the process in a queue to execute, all the queues of priority higher than it should be
empty, meaning the process in those high priority queues should have completed its
execution.
 In this scheduling algorithm, once assigned to a queue, the process will not move to any
other queues.
 Multi-Level Queue Scheduling Algorithm
Goal: : to write a program for to implement multi-level queue scheduling algorithm
ALGORITHM:
1) Firstly, there will be 'n' number of queues, where 'n' is the number of groups the processes are
classified into.
2) Each queue will be assigned a priority and will have its own scheduling algorithm like
FCFS scheduling algorithm.
3) For the process in a queue to execute, all the queues of priority higher than it should be empty,
meaning the process in those high priority queues should have completed its execution.
4) Lastly In this scheduling algorithm, once assigned to a queue, the process will not move to any
other queues.
 In this algorithm we use 0 for system process 1 for user process.
Let use from example 1.
THANK
YOU !!!
IF YOU HAVE ANY
QUESTION
WELLCOME.

cpu scheduling algorithm Presentation7.pptx

  • 1.
    MU-MIT CPU SCHEDULING ALGORITHIM GROUPONE MEMBERS Name : ID : Department: 1.Filmon Haile MIT/0039/06 CSE 2.Haile Tekulu MIT/0068/06CSE 3.Kasahun Tadesse MIT/0077/06 CSE 4.Kibrom Tesfay MIT/0078/06CSE 5.Mebrat W/gewergs MIT/0089/06 CSE
  • 2.
    CONTENTS CPU SCHEDULINGALGORITHIM 1. FCFS SCHEDULING ALGORITHIM 2. SJF SCHDULING ALGORITHIM 3. PRIORITY SCHEDULING ALGORITHIM 4. RR SCHEDULING ALGORITHIM 5. MULTI LEVEL SCHEDULING ALGORITHIM
  • 3.
     CPU Scheduleralgorithm  Selects from among the processes in memory that are ready to execute, and allocates the CPU to one of them.  There are different non-preemptive algorithms to schedule CPU algorithms those are As follows :- 1.FCFS SCHEDULING ALGORITHM For FCFS scheduling algorithm, read the number of processes/jobs in the system, their CPU burst times. The scheduling is performed on the basis of arrival time of the processes irrespective of their other parameters. Each process will be executed according to its arrival time. Calculate the waiting time and turnaround time of each of the processes accordingly.
  • 4.
    FCFS Scheduling algorithm Goal: To write a program for implementing FCFS scheduling algorithm. ALGORITHM: 1) Firstly, read the number of processes/jobs in the system, and their CPU burst time . 2) The scheduling performed on the basis of arrival time of the processes irrespective of their other parameters. 3) Each process will be executed according to its arrival time. 4 ) finally, Calculate the waiting time and turnaround time of each the processes accordingly.
  • 5.
     Example1: FCFS process Burst Time P0 24 P1 3 P2 3 Suppose that the processes arrive in the order: P0 ,P1,P2.
  • 6.
     DESCRIPTION tothe above running program N.B. Turnaround time – amount of time to execute a particular process Waiting time – amount of time a process has been waiting in the ready queue. let see the calculation how can we gained or the formula of the above result A. Waiting time:p0=0,p1=0+24=24,p2=0+24+3=27 B. Turnaround time=burst time +waiting time C. Total waiting time=total waiting time + waiting time D. Total Turnaround time= Total Turnaround time+Turnaroundtime E. Average waiting time=total waiting time/total n F. Average turnaround time= Total Turnaround time/total n where n is total number of process.
  • 7.
    2. SJF CPUSCHEDULING ALGORITHM  For SJF scheduling algorithm, read the number of processes/jobs in the system, their CPU burst times. Arrange all the jobs in order with respect to their burst times.  There may be two jobs in queue with the same execution time, and then FCFS approach is to be performed.  Each process will be executed according to the length of its burst time.  Then calculate the waiting time and turnaround time of each of the processes accordingly.
  • 8.
      SJF Scheduling algorithm goal:To write a program for implementing SJF scheduling algorithm. ALGORITHM: 1) Firstly, read the number of processes/jobs in the system, and their CPU burst time . 2) Arrange all the jobs in order with respect to their burst times. 3) There may be two jobs in queue with the same execution time, and then FCFS approach is to be performed. 4) Each process will be executed according to the length of its burst time. 5)finally calculate the waiting time and turnaround time of each of the processes accordingly.
  • 9.
     It isthe same as FCFS in the above example 1 ,but the only difference is Arrange all the jobs in order with respect to their burst times. There may be two jobs in queue with the same execution time, and then FCFS approach is to be performed.
  • 10.
     Associate witheach process the length of its next CPU burst. Use these lengths to schedule the process with the shortest time. A. Waiting time:p1=0,p2=0+3=3,p0=0+3+3=6 B. Turnaround time=burst time +waiting time C. Total waiting time=total waiting time + waiting time D. Total Turnaround time= Total Turnaround time+Turnaroundtime E. Average waiting time=total waiting time/total n F. Average turnaround time= Total Turnaround time/total n where n is total number of process.
  • 11.
     3.PRIORITY CPUSCHEDULING ALGORITHM  For priority scheduling algorithm, read the number of processes/jobs in the system, their CPU burst times, and the priorities. Arrange all the jobs in order with respect to their priorities.  There may be two jobs in queue with the same priority, and then FCFS approach is to be performed. Each process will be executed according to its priority.  Calculate the waiting time and turnaround time of each of the processes accordingly.
  • 12.
     Priority schedulingalgorithm Goal: To write a program for implement the priority scheduling algorithm. ALGORITHM: 1) read the number of processes/jobs in the system, their CPU burst times, and the priorities. 2) Arrange all the jobs in order with respect to their priorities. 3) There may be two jobs in queue with the same priority, and then FCFS approach is to be performed. 4) Each process will be executed according to its priority. 5) Calculate the waiting time and turnaround time of each of the processes accordingly.
  • 13.
     In thisone by adding priority Process is ordered based on priority. the smallest number of priority comes first ,then see to the burst time that are matched to the process. The other part is semis like the above algorithm.
  • 14.
     The CPUis allocated to the process with the highest priority (smallest integer = highest priority). Waiting time:p2=0,p1=0+3=3,p0=0+3+3=6 A. Turnaround time=burst time +waiting time B. Total waiting time=total waiting time + waiting time C. Total Turnaround time= Total Turnaround time+Turnaroundtime D. Average waiting time=total waiting time/total n E. Average turnaround time= Total Turnaround time/total n where n is total number of process.
  • 15.
     4.ROUND ROBINCPU SCHEDULING ALGORITHM  For round robin scheduling algorithm, read the number of processes/jobs in the system, their CPU burst times, and the size of the time slice.  Time slices are assigned to each process in equal portions and in circular order, handling all processes execution.  This allows every process to get an equal chance.  Calculate the waiting time and turnaround time of each of the processes accordingly.
  • 16.
     Round RobinScheduling algorithm Goal: to write a program for to implementing the round robin scheduling algorithm ALGORITHM: 1) Firstly, read the number of processes/jobs in the system, their CPU burst times, and the size of the time slice. 2) Time slices are assigned to each process in equal portions and in circular order, handling all processes execution. 3) This allows every process to get an equal chance. 4) Calculate the waiting time and turnaround time of each of the processes accordingly.
  • 17.
     The onlydifference with the above algorithms that we are taking example is in this one we are going to use size of the time slice. This time slices is used to assigned to each process in equal portions and in circular order, handling all processes execution. This allows every process to get an equal chance. Let we use from the above example1.the time slice for instance tq=2.
  • 18.
     5. Multi-LevelQueue Scheduling Algorithm  Multi-level queue scheduling algorithm is used in scenarios where the processes can be classified into groups based on property like process type, CPU time, IO access, memory size, etc.  In a multilevel queue scheduling algorithm, there will be 'n' number of queues, where 'n' is the number of groups the processes are classified into. Each queue will be assigned a priority and will have its own scheduling algorithm like FCFS.  For the process in a queue to execute, all the queues of priority higher than it should be empty, meaning the process in those high priority queues should have completed its execution.  In this scheduling algorithm, once assigned to a queue, the process will not move to any other queues.
  • 19.
     Multi-Level QueueScheduling Algorithm Goal: : to write a program for to implement multi-level queue scheduling algorithm ALGORITHM: 1) Firstly, there will be 'n' number of queues, where 'n' is the number of groups the processes are classified into. 2) Each queue will be assigned a priority and will have its own scheduling algorithm like FCFS scheduling algorithm. 3) For the process in a queue to execute, all the queues of priority higher than it should be empty, meaning the process in those high priority queues should have completed its execution. 4) Lastly In this scheduling algorithm, once assigned to a queue, the process will not move to any other queues.
  • 20.
     In thisalgorithm we use 0 for system process 1 for user process. Let use from example 1.
  • 21.
    THANK YOU !!! IF YOUHAVE ANY QUESTION WELLCOME.