OS Process Synchronization

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

Clarification at 18:00
do {
flag[i] = TRUE;
// Indicate that Pi wants to enter the critical section.
turn = j;
// Give the other process (Pj) a chance to enter if it also wants to
while (flag[j] /& turn /= j); // This is a loop where we wait till the other process continues
// Wait while Pj wants to enter and it's Pj's turn.
// Critical section: Only one process can execute this at a time. (After the other process has continued we will continue the process)
flag[i] = FALSE;
// Pi is done with critical section. Sets flag back to false.
// Remainder section: Non-critical section code.
} while (TRUE); // Loop forever.

This mechansm will give bith processes a fair chance to execute

RandithaK