Etape 1 -- b1 = 0 b2 = 0
* CPU 1 * * CPU 2 *
==> 1 : if b2 != 1 then goto 3 ==> 1 : if b1 != 1 then goto 3
2 : goto 1 2 : goto 1
3 : b1 = 1 3 : b2 = 1
4 : Critical section 4 : Critical section
5 : b1 = 0 5 : b2 = 0
Give the number of CPU (1 or 2) 1
CPU 1 is executing
Etape 2 -- b1 = 0 b2 = 0
* CPU 1 * * CPU 2 *
1 : if b2 != 1 then goto 3 ==> 1 : if b1 != 1 then goto 3
2 : goto 1 2 : goto 1
==> 3 : b1 = 1 3 : b2 = 1
4 : Critical section 4 : Critical section
5 : b1 = 0 5 : b2 = 0
Give the number of CPU (1 or 2) 1
CPU 1 is executing
Etape 3 -- b1 = 1 b2 = 0
* CPU 1 * * CPU 2 *
1 : if b2 != 1 then goto 3 ==> 1 : if b1 != 1 then goto 3
2 : goto 1 2 : goto 1
3 : b1 = 1 3 : b2 = 1
==> 4 : Critical section 4 : Critical section
5 : b1 = 0 5 : b2 = 0
Give the number of CPU (1 or 2) 2
CPU 2 is executing
Etape 4 -- b1 = 1 b2 = 0
* CPU 1 * * CPU 2 *
1 : if b2 != 1 then goto 3 1 : if b1 != 1 then goto 3
2 : goto 1 ==> 2 : goto 1
3 : b1 = 1 3 : b2 = 1
==> 4 : Critical section 4 : Critical section
5 : b1 = 0 5 : b2 = 0
Give the number of CPU (1 or 2) 2
CPU 2 is executing
Etape 4 -- b1 = 1 b2 = 0
* CPU 1 * * CPU 2 *
1 : if b2 != 1 then goto 3 ==> 1 : if b1 != 1 then goto 3
2 : goto 1 2 : goto 1
3 : b1 = 1 3 : b2 = 1
==> 4 : Critical section 4 : Critical section
5 : b1 = 0 5 : b2 = 0
Если оба входят в критическую секцию одновременно то сообщение “Критическая секция нарушена”. Уже два дня пытаюсь никак не выходит помогите пожалуйста