#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
int main()
{
pid_t pid;
printf("[ Processs PID:%d PPID:%d ]\n\n", getpid(), getppid()) ;
switch(pid=fork()) {
case -1:
perror("[ Fork Error ]\n") ;
exit(0);
case 0:
printf("[ Child PID:%d PPID:%d ]\n", getpid(), getppid());
printf("[ Child END ]\n");
break;
default:
printf("[ Parent PID:%d PPID:%d ]\n", getpid(), getppid() );
printf("[ Parent END ]\n");
break;
}
printf("[ Process End : %d ]\n\n", getpid() );
exit(0);
}