You are on page 1of 37

PLUS COURT TEMPS D’UTILISATION

D’ABORD PRÉEMPTIF

Nadia Bel Hadj Aissa 89


2.3.3 Shortest-Remaining-Time-First (SRTF)

preemption

START READY RUNNING HALTED

I/O I/O
completed requested
WAITING

Start : Le procesus vient d’être créé.


Ready : Le processus attend d’obtenir le processeur.
Running : Le processus a été alloué par le processeur.
Waiting : Le processeur est entré en E/S ou bloqué.
Halted : Le processus a fini et va quitter le système
2.3.3 Shortest-Remaining-Time-First (SRTF)

Process Arrival 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec
time
A 0 4:4 4 4:4 4 4:4
B 2 8:8 1 8:8 - -
C 3 2:2 1 2:2 - -
D 7 1:1 1 1:1 1 1:1

SRTF RQ A:4:4 Proc in CPU:


: next_cpu_burst : remaining_time

FCFS
2.3.3 Shortest-Remaining-Time-First (SRTF)

Process Arrival 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec
time
A 0 4:2 4 4:4 4 4:4
B 2 8:8 1 8:8 - -
C 3 2:2 1 2:2 - -
D 7 1:1 1 1:1 1 1:1

RQ B:8:8 Proc in CPU: A:4:2


: next_cpu_burst : remaining_time continue
2.3.3 Shortest-Remaining-Time-First (SRTF)

Process Arrival 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec
time
A 0 4:1 4 4:4 4 4:4
B 2 8:8 1 8:8 - -
C 3 2:2 1 2:2 - -
D 7 1:1 1 1:1 1 1:1

RQ B:8:8 C:2:2 Proc in CPU: A:4:1


:
continue
2.3.3 Shortest-Remaining-Time-First (SRTF)

Process Arrival 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec
time
A 0 4:0 4 4:4 4 4:4
B 2 8:8 1 8:8 - -
C 3 2:2 1 2:2 - -
D 7 1:1 1 1:1 1 1:1

RQ B:8:8 C:2:2 Proc in CPU:


:
2.3.3 Shortest-Remaining-Time-First (SRTF)

Process Arrival 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec
time
A 0 4:0 4 4:4 4 4:4
B 2 8:8 1 8:8 - -
C 3 2:0 1 2:2 - -
D 7 1:1 1 1:1 1 1:1

RQ B:8:8 Proc in CPU:


:
2.3.3 Shortest-Remaining-Time-First (SRTF)

Process Arrival 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec
time
A 0 4:0 4 4:4 4 4:4
B 2 8:7 1 8:8 - -
C 3 2:0 1 2:2 - -
D 7 1:1 1 1:1 1 1:1

RQ D:1:1 B:8:7 Proc in CPU: B:8:7


:
preemption
p
2.3.3 Shortest-Remaining-Time-First (SRTF)

Process Arrival 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec
time
A 0 4:0 4 4:4 4 4:4
B 2 8:7 1 8:8 - -
C 3 2:0 1 2:2 - -
D 7 1:0 1 1:1 1 1:1

RQ B:8:7 A:4:4 Proc in CPU:


:

p
2.3.3 Shortest-Remaining-Time-First (SRTF)

Process Arrival 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec
time
A 0 4:0 4 4:3 4 4:4
B 2 8:7 1 8:8 - -
C 3 2:0 1 2:2 - -
D 7 1:0 1 1:1 1 1:1

RQ B:8:7 C:2:2 A:4:3 Proc in CPU: A:4:3


:
preemption
p p
2.3.3 Shortest-Remaining-Time-First (SRTF)

Process Arrival 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec
time
A 0 4:0 4 4:3 4 4:4
B 2 8:7 1 8:8 - -
C 3 2:0 1 2:1 - -
D 7 1:0 1 1:1 1 1:1

RQ B:8:7 A:4:3 D:1:1 Proc in CPU: C:2:1


:
continues
p p
2.3.3 Shortest-Remaining-Time-First (SRTF)

Process Arrival 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec
time
A 0 4:0 4 4:3 4 4:4
B 2 8:7 1 8:8 - -
C 3 2:0 1 2:0 - -
D 7 1:0 1 1:1 1 1:1

RQ B:8:7 A:4:3 D:1:1 Proc in CPU:


:
continues
p p
2.3.3 Shortest-Remaining-Time-First (SRTF)

Process Arrival 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec
time
A 0 4:0 4 4:3 4 4:4
B 2 8:7 1 8:8 - -
C 3 2:0 1 2:0 - -
D 7 1:0 1 1:0 1 1:1

