cpp
#include<stdio.h>
#include <sys/types.h>
#include<unistd.h>
int main()
{
pid_t pid;
int data = 10;
while(1)
{
printf("please input a data:");
scanf("%d",&data);
if (data == 1)
{
pid = fork();
if (pid>0)
{
}
else if (pid == 0)
{
while(1)
{
printf("\ndo net request,pid=%d\n",getpid());
sleep(3);
}
}
}
else
{
printf("wati,do nothing\n");
}
}
}