how many processes will gate created execution of
--------
fork();
fork();
fork();
--------
Please Explain...
Thanks in advance..!
Answers were Sorted based on User's Feedback
Answer / rajesh
the answer is 8.if n fork calls then no.of processes will
be 2^n
Is This Answer Correct ? | 36 Yes | 13 No |
Answer / nishant
7 child process will b created.
Because 1 process ia already present at the start
Is This Answer Correct ? | 16 Yes | 1 No |
Answer / abhinav
The process creation at each fork is shown. the number after
fork tells which process is calling fork.
Total 8 processes.
/--1
/---fork1
/ \--5
/-fork1-
/ \ /--3
/ \---fork3
---fork1 \--6
\
| /--2
\ /--fork2--
\ / \--7
\fork2--
\ /--4
\--fork4--
\--8
Is This Answer Correct ? | 12 Yes | 3 No |
Answer / rakesh
ya right 8 processes .
For further explanation visit - http://powerboom.blog.co.in
This site gives good explanation .
Is This Answer Correct ? | 11 Yes | 3 No |
Answer / nisha
'8' as formulated by rajesh but in case, fork() used with the combination of && and || operators,,this formula doesn't work...
Is This Answer Correct ? | 0 Yes | 2 No |
Answer / sagar arora
8 because of the rajesh logic but sometimes it fails.
Is This Answer Correct ? | 6 Yes | 10 No |
how to return a multiple value from a function?
main() { char * strA; char * strB = I am OK; memcpy( strA, strB, 6); } a. Runtime error. b. I am OK c. Compile error d. I am O
why nlogn is the lower limit of any sort algorithm?
Write a complete program that consists of a function that can receive two numbers from a user (M and N) as a parameter. Then print all the numbers between the two numbers including the number itself. If the value of M is smaller than N, print the numbers in ascending flow. If the value of M is bigger than N, print the numbers in descending flow. may i know how the coding look like?
main() { char name[10],s[12]; scanf(" \"%[^\"]\"",s); } How scanf will execute?
#include<conio.h> main() { int x,y=2,z,a; if(x=y%2) z=2; a=2; printf("%d %d ",z,x); }
Write a C function to search a number in the given list of numbers. donot use printf and scanf
main() { char *p = “ayqm”; printf(“%c”,++*(p++)); }
29 Answers IBM, TCS, UGC NET, Wipro,
void main() { int c; c=printf("Hello world"); printf("\n%d",c); }
main() { float me = 1.1; double you = 1.1; if(me==you) printf("I love U"); else printf("I hate U"); }
Is the following code legal? struct a { int x; struct a b; }
what is the code of the output of print the 10 fibonacci number series