Skip to content

Instantly share code, notes, and snippets.

@EvanWieland
Created October 10, 2022 19:18
Show Gist options
  • Save EvanWieland/bad8265d85df9d1a51288a57f193d06b to your computer and use it in GitHub Desktop.
Save EvanWieland/bad8265d85df9d1a51288a57f193d06b to your computer and use it in GitHub Desktop.
//
// 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