There are certain conditions for concurrency. Here we have listed them for you in this article.
Conditions for Concurrency
, the read set for , is the set of all variables whose values are referenced in statement during its execution.
, the write set for , is the set of all variables whose values are changed or written by the execution of statement .
Example #1
Consider the statement.
The read set:
The write set:
The intersection of and need not be null.
Example #2
Consider following statement:
The read set:
The write set:
Bernstein’s Conditions
The following three conditions must be satisfied for two successive statements and to be executed concurrently and still produce the same results known as Bernstein’s conditions.
- .
- .
- .
Example:
Consider the following statements.
.
.
.
.
.
.
In the example above, all three conditions are satisfied. Therefore, the statement and can be executed concurrently.
We could use the precedence graph, but the precedence graph cannot be used in programming as it is a two-dimensional object. Moreover, it only shows the dependency relationship between statements.