免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 901 | 回复: 0
打印 上一主题 下一主题

Processes(七) [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-04-17 21:48 |只看该作者 |倒序浏览

Relationships Among Processes
Processes created by a program have a parent/child relationship. When a process creates multiple children, these children have sibling relationships. Several fields must be introduced in a process descriptor to represent these relationships; they are listed in Table 3-3 with respect to a given process P. Processes 0 and 1 are created by the kernel; as we'll see later in the chapter, process 1 (init) is the ancestor of all other processes.
程序创建的进程有父子关系。当一个进程创建了多个孩子,这些孩子有兄弟关系。进程描述符的几个成员表示了这些关系;进程0和进程1是由内核创建的;进程1是所有其他进程的祖先。
Table 3-3. Fields of a process descriptor used to express parenthood relationships
Field name
Description
real_parent
Points to the process descriptor of the process that created P or to the descriptor of process 1 (init) if the parent process no longer exists. (Therefore, when a user starts a background process and exits the shell, the background process becomes the child of init.)
指向创建P进程的进程的描述符,如果父进程不存在时指向init进程的描述符。(因此,当一个用户开启一个后台进程并退出shell,后台进程变为init的子进程)
parent
Points to the current parent of P (this is the process that must be signaled when the child process terminates); its value usually coincides with that of real_parent. It may occasionally differ, such as when another process issues a ptrace( ) system call requesting that it be allowed to monitor P (see the section "Execution Tracing" in Chapter 20).
指向P进程的当前父进程(当子进程结束时,这是那个收到信号的进程);它的值通常和real_parent相同。也有可能不同,比如说当一个其他进程使用ptrace()系统调用请求允许监视P。
children
The head of the list containing all children created by P.
P创建的所有子进程链表的头。
sibling
The pointers to the next and previous elements in the list of the sibling processes, those that have the same parent as P.
指向兄弟进程链表中下一个和前一个元素的指针,兄弟进程指的是与P有相同父进程的进程。

Figure 3-4 illustrates the parent and sibling relationships of a group of processes. Process P0 successively created P1, P2, and P3. Process P3, in turn, created process P4.
Furthermore, there exist other relationships among processes: a process can be a leader of a process group or of a login session (see "Process Management" in Chapter 1), it can be a leader of a thread group (see "Identifying a Process" earlier in this chapter), and it can also trace the execution of other processes (see the section "Execution Tracing" in Chapter 20). Table 3-4 lists the fields of the process descriptor that establish these relationships between a process P and the other processes.
进程之间还有一些其他关系:一个进程可以是一个进程组或对话组的组长,它可以是一个线程组的组长,它还可以跟踪其他进程的执行。下表列出了在P进程和其他进程之间建立这些关系的成员。
Table 3-4. The fields of the process descriptor that establish non-parenthood relationships
Field name
Description
group_leader
Process descriptor pointer of the group leader of P
指向P所在进程组组长的进程描述符指针
signal->pgrp
PID of the group leader of P
P进程组组长的PID
tgid
PID of the thread group leader of P
P线程组组长的PID
signal->session
PID of the login session leader of P
P所在对话组组长的PID
ptrace_children
The head of a list containing all children of P being traced by a debugger
P所有被调试器跟踪的子进程链表的头
ptrace_list
The pointers to the next and previous elements in the real parent's list of traced processes (used when P is being traced)
指向被跟踪进程的真实父进程链表中的下一个和前一个元素的指针(用在P被跟踪时)



本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/65228/showart_546964.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP