Les tâches suivantes doivent être exécutées P3 P2 P1 CPU processustemps d'arrivée temps...

Post on 04-Apr-2015

105 views 3 download

Transcript of Les tâches suivantes doivent être exécutées P3 P2 P1 CPU processustemps d'arrivée temps...

Les tâches suivantes doivent être exécutées

P3 P2 P1 CPU

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 3

P2 3 1 1

P3 2 2 3

P4 1 1 4 *

P5 0 8 2

4 est la plus forte priorité

FCFS – PREMIER ARRIVÉ, PREMIER SERVI

P3 P2 P1 CPU

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 3

P2 3 1 1

P3 2 2 3

P4 1 1 4 *

P5 0 8 2

4 est la plus forte priorité

P1

processus temps d'arrivéetemps

d'exécutionP1 5 5P2 3 1P3 2 2P4 1 1P5 0 8

CPUP5 temps = 0

0 17105 15

P5

8 16

P4 P5

processus temps d'arrivéetemps

d'exécutionP1 5 5P2 3 1P3 2 2P4 1 1P5 0 8 (-1)

CPUtemps = 1

P5

0 17105 15

P5

1 8 16

P3 P4 P5

processus temps d'arrivéetemps

d'exécutionP1 5 5P2 3 1P3 2 2P4 1 1P5 0 8 (-2)

CPUtemps = 2

P5

0 2 17105 15

P5

8

P2 P3 P4 P5

processus temps d'arrivéetemps

d'exécutionP1 5 5P2 3 1P3 2 2P4 1 1P5 0 8 (-3)

CPUtemps = 3

P5

0 17105 15

P5

3 8 16

P1 P2 P3 P4 P5

processus temps d'arrivéetemps

d'exécutionP1 5 5P2 3 1P3 2 2P4 1 1P5 0 8 (-5)

CPUtemps = 5

P5

0 17105 15

P5

8

P1 P2 P3 P4

processus temps d'arrivéetemps

d'exécutionP1 5 5P2 3 1P3 2 2P4 1 1P5 0 8 (-8)

CPUtemps = 8

P4

0 17105 15

P5 P4

98

P1 P2 P3

processus temps d'arrivéetemps

d'exécutionP1 5 5P2 3 1P3 2 2P4 1 1 P5 0 8

CPUtemps = 9

P3

0 17105 15

P5 P4

98 11

P3

P1 P2

processus temps d'arrivéetemps

d'exécutionP1 5 5P2 3 1P3 2 2P4 1 1 P5 0 8

CPUtemps = 11

P2

P3

0 17105 15

P5 P2P4

98 1211

P1

processus temps d'arrivéetemps

d'exécutionP1 5 5P2 3 1P3 2 2P4 1 1 P5 0 8

CPUtemps = 12

P1

P1P3

0 17105 15

P5 P2P4

98 1211

processus temps d'arrivéetemps

d'exécutionP1 5 5P2 3 1P3 2 2P4 1 1P5 0 8

P1P3

0 17105 15

P5 P2P4

98 1211P5 P5

P4P5P4P3

P5P4P3P2P1

P3P2P1

P2P1

P1

21 3

P5P4P3P2

P4P3P2P1

P1 P2 P3 P4 P5 Total Moyenne

temps fin 17 12 11 9 8- temps début - 5 - 3 - 2 - 1 0

temps de traitement

12 9 9 8 8 46 9.2

- temps CPU - 5 - 1 - 2 -1 - 8 - 17 - 3.4 temps

d'attente7 8 7 7 0 29 5.8

P1P3

0 17105 15

P5 P2P4

98 1211

SPN - PROCESSUS LE PLUS COURT EN PREMIER

P4 P3 P2 P1 CPU

plus court

3.7

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 3

P2 3 1 1

P3 2 2 3

P4 1 1 4 *

P5 0 8 2

P5 CPUtemps = 0 P5

plus court

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 3P2 3 1 1P3 2 2 3P4 1 1 4 *P5 0 8 2

0 1 17105 15

P5

8

P4 P5 CPUtemps = 1 P5

