《操作系统》的实验代码。
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

14 lines
296 B

#include <signal.h>
#include <unistd.h>
int main(void) {
pid_t child = fork();
if (child) { // in parent
sleep(5);
kill(child, SIGKILL);
} else { // in child
for (;;); // loop until killed
}
return 0;
}