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:
10 videos|99 docs|33 tests
|
1. What is a concurrent statement in Computer Science Engineering (CSE)? |
2. How does a concurrent statement differ from a sequential statement in CSE? |
3. What are some commonly used concurrent statement constructs in CSE? |
4. How can concurrent statements improve the performance of computer systems in CSE? |
5. What are the challenges associated with using concurrent statements in CSE? |
|
Explore Courses for Computer Science Engineering (CSE) exam
|