// // Written for Computer Networks and Systems lab classes // AUTHOR : Sergiusz Warga #include #include #include #include void child_task() { for (int i = 1; i <= 10; ++i) { printf("%d\n", i); fflush(stdout); if (i < 10) sleep(1); } } int main() { pid_t pid; pid = fork(); if (pid == -1) { // If something went wrong. perror("Fork: "); exit(EXIT_FAILURE); } if (pid == 0) { // If this is a child process. child_task(); exit(EXIT_SUCCESS); } wait(); printf("END OF WORK\n"); return 0; }