谁抽中FEDEX $25 gc 了?# Money - 海外理财
h*a
1 楼
【 以下文字转载自 Linux 讨论区 】
发信人: himdca (how are you doing?), 信区: Linux
标 题: 再问个fork的题
发信站: BBS 未名空间站 (Thu Jun 9 03:31:30 2011, 美东)
Given the following code:
#include
int main(void)
{
int tmp;
tmp = fork();
if(tmp == 0)
{
printf("Hello ")
sleep(1)
}
else if(tmp > 0)
{
printf("World, ")
sleep(1)
}
print "Bye bye"
}
Assuming the call to fork doesn't fail, which of the following is true (zero
or more answers may be correct):
a The execution of this is deterministic.
b The output will be: 'Hello World, Bye bye'
c This can fail if STDERR is not redirected correctly.
d This will create a child process.
e The output will be: 'Hello Bye bye'
f The print of 'Bye bye' will be executed multiple times.
c是对的吗?不太明白是什么意思。
发信人: himdca (how are you doing?), 信区: Linux
标 题: 再问个fork的题
发信站: BBS 未名空间站 (Thu Jun 9 03:31:30 2011, 美东)
Given the following code:
#include
int main(void)
{
int tmp;
tmp = fork();
if(tmp == 0)
{
printf("Hello ")
sleep(1)
}
else if(tmp > 0)
{
printf("World, ")
sleep(1)
}
print "Bye bye"
}
Assuming the call to fork doesn't fail, which of the following is true (zero
or more answers may be correct):
a The execution of this is deterministic.
b The output will be: 'Hello World, Bye bye'
c This can fail if STDERR is not redirected correctly.
d This will create a child process.
e The output will be: 'Hello Bye bye'
f The print of 'Bye bye' will be executed multiple times.
c是对的吗?不太明白是什么意思。