FOR FREE MATERIALS

Dependency or Precedence graph for Concurrency and Concurrent Programming: 

 

Procedure and example 

Concurrency and concurrent programming can be achieved through multi-processor, vector processor & array processor.

 

Dependency or precedence graph indicated which statements execute first, how one process depends on another process, and the flow of the processes.

 

 

Concurrency Condition: 

S1: a = b + c;

S2: x = a * f; 

S3: y = a + m;

S4: l = x + y;

 

Example 2:

 

We have code where there are three statements S1 to S3 and three semaphore variables a, b, c.

code

begin

cobegin

   begin:S1;V(a);V(b) end;

begin:P(a);S2;V(c) end;

begin:P(b)P(c);S3  end;

coend

end

 

Here V means Up operation and P means Down operation.

 

Now we design a precedence graph as per the above code.

 

 

If we see the above code S1 does not depend on any statement so, S1 starts first.

 

S2 depends on S1 because S1 Up the semaphore variable a i.e. V(a) and until the semaphore variable a is down, S2 will not start i.e. P(a).

 

S3 depends on S1 because S1 Up the semaphore variable b i.e. V(b) and until the semaphore variable b is down, S3 will not start i.e. P(a).

S3 depends on S2 because S2 Up the semaphore variable c i.e. V(c) and until the semaphore variable c is down, S3 will not start i.e. P(c)