2. SCHEDULING CRITERIA
There are many scheduling algorithms and various
criteria to judge their performance some criteria are
as follows:
o CPU Utilization: CPU should be busy (from 0 to
100%)
o Throughput: the number of process executed in a
specified time period
o Turnaround time: needed to execute a process
o Waiting Time: amount of time a process has
waited
o Response Time: between request and response
3. A CPU SCHEDULING ALGORITHM
MUST MAXIMIZE THE FOLLOWING
CPU utilization should maximum
Throughput should maximum
4. A CPU SCHEDULING ALGORITHM MUST
MINIMIZE THE FOLLOWING:
Waiting Time should minimum
Response Time should minimum
Turnaround Time should minimum
5. SCHEDULING ALGORITHMS:
Below is the list of some well known
algorithms
First Come First Served (FCFS)
scheduling- non preemptive
Shortest job First(SJF) scheduling
preemptive non preemptive
Priority Scheduling preemptive non
preemptive
Round robin scheduling preemptive
6. TIMELINES:
Scheduling is based on the information
that is available at the give time. we
need some ways to represent the state
of the system and any process in it
and how it change over time.
Gantt chart are used for this purpose
to present them in graphical way.
7. GANTT CHART
1st Process 2nd Process More Processes
1st process end time 2nd Process end time…… End time.
Start time p1 end time p2end time……End time.
First come First Served (FCFS)
•Simplest
•Similar to queue
8.
9. Process Name Start Time Burst Time
Process 1 0 24
Process 2 0 3
Process3 0 3
Example 1
Process1 Process2 Process3
0 24 27 30
10. FCFS
The following table shows the waiting time for each
process:
Average Waiting time is(0+24+27)/3=17
Process
name
Arrival
time
Burst time Finish time Waiting
time
Process1 0 24 24 0
Process2 0 3 27 24
Process3 0 3 30 27
11. Gantt chart
P1 P2 P3
0 3 6
30
Process Name Start Time Burst Time
Process 2 0 3
Process 3 0 3
Process1 0 24
Example 2
12. Process
name
Arrival time Burst time Finish time Waiting
time
Process2 0 3 3 0
Process3 0 3 6 3
Process1 0 24 30 6
Average Waiting time is (0+3+6)/3= 3
13. Shortest Job First:
Another way to scheduling jobs is
to pick the job that will take least
amount of time to complete, based
on burst size. In this way the
average waiting time reduced.
•Normal SJF
•Non preemptive
• Preemptive
14.
15.
16. Non preemptive SJF Example:
Process name Arrival time Burst time
Process1 0 7
Process2 2 4
Process3 4 2
Process4 5 4
17. Process name Arrival time Burst time Finish time Waiting time
Process1 0 7 7 0
Process2 2 4 13 7
Process3 4 2 9 3
Process4 5 4 17 8
18. Process name Arrival time Burst time
Process1 0 7
Process2 2 4
Process3 4 1
Process4 5 4
Preemptive SJF Example 2
19. Process name Arrival time Burst time Finish time Waiting time
Process1 0 7 16 9
Process2 2 4 7 1
Process3 4 1 5 0
Process4 5 4 11 2
20. Requires that each process should
have priority associated with it.
Priority scheduling:
Priority scheduling Example for Non Preemptive
Process name Burst Time Priority
Process1 10 3
Process2 1 1
Process3 2 3
Process4 1 4
Process5 5 2
21. Process2 Process5 Process1 Process3 Process4
Priority scheduling Example Preemptive
Process name Arrival time Burst time Priority
Process1 0 10 3
Process2 2 1 1
Process3 4 2 2
Process4 6 1 4
Process5 8 5 5
Gantt Chart
0 1 6 16 18 ` 19
22. P1 P2 P1 P3 P1 P2 P5
Round robin scheduling
Gantt Chart
0 2 3 4 6 13 14
19
Another way to schedule jobs is to assign a small amount of
time to each process in which it executes. This time the unite
is called time quantum or tie slice, the job is allocated to CPU
for the quantum. when the time quantum expires, the process
preempted from CPU and replaced by next process in the
circle queue.