#include
main ( )
{
int result ;
printf("%d: I am the parent. Remember my number!\n", getpid( ) );
printf("%d: I am now going to fork ... \n", getpid( ) );
result = fork ( ) ;
if (result != 0)
{ /* the parent will execute this code */
printf("%d: My child's pid is %d\n", getpid ( ), result );
}
else /* result == 0 */
{ /* the child will execute this code */
printf("%d: Hi ! I am the child.\n", getpid ( ) ) ;
exit (1) ;
printf("%d: like father like son. \n", getpid ( ) );
Write the output of the program. Draw a process three and label the processes with their process IDs.
Output
Process Tree
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here