RQ B:8:7 A:4:3 Proc in CPU:


:
continues
p p
2.3.3 Shortest-Remaining-Time-First (SRTF)

Process Arrival 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec
time
A 0 4:0 4 4:2 4 4:4
B 2 8:7 1 8:8 - -
C 3 2:0 1 2:0 - -
D 7 1:0 1 1:0 1 1:1

RQ B:8:7 D:4:1 A:4:2 Proc in CPU: A:4:2


:
preemption continues
p p p
2.3.3 Shortest-Remaining-Time-First (SRTF)

Process Arrival 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec
time
A 0 4:0 4 4:2 4 4:4
B 2 8:7 1 8:8 - -
C 3 2:0 1 2:0 - -
D 7 1:0 1 1:0 1 1:0

RQ B:8:7 A:4:2 Proc in CPU:


:
continues
p p p
2.3.3 Shortest-Remaining-Time-First (SRTF)

Process Arrival 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec
time
A 0 4:0 4 4:0 4 4:4
B 2 8:7 1 8:8 - -
C 3 2:0 1 2:0 - -
D 7 1:0 1 1:0 1 1:0

RQ B:8:7 Proc in CPU:


:
continues
p p p
2.3.3 Shortest-Remaining-Time-First (SRTF)

Process Arrival 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec
time
A 0 4:0 4 4:0 4 4:4
B 2 8:3 1 8:8 - -
C 3 2:0 1 2:0 - -
D 7 1:0 1 1:0 1 1:0

RQ A:4:4 Proc in CPU: B:8:3


:
continues
p p p
2.3.3 Shortest-Remaining-Time-First (SRTF)

Process Arrival 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec
time
A 0 4:0 4 4:0 4 4:4
B 2 8:0 1 8:8 - -
C 3 2:0 1 2:0 - -
D 7 1:0 1 1:0 1 1:0

RQ A:4:4 Proc in CPU:


:
continues
p p p
2.3.3 Shortest-Remaining-Time-First (SRTF)

Process Arrival 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec
time
A 0 4:0 4 4:0 4 4:3
B 2 8:0 1 8:8 - -
C 3 2:0 1 2:0 - -
D 7 1:0 1 1:0 1 1:0

RQ B:8:8 Proc in CPU: A:4:3


:
continues
p p p
2.3.3 Shortest-Remaining-Time-First (SRTF)

Process Arrival 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec
time
A 0 4:0 4 4:0 4 4:0
B 2 8:0 1 8:8 - -
C 3 2:0 1 2:0 - -
D 7 1:0 1 1:0 1 1:0

RQ B:8:8 Proc in CPU:


:
continues
p p p
2.3.3 Shortest-Remaining-Time-First (SRTF)

Process Arrival 1st exec 1st I/O 2nd exec 2nd I/O 3rd exec
time
A 0 4:0 4 4:0 4 4:0
B 2 8:0 1 8:0 - -
C 3 2:0 1 2:0 - -
D 7 1:0 1 1:0 1 1:0

RQ Proc in CPU:
:
continues
p p p
2.3.3 Shortest-Remaining-Time-First (SRTF)

p p p

• Processor utilization = (35 / 35) * 100 = 100 %


• Throughput = 4 / 35 = 0.11
2.3.3 Shortest-Remaining-Time-First (SRTF)

p p p

• Turn around time:


tatA = 27 – 0 = 27
tatB = 35 – 2 = 33
tatC = 11 – 3 = 8
tatD = 14 – 7 = 7

tatAVG = (27 + 33 + 8 + 7) / 4 = 18.75


2.3.3 Shortest-Remaining-Time-First (SRTF)

p p p

• Turn around time:


tatA = 27 – 0 = 27
tatB = 35 – 2 = 33
tatC = 11 – 3 = 8
tatD = 14 – 7 = 7

tatAVG = (27 + 33 + 8 + 7) / 4 = 18.75


2.3.3 Shortest-Remaining-Time-First (SRTF)

p p p

• Turn around time:


tatA = 27 – 0 = 27
tatB = 35 – 2 = 33
tatC = 11 – 3 = 8
tatD = 14 – 7 = 7

tatAVG = (27 + 33 + 8 + 7) / 4 = 18.75


2.3.3 Shortest-Remaining-Time-First (SRTF)

p p p

• Turn around time:


tatA = 27 – 0 = 27
tatB = 35 – 2 = 33
tatC = 11 – 3 = 8
tatD = 14 – 7 = 7

