[理工] 作業系統OS的fork基本原理
我直接貼上一個問題 不過有點太簡單-_-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前後哪一個東西該怎麼看呢?
感謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 118.165.100.211
※ 文章網址: http://www.ptt.cc/bbs/Grad-ProbAsk/M.1416489305.A.F79.html
討論串 (同標題文章)
完整討論串 (本文為第 1 之 2 篇):