In: Computer Science
. Is the following software solution to the critical section problem correct?
{
int lock = 0;
………….
if (lock == 0) then lock = 1
else
while (lock == 1) no-op;
enter_CS;
CS
exit_CS;
……….
}
The software solution to the critical section problem is correct
int lock = 0;
………….
if (lock == 0) then lock = 1
else
while (lock == 1) no-op;
enter_CS;
CS
exit_CS;
……….
}
This is the correct solution for critical section problem