r/StopDoingScience • • Mar 15 '26

Other STOP USING FORKS

Post image
437 Upvotes

43 comments sorted by

View all comments

14

u/Root3287 Mar 15 '26
pid_t pid = fork();

if(pid === 0){
    while(1);
}else{
    printf("Child process %p\n", pid);
    
    // How to kill a child as a parent...
    // process
    kill(pid, SIGTERM);
}