Parbegin/Parend Concurrent Statement

Prerequisite – Introduction of Process Synchronization
PARBEGIN/PAREND statement is a higher-level language construct for specifying concurrency. All statements can be executed concurrently those are enclosed between PARBEGIN and PAREND. It is used in modelling precedence graph. It is used as an alternative for the FORK/JOIN statement.

Note –
PARBEGIN/PAREND is also called COBEGIN/COEND.

Consider the following program:

S0;
PARBEGIN;
   S1;
   S2;
   ...
   Sn-1;
PAREND;
Sn;

The above program is equivalent to the following precedence graph.



Example –
Construct the precedence graph for the following parbegin/parend program.

begin
S1;
      parbegin
      S3;
      begin
      S2;
            parbegin
            S4;
            S5;
            parend;
            S6;
      end;
      parend;
S7;
end; 

Explanation :

Advantages of Parbegin/Parend –

  • It is a high-level language block-structure.
  • It has the advantage of structured control statements.
  • Semaphores mechanism is also one of the advantages.

Disadvantages of Parbegin/Parend –

  • It is not powerful enough to model all possible precedence graph.
  • It is less powerful than the FORK/JOIN construct in modelling precedence graph.

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.