Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a question about concurrency processing in operating systems concepts,
Suppose we have two process A,B that running concurrently in a computer.
We have the following algorithm. (This is for A , for B replace a to b)
C#
retry:
flag[a] = false;
if (flag[b] != false ) goto retry;
flag[a] = true;
if (flag[b] != false ) goto retry;
// critical section
flag[a] = false;

As we know each ideal algorithm for critical section accessing must have three constraints : 1.mutual exclusion , 2.progress , 3.bounded waiting
My question is: For this algorithm which constrains are met ?
I believe that the Progress condition did not met by this algorithm. Because at a worse case both of these processes return to 'retry' label at second 'if' and no one can enter the critical section.

Best regards...
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900