![]() |
VOOZH | about |
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 :
We can also Parbegin two process -
Void P( ) Void Q( )
{ {
A; D;
B; E;
C; }
}
The relative order among the statements of P & Q is always maintained
Advantages of Parbegin/Parend -
Disadvantages of Parbegin/Parend -