in Operating System retagged by
520 views
0 votes
0 votes

how to make concurrency diagram plz explain?

in Operating System retagged by
520 views

2 Comments

is this qsn from OS advance ?

0
0
yes it is from advance set of question
0
0

1 Answer

4 votes
4 votes
Best answer

                   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

selected by

1 comment

edited by
thnx for nice explanation really helpful
1
1

Related questions

3 votes
3 votes
1 answer
3