Here you can ask questions and find or give answers to organizational, academic and other questions about studying computer science.

915 questions

1k answers


441 users

0 votes

Please your help. I want to understand the example P5b of the slide 91 of the chapter Multiprocessor Systems and Multicore Processors:

I don't understand why in the PRAM consistency of Thread P the sequence begins with q2 instead of p1.

In first instance I though that the sequence was:

I really appreciate your help and support
in * TF "Emb. Sys. and Rob." by (210 points)

1 Answer

+1 vote
For PRAM consistency, we need to schedule for each process the actions of the process plus the write actions of all other processes. For process p, we need to schedule the actions p1,p2,p3,q2,w3.

If we would start with scheduling p1, then the value of x would change to 1. Therefore, we cannot schedule p2 afterwards since that demands that y should have value 3 which is not yet the case. Thus, we are forced to first schedule q3, but that in turn demands that we first schedule p2 (since all actions of one process must respect the program order of the process). Thus, if we would start with p1, we have to schedule next q2 and then q3 so that we then can schedule p2. That far that good and then we have x=2 and y=3. However, then you are lost since scheduling finally p3 would demand that x should have value 1, but we now have x=2 and y=3.  Hence, you cannot start the schedule for process p with p1.

The other alternative is to start with q2 which changes the value of x to 2. Then you have the choice to schedule p1 or q3 which does not matter in which order these are schedule, but both have to be scheduled next so that we have x=1 and y=3. That allows us to schedule p2 and also p3. VoilĂ .
by (142k points)

Related questions

Imprint | Privacy Policy