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 |
String copy logic in one line.
main() { int i = 0xff ; printf("\n%d", i<<2); } a. 4 b. 512 c. 1020 d. 1024
Write a program to receive an integer and find it's octal equivalent. How can i do with using while loop.
main ( ) { static char *s[ ] = {“black”, “white”, “yellow”, “violet”}; char **ptr[ ] = {s+3, s+2, s+1, s}, ***p; p = ptr; **++p; printf(“%s”,*--*++p + 3); }
What is your nationality?
Write a C program to add two numbers before the main function is called.
1 o 1 1 0 1 0 1 0 1 1 0 1 0 1 how to design this function format in c-language ?
main() { signed int bit=512, i=5; for(;i;i--) { printf("%d\n", bit >> (i - (i -1))); } } a. 512, 256, 0, 0, 0 b. 256, 256, 0, 0, 0 c. 512, 512, 512, 512, 512 d. 256, 256, 256, 256, 256
#define square(x) x*x main() { int i; i = 64/square(4); printf("%d",i); }
4 Answers Google, HCL, Quick Heal, WTF,
PROG. TO PRODUCE 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1
Write a c program to search an element in an array using recursion
main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }