Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Implement a program to synchronize, with Unix/Linux pipes, concurrent processes

ID: 3749411 • Letter: I

Question

Implement a program to synchronize, with Unix/Linux pipes,
concurrent processes which perform arithmetic operations. You will learn concepts from several
computer science disciplines, including data flow architecture, parallel computation, and, of course,
operating systems. The input (passed as the first argument of your main program) to your program
is a process precedence/dataflow graph specified in the following format:
input_var a,b,c,d;
internal_var p0,p1,p2,p3;
a -> p0;
- b -> p0;
c -> p1;
+ d -> p1;
a -> p2;
- d -> p2;
p0 -> p3;
* p1 -> p3;
+ p2 -> p3;
write(a,b,c,d,p0,p1,p2,p3).
input_var
declares input variables to be read by your program. Each input value (after it is read) is stored
in a process you create.
internal_var
declares internal variables whose values will be computed by processes you create. There will be a
distinct process to handle the calculation for each internal variable.
To keep the input simple, the values of the input variables to be read by your program will
be in the same order they appear in the input var declaration. There will be no syntax/semantic
errors. Also, there are at most 10 input variables and 10 internal variables.

Explanation / Answer

main()
{ input_var a,b,c,d;
internal_var p0,p1,p2,p3;
read(a,b,c,d);
cobegin
p0 = a - b;
p1 = c + d;
p2 = a - d;
coend;
p3 = (p0 + p1) * p2;
write(a,b,c,d,p0,p1,p2,p3);
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote