Consider the following concurrent program CP: sharedVariable v = 0

Consider the following concurrent program CP:
sharedVariable v = 0;
T1
mutex1.P
…
mtex1.V
T2
T3
mutex1.P
…
mutex1.V
mutex2.P
v = 1;
mutex2.V
T4
int temp;
mutex2.P
temp = v;
mutex2.V
if (temp==0) {
mutex1.P
…
mutex1.V
}
Assume that on the first execution:
thread T1 completes execution of mutex1.P first
thread T3 completes execution of mutex2.P first (so T4’s temp value is 1)
Show how to apply the reachability testing algorithm to program CP.
a. For the first executed sequence:
using the space-time diagram format for partially-ordered sequences, show the timestamps for
all the events, and the race sets for the receive/entry events. Give both the thread-centric
timestamps (e.g., Fig. 7-27(a)) and the object-centric timestamps (e.g., Fig. 7.28(a)).
show the race table (e.g., Table 7.3). The first row of the race table is variant V1, the second row
is variant V2, etc.
The order of thread/semaphores in the space-time diagram is:
T1
mutex1
T2
T3
mutex2
T4
For all other executed sequences:
show the race sets for the receive/entry events (no timestamps)
show the race table
Note: For each event in a sequence/variant, show the color of the event — use a filled circle “•” to
represent a black event and an empty circle “о” to represent a white event.
Note: As in Fig. 7.31, the first sequence executed is Q0, the sequence collected from variant V1 is Q1,
etc.
b. Show the sequences/variants exercised by reachability testing in the format shown in Fig. 7.31. Also
show the spanning tree the represents your reachability testing process.
The reachability testing tool exercises 8 sequences for this program.
Here is my first sequence Q0, showing the format that is used for displaying sequences, timestamps,
race sets, and event colors.
Here is variant V1 of Q1:
Notice the dashed line that separates the events in V1 from the events in Q1, where Q1 is the sequence
exercised when variant V1 is executed. Note also that changed event e5 was colored black. (If there
were any events that happened before e5, they would be colored black too.)