520 views

how to make concurrency diagram plz explain?

is this qsn from OS advance ?

yes it is from advance set of question

# FORK-JOIN STRUCTURE

 fork L;

means to create a new child process, which will start it's execution from label L. And the parent process will continue it's execution from instruction following the fork statement.

join count;

This is where processes join. The "count" tells the number of processes to be joint. Whenever a process joins, the count is decremented by 1. If the count is not zero, the process terminates. If it is zero, i.e. this is the last process, it continues to execute further instructions. This is how it works:

count = count - 1;
if(count != 0) then
quit;

Now, coming to your question. The count is initialized to 2, so two processes will join.

At starting, single process is running, which will execute A. Then fork L creates a child process that starts it's execution from label L, and executes statement C. While the parent process(original process) continues to execute B. Both these processes join at label M. And one of these (whichever reaches last) will execute D.

This gives the following concurrency diagram:-

Option (A)

Fork-join structure is nicely explained in this lecture: https://www.youtube.com/watch?v=CN9_YXGdQV8&list=PLLDC70psjvq5hIT0kfr1sirNuees0NIbG&index=4

### 1 comment

edited
thnx for nice explanation really helpful