父进程
- 名parent process
-
当shell脚本进程退出或返回到父进程时,退出码应该是0。
When a shell script process exits or returns to the parent process , the exit code should be0 .
-
在此例中,父进程调用fork,等待两秒钟,然后退出。
In this example , the parent process calls fork , waits for two seconds , then exits .
-
指向兄弟进程链表中下一个和前一个元素的指针,兄弟进程指的是与P有相同父进程的进程。
The pointers to the next and previous elements in the list of the sibling processes , those that have the same parent as P.
-
由于子进程在后台运行,父进程一终止,控制即返回到Shell。
Because the child process is running in the background , control returns to the shell as soon as the parent dies .
-
进程还有父进程,在大多数情况下就是启动它的进程的PID。
A process also has a parent , which in most cases is the PID of the process that launched it .
-
让每一个进程在屏幕上显示一个字符:父进程显示字符a,两个子进程分别显示字符b和子符c。
So that each process is displayed on the screen of a Characters : parent display characters a , respectively , two sub-processes and sub-character display character bc .
-
init进程是Linux的第一个进程,它是所有其他进程的父进程。
The init process is Linux 's first process , parent to all the other processes .
-
Init是将要在您的Linux操作系统上运行的所有其它进程的父进程。
Init is the parent of all other processes that will run on your Linux OS .
-
exit()函数会令程序正常终止,并将&0377状态值返回给父进程。
The exit () function causes normal program termination and the value of status & 0377 is returned to the parent .
-
该进程是AIX上运行的所有其他进程的父进程或根进程。
This process is the parent , or root , process to all other processes running on AIX .
-
尽管父进程可以访问其子进程的进程ID并向它传递参数,但是反过来不行。
Although a parent process can access the process ID of its child process and can thus pass arguments to it , the reverse is false .
-
它必须与fork()命令一起使用,所以父进程和子进程都在运行:pidtfork(void)。
This must be used along with the fork () command so both the parent and child processes are running : pid_t fork ( void ) .
-
执行fork之后,父进程和子进程获得打开的所有文件描述符和数据值的拷贝,所以指针对于它们都是有效的。
After the fork , the parent and child have copies of all open file descriptors and data values , so the pointer works for both .
-
对所打印的PID进行比较,可以看到原始进程是父进程(PID767),并且子进程(PID768)知道其父进程是谁。
Comparing the PIDs printed , you can see that the original process is the parent process ( PID 767 ), and the child process ( PID 768 ) knows who its parent is .
-
第一列列出用于运行该进程的用户身份,第二列列出进程的ID,第三列列出该进程的父进程ID。
The first lists the user the process is running as , the second lists the ID of the process , and the third lists the ID of the parent of the process .
-
考虑到fork的返回值,现在该代码可以检查确定它是父进程还是子进程,并进行相应的操作。
With the return value of fork in mind , the code can now check to see if it is the parent or child process and act accordingly .
-
如果您不指定任何PID,那么另一个比较有用的选项是&forest,它以树结构的形式显示命令,以及每个进程对应的父进程。
If you do not specify any PIDs , then another useful option is the & forest option , which displays the commands in a tree hierarchy , showing which process has which other process as a parent .
-
清单3在每个步骤打印出PID,并且该代码检查从fork返回的值来确定哪个进程是父进程,哪个进程是子进程。
In Listing 3 , the PIDs are printed out at each step , and the code checks the return value from fork to determine which process is the parent and which is the child .
-
现在,向父进程发送一个SIGTERM。
Let 's now send a SIGTERM to the parent process .
-
可以看到,PPID在父进程终止后更改为1。
You can see that the PPID changes to1 as the parent dies .
-
fork()会创建一个子进程,与父进程相比只是PID和PPID不同;实际上,资源利用设为0。
Fork () creates a child process that differs from the parent process only in its PID and PPID ; in fact , the resource utilizations are set to0 .
-
在进程执行fork时,操作系统将创建具有新进程ID的新的子进程,复制父进程的状态(内存、环境变量等)。
When a process forks , the operating system creates a new child process with a new process ID , duplicating the state of the parent process ( memory , environment variables , and more ) .
-
请注意子进程如何通过getppid来知道其父进程以及父进程如何使用fork来定位其子进程。
Note how the child knows its parent through getppid and how the parent uses the result of fork to locate its child .
-
然后使用值18(SIGCHLD)来调用信号处理程序,确认子进程的退出,并且父进程返回到sleep(60)。
The signal handler is called with a value of 18 ( SIGCHLD ), the child 's exit is acknowledged , and the parent goes back to its sleep ( 60 ) .
-
PID2934是父进程,PID2935是派生(fork)并立即终止的进程。
PID2934 is the parent process , and PID2935 is the one that is forked off and terminated immediately .
-
bInheritHandles确定了子进程是否要继承父进程的句柄。
BInheritHandles determines whether the handles have to be inherited to the child from the parent .
-
记住,每个进程都有父进程,并且您可以跟踪从每个子进程一直到PID1(或称为init)的整个进程家族树。
Recall that each process has a parent , and you can trace this family tree of sorts all the way back to PID1 , otherwise known as init .
-
运行在一个处理器上的父进程根据numproc2的值来切换numproc1的值(并且根据由另一个处理器修改的该变量的值进行转移)。
The parent process running on one processor toggles the value of num_proc1 based on the value of num_proc2 ( and branches based on the value of the variable modified by another process ) .
-
核心处理这个调用的时候释放进程的全部资源并向其父进程发送SIGCHLD信号,缺省情况下这个信号是被父进程忽略的。
The kernel handles this system call by releasing the resources owned by the process and sending the parent process a SIGCHLD signal , which is ignored by default .
-
和非零返回值的基本原理在于,子进程始终可以通过getppid(2)调用来找出其父进程是谁,但是父进程要找出它的所有子进程却很困难。
The rationale for the0 and non-zero return values is that a child can always find out who its parent is through a call to getppid ( 2 ), but it is more difficult for a parent to find all its children .