Académique Documents
Professionnel Documents
Culture Documents
5.2
Basic Concepts
Maximum CPU utilization obtained with multiprogramming
CPUI/O Burst Cycle Process execution consists of a cycle of
5.3
5.4
5.5
CPU Scheduler
Selects from among the processes in memory that are ready to
5.6
Dispatcher
Dispatcher module gives control of the CPU to the process selected
switching context
5.7
Scheduling Criteria
CPU utilization keep the CPU as busy as possible
Throughput # of processes that complete their execution
process
5.8
Optimization Criteria
Max CPU utilization
Max throughput
Min turnaround time
Min waiting time
Min response time
5.9
Burst Time
P1
24
P2
P3
P1
P2
24
P3
27
30
5.10
P2
0
P3
3
P1
6
30
5.11
Two schemes:
set of processes
5.12
Arrival Time
Burst Time
P1
0.0
P2
2.0
P3
4.0
P4
5.0
SJF (non-preemptive)
P1
0
P3
7
P2
8
P4
12
16
5.13
Arrival Time
Burst Time
P1
0.0
P2
2.0
P3
4.0
P4
5.0
SJF (preemptive)
P1
0
P2
2
P3
4
P2
5
P4
P1
11
16
5.14
exponential averaging
5.15
5.16
n+1 = n
=1
n+1 = tn
Only the actual last CPU burst counts
n+1 = tn+(1 - ) tn -1 +
+(1 - )j tn -j +
+(1 - )n +1 0
Since both and (1 - ) are less than or equal to 1, each
5.17
Priority Scheduling
A priority number (integer) is associated with each process
The CPU is allocated to the process with the highest priority
Preemptive
nonpreemptive
burst time
process
5.18
Performance
q large FIFO
5.19
Burst Time
P1
53
P2
17
P3
68
P4
24
P1
0
P2
20
P3
37
P4
57
P1
77
P3
P4
P1
P3
P3
5.20
5.21
5.22
Multilevel Queue
Ready queue is partitioned into separate queues:
foreground (interactive)
background (batch)
foreground RR
background FCFS
5.23
5.24
parameters:
number of queues
5.25
Q2 FCFS
Scheduling
5.26
5.27
Multiple-Processor Scheduling
CPU scheduling more complex when multiple CPUs are
available
5.28
Real-Time Scheduling
Hard real-time systems required to complete a
5.29
Thread Scheduling
Local Scheduling How the threads library decides which
5.30
5.31
5.32
5.33
Solaris 2 Scheduling
5.34
5.35
Windows XP Priorities
5.36
Linux Scheduling
Two algorithms: time-sharing and real-time
Time-sharing
Real-time
Soft real-time
FCFS and RR
5.37
5.38
5.39
Algorithm Evaluation
Deterministic modeling takes a particular predetermined
Queueing models
Implementation
5.40
5.15
5.41
End of Chapter 5
5.08
5.43
In-5.7
5.44
In-5.8
5.45
In-5.9
5.46
Dispatch Latency
5.47
FIFO Queue is Used if There Are Multiple Threads With the Same
Priority
5.48
2.
* Note the JVM Does Not Specify Whether Threads are Time-Sliced
or Not
5.49
Time-Slicing
Since the JVM Doesnt Ensure Time-Slicing, the yield() Method
May Be Used:
while (true) {
// perform CPU-intensive task
...
Thread.yield();
}
This Yields Control to Another Thread of Equal Priority
5.50
Thread Priorities
Priority
Comment
Thread.MIN_PRIORITY
Thread.MAX_PRIORITY
Thread.NORM_PRIORITY
5.51