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 |
#include<stdio.h> main() { struct xx { int x; struct yy { char s; struct xx *p; }; struct yy *q; }; }
write a program in c language to get the value of arroy keys pressed and display the message which arrow key is pressed?
C program to print magic square of order n where n > 3 and n is odd
How do you write a program which produces its own source code as its output?
Write a C function to search a number in the given list of numbers. donot use printf and scanf
could you please send the program code for multiplying sparse matrix in c????
main() { static int var = 5; printf("%d ",var--); if(var) main(); }
func(a,b) int a,b; { return( a= (a==b) ); } main() { int process(),func(); printf("The value of process is %d !\n ",process(func,3,6)); } process(pf,val1,val2) int (*pf) (); int val1,val2; { return((*pf) (val1,val2)); }
main() { int a[10]; printf("%d",*a+1-*a+3); }
main() { int i =10, j = 20; clrscr(); printf("%d, %d, ", j-- , --i); printf("%d, %d ", j++ , ++i); } a. 20, 10, 20, 10 b. 20, 9, 20, 10 c. 20, 9, 19, 10 d. 19, 9, 20, 10
PROG. TO PRODUCE 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1
main() { int c[ ]={2.8,3.4,4,6.7,5}; int j,*p=c,*q=c; for(j=0;j<5;j++) { printf(" %d ",*c); ++q; } for(j=0;j<5;j++){ printf(" %d ",*p); ++p; } }