Question: Using Ubuntu perform the following operations and answer the questions: Look at the code for Sample Program until you understand it. Sample Program #include #include

Using Ubuntu perform the following operations and answer the questions:

Look at the code for Sample Program until you understand it.

Sample Program

#include #include #include #include

int main(int argc, char* argv[]) { int i, limit;

if (argc < 2) { fputs("Usage: must supply a limit value ", stderr); exit(1); } limit = atoi(argv[1]);

fork(); fork(); printf ("PID#: %d ", getpid()); for (i=0; i

1. Create a diagram illustrating how Sample Program 2 executes. I.e. give a process hierarchy diagram (as described in class and in your textbook).

  • Suggestion: run the program several times with a small input value (e.g. <10). Examine the output carefully so that you understand exactly what is happening.

2. In the context of our classroom discussions on process state, process operations, and especially process scheduling, describe what you observed and try to explain what is happening to produce the observed results.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!