#include
#include
main()
{
int ret;
ret = fork();
if(ret == 0)
{ printf("\n");
printf("Current Process pid =%d(Executed by child\n",getpid());
printf("\n");
printf("Parent Process pid =%d(Executed by child)\n",getppid());
printf("\n");
}
else
{
wait();
printf("\n");
printf("Current Process pid =%d(Executed by child\n",getpid());
printf("\n");
printf("Parent Process pid =%d(Executed By parent\n",getppid());
printf("\n");
}
}
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment