由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Unix版 - "fork" program question.
相关主题
how to fork a subroutine in unix?awk question
fork() and execve() in Unixreverse the lines?
各位大哥帮忙,EXECVE()的使用归纳法证个题,谁会?
[转载] waitpid 一问Re: redirect in fork() then exec()
A problem about child process.菜鸟一问
FreeBSD: Can't kill child process!help!!! pipe program
how to record the process end time in a child process and obtain it in the parent process?multithread question
Re: how to close port/socket from parent process?help!!!!!!!!!Re: [转载] 进程间通讯时共享内存问题
相关话题的讨论汇总
话题: line话题: process话题: fork话题: parent话题: child
进入Unix版参与讨论
1 (共1页)
w****a
发帖数: 155
1
Is my analysis for the following program correct? Many thanks.
Line 1) x = 10;
Line 2) if (fork()) x = x+5;
Line 3) if (x % 5 == 0) {
Line 4) if (fork()) x = x + 100;
}
At line 1, x = 10, this is for parent process 0.
At line 2, fork call will build a child process 1, in parent process 0, x =
15, but in child process x=5;
At line 3, both parent process 0 and child proces 1 will enter the if loop.
parent process 0 will build another child process 2, after finishing line 4,
the x in pa
1 (共1页)
进入Unix版参与讨论
相关主题
Re: [转载] 进程间通讯时共享内存问题A problem about child process.
X Window求助FreeBSD: Can't kill child process!
[转载] 请教:UNIX下process之间的signal问题how to record the process end time in a child process and obtain it in the parent process?
ssh client on SolarisRe: how to close port/socket from parent process?help!!!!!!!!!
how to fork a subroutine in unix?awk question
fork() and execve() in Unixreverse the lines?
各位大哥帮忙,EXECVE()的使用归纳法证个题,谁会?
[转载] waitpid 一问Re: redirect in fork() then exec()
相关话题的讨论汇总
话题: line话题: process话题: fork话题: parent话题: child