Question I saw on site that explains the issue of mutual-exclusion (http://www.faculty.idc.ac.il/gadi/PPTs/Chapter2-Mutex-BasicTopics.pptx - page 8). Unfortunately there is no answer. Also, the original question is only about C but I didn't understand If the order is changing how it affects the result, so I added D.
Let A and B be two algorithms designed to solve the mutual-exclusion problem. In other words, their structure consists of an entry-section, critical-section and exit-section (but you cannot assume they satisfy mutual-exclusion or deadlock-freedom unless written otherwise). Assume that algorithms A and B do not use the same variables. We construct a new mutual-excusion algorithm, C, as follows:
Algorithm C
- entry code of A
- entry code of B
- Critical Section
- exit code of B
- exit code of A
For each of the following assertions, please prove or disprove its correctness.
- If both A and B are deadlock-free, C is deadlock-free.
- If both A and B are starvation-free, C is starvation-free.
- If A or B satisfy mutual-exclusion, C satisfies mutual-exclusion.
- If A is deadlock-free and B is starvation-free, C is starvation-free.
- If A is starvation-free and B is deadlock-free, C is starvation-free.
Also that same questions, but this time on D instead of C, where D is:
Algorithm D
- entry code of A
- entry code of B
- Critical Section
- exit code of A
- exit code of B
Thanks!