>>
所在版块:求学狮城 发贴时间:2003-11-05 07:47  评分:

用户信息
复制本帖HTML代码
高亮: 今天贴 X 昨天贴 X 前天贴 X 
1.

The parent process P creates a child process P1, then print a line. The return value of the (1st) fock() for process P1 is 0,
so the second part of OR (||) is executed. As a result, P1 creates a new process P2. For P1, (fork()||fork()) is true, so the second part of AND(&&) should be executed: a new process P3 is created. For p1 the if condition is true, so p1 prints a line. For p2, fork()||fork() is false, so the if condition is false(note the 3rd fork() will not be executed), p2 doesn't execute printf statement. For p3, the 3rd fork() return 0, so the if condition is false. It skips printf statement. please correct me if i am wrong.

2.

I also choose A. PID 1 : init, is the parent process of all other processes in unix.


4.

For root directory, both . and .. refer to itself. so they have the same inode number. Note the parent of root is itself.


If i am wrong, Please correct me
.
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!

 相关帖子 我要回复↙ ↗回到正文
关于C和UNIX(MORE QUESTION) 一屁致命   (1739 bytes , 714reads )
Some add-ons to cigar's answer Flying   (1655 bytes , 314reads )
One point: 香陵居士   (243 bytes , 356reads )
Hmm... Flying   (86 bytes , 279reads )
>> cigar   (902 bytes , 385reads )
I made a mistake, i thought && and || were in cigar   (25 bytes , 245reads )
这么早起来灌水,佩服。。 朝令夕改   (0 bytes , 289reads )