Untitled
unknown
plain_text
3 years ago
462 B
3
Indexable
//zombie process #include <stdio.h> #include<unistd.h> #include<stdlib.h> int main ( ) { int pid ; pid = fork ( ) ; /* Duplicate. Child and parent continue from here */ if ( pid != 0 ) /* pid is non-zero, so I must be the parent */ { while (1) /* Never terminate and never execute a wait ( ) */ sleep (100) ; /* stop executing for 100 seconds */ } else /* pid is zero, so I must be the child */ { exit (42) ; /* exit with any number */ } }
Editor is loading...