Does the given solution satisfy the mutual exclusion requirement? Explain (a simple 'yes-no' answer is NOT enough. What is the mutual exclusion requirement? Why is (not?) sattisfied?)
Modern
In concurrent programming, a "critical section" is a part of a multi-process program that
may not be concurrently executed by more than one of the program's thread. Let us consider a 2 processes solution:
do {
flag[i] = TRUE;
while(flag[j]); %wait
CRITICAL SECTION
flag[i] = FALSE;
REMAINDER SECTION
} while (TRUE);
Pseudo-code of $P_i$ (the one of $P_j$ is symmetric)
a) Does the given solution satisfy the mutual exclusion requirement? Explain (a
simple 'yes-no' answer is NOT enough. What is the mutual exclusion requirement? Why is
(not?) sattisfied?)
b) Does the given solution sattisfy the progress requirement? Explain
c) Does the given solution have the risk of deadlock? Make a simulation to support
your answer (no point without a valid simluation)
d) If your answer to the previous question is positive (i.e. Yes, there is the risk of
deadlock), how can you modify the given solution to make it working?
Trending now
This is a popular solution!
Step by step
Solved in 2 steps