















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
An excerpt from the 'operating system concepts' textbook by silberschatz, galvin, and gagne. It covers the basics of cpu scheduling, including concepts such as maximum cpu utilization, cpu-i/o burst cycle, cpu scheduler, and dispatcher. The document also discusses various scheduling algorithms, including first-come-first-served (fcfs), shortest-job-first (sjf), and priority scheduling. The authors also touch upon the importance of scheduling criteria, such as cpu utilization, throughput, turnaround time, waiting time, and response time.
What you will learn
Typology: Exams
1 / 55
This page cannot be seen from the preview
Don't miss anything!
Silberschatz, Galvin and Gagne © 2009 Operating System Concepts – 8
th
Edition,
5. 2
Silberschatz, Galvin and Gagne © 2009 th
Basic Concepts
Scheduling Criteria
Scheduling Algorithms
Thread Scheduling
MultipleProcessor Scheduling
Operating Systems Examples
Algorithm Evaluation
5. 4
Silberschatz, Galvin and Gagne © 2009 th
Maximum CPU utilization obtained with multiprogramming
CPU–I/O Burst Cycle – Process execution consists of a cycle of
CPU execution and I/O wait
CPU burst distribution
5. 5
Silberschatz, Galvin and Gagne © 2009 th
5. 7
Silberschatz, Galvin and Gagne © 2009 th
Selects from among the processes in memory that are ready to execute,
and allocates the CPU to one of them
CPU scheduling decisions may take place when a process:
Scheduling under 1 and 4 is nonpreemptive
All other scheduling is preemptive
5. 8
Silberschatz, Galvin and Gagne © 2009 th
Dispatcher module gives control of the CPU to the process
selected by the shortterm scheduler; this involves:
switching context
switching to user mode
jumping to the proper location in the user program to restart
that program
Dispatch latency – time it takes for the dispatcher to stop one
process and start another running
5. 10
Silberschatz, Galvin and Gagne © 2009 th
Max CPU utilization
Max throughput
Min turnaround time
Min waiting time
Min response time
5. 11
Silberschatz, Galvin and Gagne © 2009 th
Process Burst Time
1
2
3
Suppose that the processes arrive in the order: P
1
2
3
The Gantt Chart for the schedule is:
Waiting time for P
1
2
3
Average waiting time: (0 + 24 + 27)/3 = 17
1
2
3
5. 13
Silberschatz, Galvin and Gagne © 2009 th
Associate with each process the length of its next CPU burst. Use these
lengths to schedule the process with the shortest time
SJF is optimal – gives minimum average waiting time for a given set of
processes
The difficulty is knowing the length of the next CPU request
5. 14
Silberschatz, Galvin and Gagne © 2009 th
Process Arrival Time Burst Time
1
2
3
4
SJF scheduling chart
Average waiting time = (3 + 16 + 9 + 0) / 4 = 7
4
3 P
1
2
5. 16
Silberschatz, Galvin and Gagne © 2009 th
5. 17
Silberschatz, Galvin and Gagne © 2009 th
=
n+
n
Recent history does not count
=
n+
= t
n
Only the actual last CPU burst counts
If we expand the formula, we get:
n+
= t
n
+(1 ) t
n
j
t
n j
n +
0
Since both and (1 ) are less than or equal to 1, each successive term
has less weight than its predecessor
5. 19
Silberschatz, Galvin and Gagne © 2009 th
Each process gets a small unit of CPU time (time quantum),
usually 10100 milliseconds. After this time has elapsed, the
process is preempted and added to the end of the ready queue.
If there are n processes in the ready queue and the time
quantum is q, then each process gets 1/n of the CPU time in
chunks of at most q time units at once. No process waits more
than (n1) q time units.
Performance
q large FIFO
q small q must be large with respect to context switch,
otherwise overhead is too high
5. 20
Silberschatz, Galvin and Gagne © 2009 th
Process Burst Time
1
2
3
The Gantt chart is:
Typically, higher average turnaround than SJF, but better response
1
2
3
1
1
1
1
1