Child process can be created by POSIX function fork(), and below is the demo code.
pid = fork(); if (pid == 0) { /* processing of child process */ } else if (pid < 0) { /* parent process: handle errors */ perror("fork"); exit(-1); } else { /* parent process: the parameter of pid is the ID of forked child process */ }
And also, parent process could call function wait() to wait for finish of child process, instead of processing in the second return of function fork().