feat: update structure

This commit is contained in:
2024-01-22 14:27:40 +08:00
parent 7836c9185c
commit 3544a28a2e
559 changed files with 120846 additions and 4102 deletions

View File

@@ -0,0 +1,33 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/shm.h>
#include <sys/wait.h>
#include <unistd.h>
#define NUM_PROCESSES 5
int main() {
int i, j, pid;
for (i = 0; i < NUM_PROCESSES; i++) {
if ((pid = fork()) == 0) {
break;
}
}
if (pid == 0) {
printf("I am child %d\n", i);
for (j = i * 10; j < i * 10 + 10; j++) {
printf("%d ", j);
fflush(stdout);
usleep(250000);
}
printf("\n\n");
} else {
for (i = 0; i < NUM_PROCESSES; i++)
wait(NULL);
}
}