#include #include #include #include #include int main() { for (int start = 0; start < 50; start += 10) { pid_t pid = fork(); if (pid == -1) { fprintf(stderr, "Error forking: %s\n", strerror(errno)); return 1; } else if (pid == 0) { // I AM FORK! for (int i = start; i < start + 10; i++) { printf("%d: %d\n", pid, i); } printf("Fork %d finished counting from %d\n", getpid(), start); return 0; } else { printf("Fork %d successfull\n", pid); } } fork(); fork(); fork(); printf("Hello World\n"); }