Question: Consider the following snippet of coded logic: pid = fork() /* We are calling system call fork(). The value returned by fork() is stored in
Consider the following snippet of coded logic:
pid = fork() /* We are calling system call fork(). The value returned by fork() is
stored in variable pid. */
if (pid == 0) { /* If the value of variable pid is equal to 0, then the next 2 instructions
will be executed. */
fork() /* Here we are calling system call fork() again. */
thread_create( . . .) /* Here we are calling a function that creates a thread, which in turn
simply calculates and displays the first 10 Fibonacci numbers. */
}
fork() /* Here we are calling system call fork() again. */
How many processes are created, including the original process?
How many times is the thread_create() function invoked?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
