#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
intmain()
{
pid_t child_pid;
child_pid=fork();
if(child_pid<0)
{
perror("fork error");
exit(EXIT_FAILURE);
}
if(child_pid==0)//子进程处理 事务
{
while(1)
{
printf("hello world\n");
sleep(1);
}
return0;
}else
{
printf("father bye byte\n");
exit(EXIT_SUCCESS);
}
}