Академический Документы
Профессиональный Документы
Культура Документы
de Processos
SLIDES 6B
Short-Term Scheduling
Known as the dispatcher
Executes most frequently
Invoked when an event occurs
Clock interrupts
I/O interrupts
Operating system calls
Signals
Scheduling
Maximize CPU utilization
Process execution consists of a cycle of CPU
execution and I/O wait:
CPU Burst.. I/O Burst Cycle
- Adapt the Scheduling Algorithm to the type of the
program.
Dispatcher
Dispatcher module gives control of the CPU to the
process selected by the short-term scheduler; this
involves:
switching context
switching to user mode
jumping to the proper location in the user program to restart that
program
Scheduling Criteria
CPU utilization keep the CPU as busy as possible.
Throughput # of processes that complete their execution
per time unit.
Turnaround time amount of time to execute a particular
process.
Waiting time amount of time a process has been waiting
in the ready queue.
Response time amount of time it takes from when a
request was submitted until the first response is produced.
Preemptive vs Non-Preemptive
Non-Preemptive Scheduling: once the CPU is
allocated to a process, the process keeps the
CPU until it terminates or it blocks in a I/O
operations and switches to the waiting state
(used by Windows 3.1).
Preemptive Scheduling: when a new process
arrives it can take the CPU out of the running
process.
Optimization Criteria
Scheduling Algorithms
P2
24
P3
27
30
P3
3
P1
6
30
First-Come-First-Served
Process
Arrival
Time
Service
Time (Ts)
Start
Time
Finish
Time
Turnaround
Time (Tr)
Ts / Tr
100
101
100
101
102
100
100
100
102
202
199
1.99
100
26
mean
Shortest-Process-Next (SPN)
Associate with each process the length of its next CPU
burst. Use these lengths to schedule the process with the
shortest time.
Two schemes:
nonpreemptive once CPU given to the process it
cannot be preempted until completes its CPU burst.
preemptive if a new process arrives with CPU burst
length less than remaining time of current executing
process, preempt. This scheme is know as the
Shortest-Remaining-Time (SRT).
SPN is optimal gives minimum average waiting time for
a given set of processes.
Difficulty: how to know the length of the next CPU request.
P2
2
P3
4
P2
5
P1
0
P3
7
Burst Time
7
4
1
4
P2
8
P4
12
16
Priority Scheduling
P1
11
Burst Time
7
4
1
4
P4
Non-Preemptive SPN
16
Priorities
Scheduler will always choose a process of
higher priority over one of lower priority.
Have multiple ready queues to represent each
level of priority.
Lower-priority may suffer from starvation
allow a process to change its priority based
on its age or execution history
IBM 7094
P2
20
37
P3
Burst Time
53
17
68
24
P4
57
P1
77
P3
97 117
P4
P1
P3
P3
Multilevel Queue
Scheduling Policies
First-Come-First-Served
(FCFS)
Escalonamento
Desenhe o histograma de execuo dos 5 processos, usando os
seguintes algoritmos:
FCFS
Round-Robin (q=1)
Round-Robin (q=4)
Shortest Process Next (SPN)
Shortest Remaining Time (SRT)
Highest Response Ratio (HRRN)
Feedback (q=1)
10
15
10
15
20
1
2
3
4
5
Round-Robin (q=1)
20
2
3
4
5
10
15
20
3
4
5
Non-preemptive policy.
Process with shortest expected processing time is
selected next.
Short process jumps ahead of longer processes.
10
15
20
10
15
20
2
3
4
2
3
4
Multilevel Feedback
0
10
15
20
1
2
3
4
5
10
Exerccios Escalonamento
Escalonamento
Process
P1
P2
P3
P4
P5
10
29
3
7
12
Qual o turnaround time e o waiting time em cada um dos casos para os 5 processos? Apresente tambm
os valores mdios.
11
Prioridade
Tempo de Chegada
Tempo de Processamento
P1
0.0
P2
1.1
P3
2.2
P4
3.3
P5
4.4
12