02.e
SISTEMI OPERATIVI SISTEMI OPERATIVI
Esercizi sullo stallo
1
11
Algoritmo identificazione stallo Algoritmo identificazione stallo
P3
R3
● R1
● ● ● R2
● ● ●
P2
P1
P4
1 0 0 P4 0
1 1 P4 1
1 1 P4
1 1 0 P3 0
1 0 P3 1
2 0 P3
1 1 1 P2 0
0 1 P2 1
1 2 P2
0 0 2 P1 0
1 0 P1 0
1 2 P1
1 0 1 S 0
3 2 S 1
3 3 S
R3 R2 R1 C R3
R2 R1 B R3
R2 R1 A
RICHIESTE STATO
DICHIARAZIONI
2
Sistemi Operativi DEI UNIV PD © 2005
11
Algoritmo identificazione stallo [2]
Algoritmo identificazione stallo [2]
P3
R3
● R1
● ● ● R2
● ● ●
P2
P1
P4
1 0 0 P4 0
1 1 P4 1
1 1 P4
1 1 0 P3 0
1 0 P3 1
2 0 P3
1 1 1 P2 0
0 1 P2 1
1 2 P2
0 0 2 P1 0
1 0 P1 0
1 2 P1
1 1 2 S 0
2 1 S 1
3 3 S
R3 R2 R1 C R3
R2 R1 B R3
R2 R1 A
RICHIESTE STATO
DICHIARAZIONI
3
11
Algoritmo identificazione stallo [3]
Algoritmo identificazione stallo [3]
P3
R3
● R1
● ● ● R2
● ● ●
P2
P1
P4
1 0 0 P4 0
1 1 P4 1
1 1 P4
1 1 0 P3 0
1 0 P3 1
2 0 P3
1 1 1 P2 0
0 1 P2 1
1 2 P2
0 0 2 P1 0
1 0 P1 0
1 2 P1
1 3 2 S 0
0 1 S 1
3 3 S
R3 R2 R1 C R3
R2 R1 B R3
R2 R1 A
RICHIESTE STATO
DICHIARAZIONI
4
Sistemi Operativi DEI UNIV PD © 2005
11
Deadlock Deadlock
• 1.1 Verificare se il sistema è in Stallo
R3 P3
● R1
● ● ● R2
● ●
P2
P1
5
11
Deadlock
Deadlock [2] [2]
• 1.2 Verificare se il sistema è in Stallo
P3
R1
● R3
● ● ● R2
● ● ● P1 P2
6
Sistemi Operativi DEI UNIV PD © 2005
11
Deadlock
Deadlock [3] [3]
• 1.3 Verificare se il sistema è in Stallo
P2
R2
● R1
● ●
P3
P1
7
11
Deadlock
Deadlock [4] [4]
• 1.4 Verificare se il sistema è in Stallo
P3
R2
● R1
● ●
R3
● ● P1 P2
8
Sistemi Operativi DEI UNIV PD © 2005
11
Banchiere Banchiere
• 2.1 Tramite l’algoritmo del banchiere dire se le richieste in rosso possono essere
soddisfatte
R3 P3
● R1
● ● ● R2
● ●
P2
P1
9
11
Banchiere [2]
Banchiere [2]
• 2.2 Tramite l’algoritmo del banchiere dire se le richieste in rosso possono essere
soddisfatte
P3
R1
● R3
● ● ● R2
● ● ● P1 P2
10
Sistemi Operativi DEI UNIV PD © 2005
11
Banchiere [3]
Banchiere [3]
• 2.3 Tramite l’algoritmo del banchiere dire se le richieste in rosso possono essere
soddisfatte
P2
R2
● R1
● ●
P3
P1
11
11
Banchiere [4]
Banchiere [4]
• 2.4 Tramite l’algoritmo del banchiere dire se le richieste in rosso possono essere
soddisfatte
P3
R2
● R1
● ●
R3
● ● P1 P2
02.e
Fine Fine
Esercizi sullo stallo