Added Process exercise's chapter

This commit is contained in:
Fabio Scotto di Santolo
2024-08-26 15:35:43 +02:00
parent 2699b3ceec
commit da93cb8369
17 changed files with 665 additions and 0 deletions

18
ex19.c Normal file
View File

@@ -0,0 +1,18 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
int main(void) {
pid_t parent_pid = getpid();
pid_t pid = fork();
if (pid > 0) {
printf("PARENT PID = %d, CHILD PID = %d\n", parent_pid, pid);
sleep(10);
wait(NULL);
}
return EXIT_SUCCESS;
}