353 views
0 votes
0 votes

1 Answer

0 votes
0 votes

fork<label>  // it creates a new process and control go to specified label.

Join <variable > // it joins two process and variable is decrement by 1.

Initially two variable values are N=2 and M=2.

1st statement: fork L3.// contro go to label L3.

L3:S2 // it means create a process S2.

execute next statement i.e) goto L1.

L1: join N // now value of N=2-1=1.

and Joins with S3.

fork creates only one child process.Now control go returns to fork L3.

2nd statement: same as above it creates a new process S4 and joins with S5.// M value decrements by 1.

Next execute consecutive statements

S1

Joins N. // now N value =0

S3.   // there is a link b/w S1 and S3.

Join M // now M value=0.

S5  // there is a link b/w S3 and S5.

Now precedence graph after executing the above program.

Related questions