February 2020
Intermediate to advanced
292 pages
8h 54m
English
In this section, we create a program where a parent process forks its child process, the child process will do an infinite loop, and the parent kills it:
#include <stddef.h>#include <stdlib.h>#include <stdio.h>#include <unistd.h>#include <sys/types.h>#include <sys/wait.h>#include <iostream>int main(void){ std::cout << "Running child ..." << std::endl; while (true) ;}
#include <stddef.h>#include <stdlib.h>#include <stdio.h>#include <unistd.h>#include <sys/types.h>#include <sys/wait.h>#include <iostream>int main(void){ pid_t child; int status; std::cout << "I am the ...Read now
Unlock full access