Question

Follow the example programs unix_pipe.c, named_pipe.c and shm-posix-combined.c to write three versions (two pipe versions and one shared memory version) of an interprocess communication program (A8p2_unixpipe.c[pp], A8p2_namedpipe.c[pp] and A8p2_shm.c[pp]

Follow the example programs unix_pipe.c, named_pipe.c and shm-posix-combined.c to write three versions (two pipe versions and one shared memory version) of an interprocess communication program (A8p2_unixpipe.c[pp], A8p2_namedpipe.c[pp] and A8p2_shm.c[pp]) in C/C++. Each version should create two processes using fork. One of the two processes should send or share twenty random integers a1,…,a20 in the range from -19 to 19 inclusive to the other process. The sending process should print out the values of these integers. The receiving process should decide and print out whether the two vectors (a1,…,a10) and (a11,…,a20) are orthogonal. Either parent or child can act as the sending process or receiving process. Sample runs of the programs in 1 & 2 can look like the following. You do NOT need to submit screen shots. Instead submit source code files.


[kwang@computer][~/temp]$ ./A8p2_shm

child wrote into the shared memory:

-3,8,-13,17,11,-7,13,3,-6,16,

0,3,-10,15,-5,-2,0,9,-1,-10,

parent read from the shared memory:

-3,8,-13,17,11,-7,13,3,-6,16,

0,3,-10,15,-5,-2,0,9,-1,-10,

The two vectors are not orthogonal

[kwang@computer][~/temp]$ ./A8p2_unixpipe

child sent into the unnamed pipe:

-9,-7,7,12,-3,-1,16,14,-8,-10,

-6,-3,-12,17,-4,-13,5,-9,-16,-19,

parent received from the unnamed pipe:

-9,-7,7,12,-3,-1,16,14,-8,-10,

-6,-3,-12,17,-4,-13,5,-9,-16,-19,

The two vectors are not orthogonal

[kwang@computer][~/temp]$ ./A8p2_namedpipe

child sent into the named pipe:

-10,-16,-15,-19,9,-3,19,12,5,-15,

8,-19,3,10,-16,-6,18,-12,-6,14,

parent received from the named pipe:

-10,-16,-15,-19,9,-3,19,12,5,-15,

8,-19,3,10,-16,-6,18,-12,-6,14,

The two vectors are not orthogonal



0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 8 more requests to produce the answer.

2 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
Follow the example programs unix_pipe.c, named_pipe.c and shm-posix-combined.c to write three versions (two pipe versions and one shared memory version) of an interprocess communication program (A8p2_unixpipe.c[pp], A8p2_namedpipe.c[pp] and A8p2_shm.c[pp]
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT