βThe wait system call
In this section we shall see how the wait() system call works
#include <stdio.h>
#include <unistd.h>
int main(int argc, char *argv[]){
int id = fork();
int n = (id == 0) ? 1 : 6;
for (int i = 0; i < 5; i++)
printf("%d ", i + n);
return 0;
}Outputs
1 2 3 4 5 6 7 8 9 106 7 8 9 10 1 2 3 4 56 7 8 9 10Last updated