In this article, we are going to cover the Concurrent Program in the Operating System and will make a Precedence Graph for the program, and will cover the program execution for the same.
In concurrent programming, the Real concurrent program is possible on the multiprocessor system. Any two statements Si and Sj can be executed concurrently or parallel if they are following the below condition.
In concurrent programming, it will be done or return by using the following statement given below -
Concurrent program for the given precedence graph as follows -
Read set(Si) ∩ Write set(Sj) = ϕ Write set(Si) ∩ Read set(Sj) = ϕ Write set(Si) ∩ Write set(Sj) = ϕIn concurrent programming "Concurrent" word has a different meaning.
- They can execute concurrently or parallel.
- They do not have any dependency.
- Anyone can start first.
S1: p = q+r; S2: s = t×u; S3: v = w/x; S4: y = z×a;Read Set and Write set for the above expression as follows -
Read Set = {q, r, t, u, w, x, z, a}
Write Set ={p, s, v, y}
Precedence Graph for the read and write set as follows -
In concurrent programming, it will be done or return by using the following statement given below -
par begin - par end or Co begin - Co endConcurrent program for Precedence Graph : Let us consider the following Precedence Graph given below -
Concurrent program for the given precedence graph as follows -
begin
S1:
par begin
begin
S2;
S6;
end
begin
S3;
S7;
end
S4;
S5;
par end
S8;
end