[理工] 作业系统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