Question: Let T(n) be the number of processes this program creates when its input is n. Write an recursive formula (i.e., a recurrence relation ) that

 Let T(n) be the number of processes this program creates when

Let T(n) be the number of processes this program creates when its input is n.

Write an recursive formula (i.e., a recurrence relation) that gives T(i) as a function of one or more values of T for smaller input (i.e., smaller i). Explain your reasoning.

Feel free to double-check your formula by actually running the program and possibly augmenting it so that it allows you to count processes in whichever way you want.

The C code might have a few errors but this is more of a conceptual problem with the use of fork().

1 | #include 2 | #include 3 | #include 4 5 int main (int argc, char **argv) int count; 7 8 9 { ! argv[0]); 11 (sscant(argv[1],"%d",&count) 1)) ((argc fprintf(stderr, "Usage: exit(1); if ! 2) %s ", 12 13 pid t pid1, pid2; while (count > ) t 15 pid-fork (); if (pidl > 0) 17 pid2 - fork(); countcount -2; } else if (pid! == 0) { 20 21 countcount -1; 23 exit(0) 25

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!