plus court

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 3P2 3 1 1P3 2 2 3P4 1 1 4 *P5 0 8 2

0 1 17105 15

P5

8

pas de préemption

P3 P4 P5 CPUtemps = 2plus court

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 3P2 3 1 1P3 2 2 3P4 1 1 4 *P5 0 8 2

pas de préemption

0 2 17105 15

P5

8

P5

P2 P3 P4 P5 CPUtemps = 3plus court

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 3P2 3 1 1P3 2 2 3P4 1 1 4 *P5 0 8 2

pas de préemptionP5

0 3 17105 15

P5

8

P1 P2 P3 P4 P5 CPUtemps = 5

plus court

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 3P2 3 1 1P3 2 2 3P4 1 1 4 *P5 0 8 2

pas de préemptionP5

0 17105 15

P5

8

P1 P2 P3 P5 CPUtemps = 8

plus court

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 3P2 3 1 1P3 2 2 3P4 1 1 4 *P5 0 8 2

P4

choix entre P4 et P2prend le premier arrivé

0 9 17105 15

P5

8

P4

P1 P2 P3 CPUtemps = 9

plus court

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 3P2 3 1 1P3 2 2 3P4 1 1 4 *P5 0 8 2

P2

0 9 17105 15

P5

8

P4 P2

P1 P3 CPUtemps = 10

plus court

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 3P2 3 1 1P3 2 2 3P4 1 1 4 *P5 0 8 2

P3

P3

0 9 1712105 15

P5

8

P4 P2

P1 CPUtemps = 12

plus court

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 3P2 3 1 1P3 2 2 3P4 1 1 4 *P5 0 8 2

P1

P3

0 9 1712105 15

P5

8

P4 P2 P1

P3

0 9 1712105 15

P5

8

P4 P2 P1

P1 P2 P3 P4 P5 Total Moyenne

temps fin 17 10 12 9 8- temps début - 5 - 3 - 2 - 1 0

temps de traitement

12 7 10 8 8 45 9

- temps CPU - 5 - 1 - 2 -1 - 8 - 17 - 3.4 temps

d'attente7 6 8 7 0 28 5.6

SRT - TEMPS RESTANT LE PLUS COURT

P4 P3 P2 P1 CPU

plus court

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 3

P2 3 1 1

P3 2 2 3

P4 1 1 4 *

P5 0 8 2

P5 CPUtemps = 0 P5

plus court

processus temps d'arrivéetemps

d'exécutiontemps restant

P1 5 5P2 3 1P3 2 2P4 1 1P5 0 8 8

0 17105 15

P5

P4 P5 CPUtemps = 1 P4

plus court

processus temps d'arrivéetemps

d'exécutiontemps restant

P1 5 5P2 3 1P3 2 2P4 1 1 1P5 0 8 -1 = 7

0 2 17105 15

P4P5

1

P4 P5 CPUtemps = 2 P3

plus court

processus temps d'arrivéetemps

d'exécutiontemps restant

P1 5 5P2 3 1P3 2 2 2P4 1 1 -1 = 0P5 0 8 -1 = 7

P3

0 2 17105 15

P4P5

1 3

P2 P4 P5 CPUtemps = 3 P3

plus court

processus temps d'arrivéetemps

d'exécutiontemps restant

P1 5 5P2 3 1 1P3 2 2 -1 = 1P4 1 1 -1 = 0P5 0 8 -1 = 7

choix entre P3 et P2prend le premier arrivé

P3

0 2 17105 15

P4P5

1 4

P4 P5 CPUtemps = 4 P2

plus court

processus temps d'arrivéetemps

d'exécutiontemps restant

P1 5 5P2 3 1 1P3 2 2 -2 = 0P4 1 1 -1 = 0P5 0 8 -1 = 7

P3

0 2 17105 15

P2P4P5

1 4

P4 P5 CPUtemps = 5 P1

plus court

processus temps d'arrivéetemps

d'exécutiontemps restant

P1 5 5 5P2 3 1 -1 = 0P3 2 2 -2 = 0P4 1 1 -1 = 0P5 0 8 -1 = 7

P1P3

0 2 17105 15

P2P4P5

1 4

