Exercice 1
Question 1
:)
Question 2
Il y a blocage.
Exercice 2
Pour R_{1}
Pour R_{2}
Exercice 3
Question 1
Blocage avec les deux processus P_{1} et P_{3}
Processus P_{1} | Processus P_{3} |
---|---|
P(a) | P(b) |
P(b) | P(a) |
Séquence problématique
2 : tout, 1 : P(a), 2 : P(c), 3 : V(c), 3 : P(b) \ra blocage
Blocage avec les trois processus
Séquence problématique
1 : P(a), 2 : P(c), 3 : V(c), 2 : P(c), 3 : P(b)
Question 2
Il faut prendre les sémaphores dans le même ordre que les autres.
Processus P_{1} | Processus P_{2} | Processus P_{3} |
---|---|---|
P(a) | P(c) | P(c) |
P(b) | P(b) | V(c) |
V(b) | V(b) | P(a) |
P(c) | P(a) | P(b) |
V(c) | V(a) | V(b) |
V(b) | V(c) | V(a) |
Exercice 4
Question 1
Problème d’exclusion mutuelle : résolu par le serveur
Question 2
k := 0 (sémaphore)
buffet[kMax]{0}
Processus Cuisiniers
begin
repeat
buffer[k] := 1
k := k + 1
signal(k)
forever
end
Processus Clients
begin
repeat
wait(k)
k := k - 1
buffer[k] := 0
forever
end