Created
October 10, 2022 19:18
-
-
Save EvanWieland/bad8265d85df9d1a51288a57f193d06b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Zombie.c | |
// | |
// This program creates a Zombie proc. | |
// | |
// Evan Wieland | |
// 9/26/2022 | |
// | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <sys/types.h> | |
#include <sys/wait.h> | |
#include <stdlib.h> | |
#define WANDER 10 | |
int main() { | |
pid_t pid; | |
pid = fork(); | |
if(pid < 0){ | |
// Error | |
} | |
else if(pid == 0){ | |
// Child | |
} | |
else { | |
sleep(WANDER); | |
printf("\n Zombie DONE wandering... \n"); | |
return 0; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment