| int main() { | |
| int child1, child2, child3; | |
| int grandchild; | |
| child1 = fork(); | |
| if (child1 == 0) { | |
| printf(1, "Child 1 forked successfully (PID: %d)\n", getpid()); | |
| sleep(100); | |
| grandchild = fork(); | |
| if (grandchild == 0) { | |
| printf(1, "Grandchild process forked successfully (PID: %d)\n", getpid()); | |
| int uncle_count = get_uncle_count(); | |
| printf(1, "Uncle count: %d\n", uncle_count); | |
| exit(); | |
| } | |
| wait(); | |
| exit(); | |
| } | |
| child2 = fork(); | |
| if (child2 == 0) { | |
| printf(1, "Child 2 process forked successfully (PID: %d)\n", getpid()); | |
| sleep(200); | |
| exit(); | |
| } | |
| child3 = fork(); | |
| if (child3 == 0) { | |
| printf(1, "Child 3 process forked successfully (PID: %d)\n", getpid()); | |
| sleep(300); | |
| exit(); | |
| } | |
| wait(); | |
| wait(); | |
| wait(); | |
| exit(); | |
| } | |
Xet Storage Details
- Size:
- 966 Bytes
- Xet hash:
- 4affa21a0e12d21c5fd0c9197d847418f15c3914d1f2ec03a58b493ce9c20dce
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.