分析代碼并畫出行程的親族關系圖,并且推斷程式的輸出結果
#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
int main(){
pid_t pid;
pid=fork();
pid=fork();
if(pid>0){
fork();
}
else{
fork();
}
printf("pid=%d hello\n",getpid());
exit(0);
}
行程親族關系圖:

一共創建了8個行程,每個行程都會執行print函式后執行exit()函式終止
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/321506.html
標籤:其他
