[理工] 作業系統OS的fork基本原理

作者: ifooleru (i服了u)   2014-11-20 21:15:02
我直接貼上一個問題 不過有點太簡單-_-a
Consider the following code segment:
pid_tpid;
pid = fork();
if (pid == 0) { /* child process */
fork();
thread_create( . . .);
}
fork();
a. How many unique processes are created?
b. How many unique threads are created?
Answer:
There are six processes and two threads.
請問答案為何是6個processes和2個threads?
要fork前後哪一個東西該怎麼看呢?
感謝

Links booklink

Contact Us: admin [ a t ] ucptt.com