Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Cirrelus committed Jun 9, 2020
1 parent ccb76bb commit 2116fbb
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lab4/src/makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
CC=gcc
CFLAGS=-I.

all : parallel_min_max
all : parallel_min_max zombee process_memory

parallel_min_max : utils.o find_min_max.o utils.h find_min_max.h
parallel_min_max : utils.o find_min_max.o
$(CC) -o parallel_min_max utils.o find_min_max.o parallel_min_max.c $(CFLAGS)

utils.o : utils.h
Expand All @@ -12,5 +12,11 @@ utils.o : utils.h
find_min_max.o : utils.h find_min_max.h
$(CC) -o find_min_max.o -c find_min_max.c $(CFLAGS)

zombee :
$(CC) -o zombee zombee.c $(CFLAGS)

process_memory :
$(CC) -o process_memory process_memory.c $(CFLAGS)

clean :
rm utils.o find_min_max.o parallel_min_max
rm utils.o find_min_max.o parallel_min_max zombee
18 changes: 18 additions & 0 deletions lab4/src/zombee.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <stdio.h>
#include <signal.h>
#include <unistd.h>

int main()
{
int pid = fork();
if(pid == 0) {
/* child */
while(1) pause();
} else {
/* parent */
sleep(1);
kill(pid, SIGKILL);
printf("pid %d should be a zombie\n", pid);
while(1) pause();
}
}

0 comments on commit 2116fbb

Please sign in to comment.