Như Quỳnh Lan
New member
The program follows to use a shared binary semaphore T.
T is set to 0 before either process begins execution and, as before, X is set to 5.
Now, how many different values of X are possible after both processes finish executing?
A. one
B. two
C. three
D. four
Code:
Process A
int Y;
A1: Y = X*2;
A2: X = Y;
signal(T);
Process B
int Z;
B1: wait(T);
B2: Z = X+1;
X = Z;
Now, how many different values of X are possible after both processes finish executing?
A. one
B. two
C. three
D. four