作業系統›Ch4 行程與執行緒管理第 63 題/共 70 題
63. fork()、Process Creation
#OS-04-063易fork()Process Creation
Consider the C code on the right side. A user executes the executable of the code on a Linux shell. Assume it executed successfully. How many processes have been created by executing the C code, including the original process that executes main()?
int main() {
pid_t pid;
int i=0;
for (i=0;i<4;i++) {
pid = fork();
if (pid <0) {
fprintf(stderr,"fork error\n");
exit(-1);
}
}
return 0;
}
📄 中央111
▤完整推導請見《WH 資工筆記 · 作業系統》Ch4 行程與執行緒管理