English 中文(简体)
(a) 理解
原标题:unix fork() understanding
int main(){
    fork();
}

我知道这是一个新问题,但我的理解是,现在的父母程序将预示一个与父母完全相同的新的儿童进程,这意味着儿童也应为儿童进程而奋斗。 实际上,这只会产生一个儿童进程。 我无法理解儿童将执行什么法典?

最佳回答

儿童过程开始在最后一名儿童离去的准确点执行,之后是静态发言。 如果你想永远放弃,那么你就不得不把它放在一旁。

问题回答

正如每个人都提到的那样,儿童还开始在fork(> 之后执行。 因此,它没有打上<条码>。

You could see it clearly in the very common usage like this:

int main()
{
    if (fork())
    {
        // you are in parent. The return value of fork was the pid of the child
        // here you can do stuff and perhaps eventually `wait` on the child
    }
    else
    {
        // you are in the child. The return value of fork was 0
        // you may often see here an `exec*` command
    }
}

你们失去了一个半殖民地。

但是,儿童(以及父母)在《<<>fork>出现之后就继续工作。 从申请方案拟订的角度来看,fork (如所有)为“atomic”。

两个过程(在<条码>后/code>有概念上分开的记忆空间)之间的唯一区别是<条码>fork的结果。

如果儿童上电话fork,则该儿童将有两个fork(制作该编码的号码,然后制作的编号),而父母只有一人(带子女)。 <代码>fork 的性质是,一个程序称为该编码,两个程序从该文本中退回。





相关问题
Signed executables under Linux

For security reasons, it is desirable to check the integrity of code before execution, avoiding tampered software by an attacker. So, my question is How to sign executable code and run only trusted ...

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How can I use exit codes to run shell scripts sequentially?

Since cruise control is full of bugs that have wasted my entire week, I have decided the existing shell scripts I have are simpler and thus better. Here is what I have so far svn update /var/www/...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

热门标签