subject
Engineering, 12.03.2020 02:35 googoo4

CS3733: Homework/Practice 05 Suppose we would like to write a program called monitor which allows two other programs to communicate with each other through the monitor while inspecting the send messages. It can be executed as follows: > monitor progl prog2 To simplify the implementation, we assume that prog1 (e. g., 1s) will be printing some messages on the standard output while the prog2 (e. g, sort) reads from standard input and writes something into standard output. Our monitor can run these two programs as children and let the first one send messages to the second one through our monitor. So our monitor can inspect the incoming messages. After inspection, it sends the message to the next program as is. Again to simplify the implementation, we assume that our monitor simply looks for digits. When it detects a digit in the message, our monitor simply prints it on the stderr (this monitoring task can be complicated for other purposes) Logically these programs will have the following relationship prog1(child11Pie>[0Monitor (Paren)[1>Pipe2->[0Kprog2 (child2) You are asked to create the necessary pipes, child processes and connect them as explained in the above scenario. You can ignore most of the error checking to make your solution clear, but you need to close all unnecessary file descriptors and check what read-write return > monitor /bin/ls /usr/bin/sort #include #include #include #include int main (int argc, char argv int Pipel [2]; int Pipe2 [2] int chlpid, ch2pid, numread, numwrite; char buf if (chlpid.. 0){ /* child 1 7/ execl (argv[1], "progl", NULL) if (ch2pid0)/child 1 / execi (argv[2],"prog2", NULL)

ansver
Answers: 3

Other questions on the subject: Engineering

image
Engineering, 04.07.2019 18:10, mm016281
What difference(s) did you notice using a pneumatic circuit over hydraulic circuit. explain why the pneumatic piston stumbles when it hits an obstacle.
Answers: 2
image
Engineering, 04.07.2019 18:20, sanchez626
Aheavily insulated piston-cylinder device contains 0.02 m3 of steam at 300 kpa and 200 °c. 1.2 mpa. d this process. team is now compressed in a reversible manner to a pressure of etermine the entropy change and the work done on the steam during this process
Answers: 1
image
Engineering, 04.07.2019 19:20, justicehernandez
Acarnot refrigerator operates in a room in which the temperature is 21°c and of power when operating. if the food compartment of the refrigerator is consumes 3 kw to be maintained at 2°c, determine (a) the coefficient of performance of the cycle and (b) the rate of heat removal from the food compartment. refrigerator cycle that has a higher coefficient of performance than that of the discussed (e) is it possible to develop a carn ot refrigerator, operating between the same temperature limits? explain
Answers: 2
image
Engineering, 06.07.2019 03:20, cherkaouinazihp387bk
Figure out the odd statement about ceramics in the following (a) good insulators of heat and electricity (b) usually less desire than metals (c) ductile in nature (d) contains both metallic and nonmetallic elements
Answers: 3
You know the right answer?
CS3733: Homework/Practice 05 Suppose we would like to write a program called monitor which allows tw...

Questions in other subjects:

Konu
Mathematics, 18.09.2019 15:50
Konu
Mathematics, 18.09.2019 15:50