P5 CPUtemps = 10 P5

plus court

processus temps d'arrivéetemps

d'exécutiontemps restant

P1 5 5 -5 = 0P2 3 1 -1 = 0P3 2 2 -2 = 0P4 1 1 -1 = 0P5 0 8 -1 = 7

P1P3

0 2 17105 15

P5P2P4P5

1 4

P1 P2 P3 P4 P5 Total Moyenne

temps fin 10 5 4 2 17- temps début - 5 - 3 - 2 - 1 0

temps de traitement

5 2 2 1 17 27 5.4

- temps CPU - 5 - 1 - 2 -1 - 8 - 17 - 3.4 temps

d'attente0 1 0 0 9 10 2

P1P3

0 2 17105 15

P5P2P4P5

1 4

ROUND ROBIN OU TOURNIQUET quantum = 1 ut

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 3

P2 3 1 1

P3 2 2 3

P4 1 1 4 *

P5 0 8 24 est la plus forte prioritéP3 P2 P1 CPU

retourne à la fin de la file après un quantum

P5

retourne à la fin de la file après un quantum

P4

au temps 1, P4 arrive et P5 est placé à la fin de la file

P5 P4

P4 P5

ou

pour enlever l'ambiguïté, on fait arriver P4 légèrement avant, soit au temps 1 - ( est une quantité négligeable)

au temps 1 -

P5P4

P4 P5

au temps 1

P4 P5

P5 P4

ROUND ROBIN OU TOURNIQUET quantum = 1 ut

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 - 5 3

P2 3 - 1 1

P3 2 - 2 3

P4 1 - 1 4 *

P5 0 8 24 est la plus forte prioritéP3 P2 P1 CPU

retourne à la fin de la file après un quantum

temps = 0 P5

temps = 1 - P5P4

P5

P4 P5

temps = 1 P4 P5 P5 P4

0 2 17105 151

P5 P4

P4

P5 P5=8

P4=1; P5=7

temps = 3 - P2

temps = 3 P2 P3 P5

temps = 2 - P5 P4P3 P3 P5 P4

temps = 2 P3 P5 P4 P3 P5

P3 P5

P5

P2 P3 P5

X

P5 P2 P3P3

0 2 17105 151 4

P5 P4 P3P5

3

P3=2; P4=0; P5=7

P2=1; P3=2; P5=6

temps = 5 - P1

temps = 5

temps = 4 P3 P5 P2 P2

P1 P3 P5P5

P5 P2 P3

P3 P5 P2 P1 P3 P5 P2

P1 P3 P5 P2 X

0 2 17105 151 4

P5 P4 P3P5

3

P5P2

6

P2=1; P3=1; P5=6

P1=5; P2=0; P3=1; P5=6

temps = 6 P5 P1 P2 P3 P1 P3 P5

temps = 7 P5 P2 P1 P5 P1 P3X

temps = 8 P1 P2 P5 P5 P1

0 2 17105 151 4

P5 P4 P3P5

3

P5P2

6

P3 P5P1

7 8 9

P1=5; P3=1; P5=5

P1=5; P3=0; P5=5

P1=4; P5=5

temps = 10 P1 P2 P5 P5 P1

temps = 9 P5 P2 P1 P1 P5

temps = 12 P1 P2 P5 P5 P1

temps = 11 P5 P2 P1 P1 P5

0 2 17105 151 4

P5 P4 P3P5

3

P5P2

6

P3 P5P1

7 8 9

P5P1 P5P1

11 12 13

P1=4; P5=4

P1=3; P5=4

P1=3; P5=3

P1=2; P5=3

temps = 14 P1 P2 P5 P5 P1

temps = 13 P5 P2 P1 P1 P5

temps = 16 P2 P5 P5 P1

temps = 15 P5 P2 P1 P1 P5

X

0 2 17105 151 4

P5 P4 P3P5

3

P5P2

6

P3 P5P1

7 8 9

P5P1 P5P1

11 12 13

P5P1 P5P1

14 16

P1=2; P5=2

P1=1; P5=2

P1=1; P5=1

P1=0; P5=1

P1 P2 P3 P4 P5 Total Moyenne

temps fin 16 5 7 2 17- temps début - 5 - 3 - 2 - 1 0

temps de traitement

11 2 5 1 17 36 7.2

- temps CPU - 5 - 1 - 2 -1 - 8 - 17 - 3.4 temps

d'attente6 1 3 0 9 19 3.8

0 2 17105 151 4

P5 P4 P3P5

3

P5P2

6

P3 P5P1

7 8 9

P5P1 P5P1

11 12 13

P5P1 P5P1

14 16

quantum = 1 ut

0 2 17105 151 4

P5 P4 P3P5

3

P5P2

6

P3 P5P1

7 8 9

P5P1 P5P1

11 12 13

P5P1 P5P1

14 16

P5 P4P5

P5P3

P3P2P5

P2P5P3

P5P3P1

P3P1P5

P1P5

P5P1

P1P5

P5P1

P1P5

P5P1

P1P5

P5P1

P1P5

P5

P5P4

P4P5P3

P5P3P2

P2P5P3P1

1- 2- 3- 5-

ROUND ROBIN quantum = 1 ut

ROUND ROBIN quantum = 2 ut

0 2 17105 151 4

P5 P4 P3

3

P5 P2

6 7 8 9

P5P1 P1

11 12 13

P5 P1

14 16

P5 P4P3P5

P3P5P2

P5P2P1

P2P1P5

P1P5

P5P1

P1P5

P5P1

P1

P5P4

P5P4P3

P4P3P5P2

P3P5P2P1

1- 2- 3- 5-

P1 P2 P3 P4 P5 Total Moyenne

temps fin 17 8 5 3 16- temps début - 5 - 3 - 2 - 1 0

temps de traitement

12 5 3 2 16 38 7.6

- temps CPU - 5 - 1 - 2 -1 - 8 - 17 - 3.4 temps

d'attente7 4 1 1 8 21 4.2

0 2 17105 151 4

P5 P4 P3

3

P5 P2

6 7 8 9

P5P1 P1

11 12 13

P5 P1

14 16

quantum = 2 ut

AVEC PRIORITÉ sans préemption

P3 P2 P1

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 3

P2 3 1 1

P3 2 2 3

P4 1 1 4 *

P5 0 8 2

4 est la plus forte priorité

CPU

plus prioritaire

P1

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 3P2 3 1 1P3 2 2 3P4 1 1 4 *P5 0 8 2

4 est la plus forte priorité

CPU

plus prioritaire

P5 temps = 0

0 17105 15

P5

8 16

P4 P5

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 3P2 3 1 1P3 2 2 3P4 1 1 4 *P5 0 8 (-1) 2

4 est la plus forte priorité

CPU

plus prioritairetemps = 1

P5

0 17105 15

P5

1 8 16

pas de préemption, P5 continue

P3 P4 P5

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 3P2 3 1 1P3 2 2 3P4 1 1 4 *P5 0 8 (-2) 2

4 est la plus forte priorité

CPU

plus prioritairetemps = 2

P5

pas de préemption, P5 continue

0 2 17105 15

P5

8

P2 P3 P4 P5

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 3P2 3 1 1P3 2 2 3P4 1 1 4 *P5 0 8 (-3) 2

4 est la plus forte priorité

CPU

plus prioritairetemps = 3

P5

pas de préemption, P5 continue

0 17105 15

P5

3 8 16

P1 P2 P3 P4 P5

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 3P2 3 1 1P3 2 2 3P4 1 1 4 *P5 0 8 (-5) 2

4 est la plus forte priorité

CPU

plus prioritairetemps = 5

pas de préemption, P5 continue

P5

0 17105 15

P5

8

P1 P2 P3 P4

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 3P2 3 1 1P3 2 2 3P4 1 1 4 *P5 0 8 (-8) 2

4 est la plus forte priorité

CPU

plus prioritairetemps = 8

P4

0 17105 15

P5 P4

98

P1 P2 P3

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 3P2 3 1 1P3 2 2 3P4 1 1 (-1) 4 *P5 0 8 (-8) 2

4 est la plus forte priorité

CPU

plus prioritairetemps = 9

P3

2 choixprend le 1er arrivé

P3

0 17105 15

P5 P4

98 11

P1 P2

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 3P2 3 1 1P3 2 2 (-2) 3P4 1 1 (-1) 4 *P5 0 8 (-8) 2

4 est la plus forte priorité

CPU

plus prioritairetemps = 11

P1

P1P3

0 17105 15

P5 P4

98 1611

P2

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 (-5) 3P2 3 1 1P3 2 2 (-2) 3P4 1 1 (-1) 4 *P5 0 8 (-8) 2

4 est la plus forte priorité

CPU

plus prioritairetemps = 16

P2

P1P3

0 17105 15

P5 P2P4

98 1611

P1 P2 P3 P4 P5 Total Moyenne

temps fin 16 17 11 9 8- temps début - 5 - 3 - 2 - 1 0

temps de traitement

11 14 9 8 8 50 10.0

- temps CPU - 5 - 1 - 2 -1 - 8 - 17 - 3.4 temps

d'attente6 13 7 7 0 33 6.6

P1P3

0 17105 15

P5 P2P4

98 1611

AVEC PRIORITÉ avec préemption

P3 P2 P1

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 3

P2 3 1 1

P3 2 2 3

P4 1 1 4 *

P5 0 8 2

4 est la plus forte priorité

CPU

plus prioritaire

P1

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 3P2 3 1 1P3 2 2 3P4 1 1 4 *P5 0 8 2

4 est la plus forte priorité

CPU

plus prioritaire

P5 temps = 0

0 17105 15

P5

1

P4 P5

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 3P2 3 1 1P3 2 2 3P4 1 1 4 *P5 0 8 (-1) 2

4 est la plus forte priorité

CPU

plus prioritairetemps = 1

P4

0 2 17105 15

P4P5

1

P4 P5

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 3P2 3 1 1P3 2 2 3P4 1 1 (-1) 4 *P5 0 8 (-1) 2

4 est la plus forte priorité

CPU

plus prioritairetemps = 2

P3

0 2 17105 15

P4P5

1 3

P3

P2 P4 P5

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 3P2 3 1 1P3 2 2 (-1) 3P4 1 1 (-1) 4 *P5 0 8 (-1) 2

4 est la plus forte priorité

CPU

plus prioritairetemps = 3

P3

P3

0 2 17105 15

P4P5

1 4

P2 P5

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 3P2 3 1 1P3 2 2 (-2) 3P4 1 1 (-1) 4 *P5 0 8 (-1) 2

4 est la plus forte priorité

CPU

plus prioritairetemps = 4

P5

P3

0 2 17105 15

P4P5

1 4

P5

P1 P2 P5

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 3P2 3 1 1P3 2 2 (-2) 3P4 1 1 (-1) 4 *P5 0 8 (-2) 2

4 est la plus forte priorité

CPU

plus prioritairetemps = 5

P1

P1P3

0 2 17105 15

P4P5

1 4

P5

P2 P5

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 (-5) 3P2 3 1 1P3 2 2 (-2) 3P4 1 1 (-1) 4 *P5 0 8 (-2) 2

4 est la plus forte priorité

CPU

plus prioritairetemps = 10

P5

P1P3

0 2 17105 15

P5P4P5

1 4

P5

16

P2

processus temps d'arrivéetemps

d'exécutionpriorité

P1 5 5 (-5) 3P2 3 1 1P3 2 2 (-2) 3P4 1 1 (-1) 4 *P5 0 8 (-8) 2

4 est la plus forte priorité

CPU

plus prioritairetemps = 16

P2

P1P3

0 2 17105 15

P5 P2P4P5

1 4

P5

16

P1 P2 P3 P4 P5 Total Moyenne

temps fin 10 17 4 2 16- temps début - 5 - 3 - 2 - 1 0

temps de traitement

5 14 2 1 16 38 7.6

- temps CPU - 5 - 1 - 2 -1 - 8 - 17 - 3.4 temps

d'attente0 13 0 0 8 21 4.2

P1P3

0 2 17105 15

P5 P2P4P5

1 4

P5

16