Question: Consider the following C function: int count = 0 ; pid _ t pid; pid _ t mystery ( ) { for ( int i
Consider the following C function:
int count ; pidt pid;
pidt mystery
for int i ; i ; i
count ;
pid fork;
if pid
return pid;
return ;
Which of the following is true about the above function? Select all that apply.
after calling this function, it is possible for the process that calls this function to wait upon and output the exit statuses of all the processes it creates
the assembly code generated for count will internally dereference a pointer since the location where count is stored is different in different processes
assuming the compiler keeps i in a register, at some point while this function is running, there will be multiple copies of the value of i
if fork fails such as due to the system being out of memory the function will crash or hang rather than returning
sometimes when the function returns, the value of the stack pointer will be different than it was just before it was called
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