tatAVG = (27 + 33 + 8 + 7) / 4 = 18.75


2.3.3 Shortest-Remaining-Time-First (SRTF)

p p p

• Turn around time:


tatA = 27 – 0 = 27
tatB = 35 – 2 = 33
tatC = 11 – 3 = 8
tatD = 14 – 7 = 7

tatAVG = (27 + 33 + 8 + 7) / 4 = 18.75


2.3.3 Shortest-Remaining-Time-First (SRTF)

p p p

• Waiting time:
wtA = (0 – 0) + (8 – 8) + (12 - 9) + (14 – 13) + (23 - 20) = 7
wtB = (6 – 2) + (16 – 7) + (27-24) = 16
wtC = (4 – 3) + (9 – 9) = 1
wtD = (7 – 7) + (11 – 10) + (13 – 13) = 1

wtAVG = (7 + 16 + 1 + 1) / 4 = 6.25
2.3.3 Shortest-Remaining-Time-First (SRTF)

p p p

• Waiting time:
wtA = (0 – 0) + (8 – 8) + (12 - 9) + (14 – 13) + (23 - 20) = 7
wtB = (6 – 2) + (16 – 7) + (27-24) = 16
wtC = (4 – 3) + (9 – 9) = 1
wtD = (7 – 7) + (11 – 10) + (13 – 13) = 1

wtAVG = (7 + 16 + 1 + 1) / 4 = 6.25
2.3.3 Shortest-Remaining-Time-First (SRTF)

p p p

• Waiting time:
wtA = (0 – 0) + (8 – 8) + (12 - 9) + (14 – 13) + (23 - 20) = 7
wtB = (6 – 2) + (16 – 7) + (27-24) = 16
wtC = (4 – 3) + (9 – 9) = 1
wtD = (7 – 7) + (11 – 10) + (13 – 13) = 1

wtAVG = (7 + 16 + 1 + 1) / 4 = 6.25
2.3.3 Shortest-Remaining-Time-First (SRTF)

p p p

• Waiting time:
wtA = (0 – 0) + (8 – 8) + (12 - 9) + (14 – 13) + (23 - 20) = 7
wtB = (6 – 2) + (16 – 7) + (27-24) = 16
wtC = (4 – 3) + (9 – 9) = 1
wtD = (7 – 7) + (11 – 10) + (13 – 13) = 1

wtAVG = (7 + 16 + 1 + 1) / 4 = 6.25
2.3.3 Shortest-Remaining-Time-First (SRTF)

p p p

• Waiting time:
wtA = (0 – 0) + (8 – 8) + (12 - 9) + (14 – 13) + (23 - 20) = 7
wtB = (6 – 2) + (16 – 7) + (27-24) = 16
wtC = (4 – 3) + (9 – 9) = 1
wtD = (7 – 7) + (11 – 10) + (13 – 13) = 1

wtAVG = (7 + 16 + 1 + 1) / 4 = 6.25
2.3.3 Shortest-Remaining-Time-First (SRTF)

p p p

• Response time:
rtA = 0 – 0 = 0
rtB = 6 – 2 = 4
rtC = 4 – 3 = 1
rtD = 7 – 7 = 0

rtAVG = (0 + 4 + 1 + 0) / 4 = 1.25
2.3.3 Shortest-Remaining-Time-First (SRTF)

p p p

• Response time:
rtA = 0 – 0 = 0
rtB = 6 – 2 = 4
rtC = 4 – 3 = 1
rtD = 7 – 7 = 0

rtAVG = (0 + 4 + 1 + 0) / 4 = 1.25
2.3.3 Shortest-Remaining-Time-First (SRTF)

p p p

• Response time:
rtA = 0 – 0 = 0
rtB = 6 – 2 = 4
rtC = 4 – 3 = 1
rtD = 7 – 7 = 0

rtAVG = (0 + 4 + 1 + 0) / 4 = 1.25
2.3.3 Shortest-Remaining-Time-First (SRTF)

p p p

• Response time:
rtA = 0 – 0 = 0
rtB = 6 – 2 = 4
rtC = 4 – 3 = 1
rtD = 7 – 7 = 0

rtAVG = (0 + 4 + 1 + 0) / 4 = 1.25
2.3.3 Shortest-Remaining-Time-First (SRTF)

p p p

• Response time:
rtA = 0 – 0 = 0
rtB = 6 – 2 = 4
rtC = 4 – 3 = 1
rtD = 7 – 7 = 0

rtAVG = (0 + 4 + 1 + 0) / 4 = 1.25

You might also like