Question
Please answer this question correctly and put the screenshot Write a program named , which should take one command-line argument called maxnum. prseq should fork
Please answer this question correctly and put the screenshot
Write a program named
The parent process will print out 0, 3, 6, 9, etc.
One of the two child processes will print out 1, 4, 7, etc.
The other child process will print out 2, 5, 8, etc.
Obviously, unless we control the execution order of these three processes carefully, different outcomes will be observed (for example, when maxnum=4, 1,4,2,0,3 and 2,1,4,0,3 are two of the possible outcomes). You will be exploring ways to manufacture such different outcomes.
Use any kind of techniques (sleep(), excessive computation, etc.) to slow down one or two of the three processes to come up with as many different outputs as possible.
All of your executions should be fed with a maxnum=4.
Do not use semaphores or any standard solution that we have discussed or will discuss in Chapter 6.
Take snapshots
How many different outcomes have you generated?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started