05 Linux应的用编程基础-1.ppt

  1. 1、本文档共65页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
05 Linux应的用编程基础-1

* * Firstly, each process encapsulates an executable program, each having its own main() function as an entry point. Furthermore, each process has its own memory space, which is separate from the memory spaces of other processes running on the system. (This feat is accomplished through hardware called the Memory Management Unit, and will not be discussed here.) * * * * pstree命令: 列出 当前进程以及他们的树形结构. STAT : S Sleeping. Usually waiting for an event to occur, such as a signal or input to become available. R Running. Strictly speaking, “runnable,” that is, on the run queue either executing or about to run. D Uninterruptible Sleep (Waiting). Usually waiting for input or output to complete. T Stopped. Usually stopped by shell job control or the process is under the control of a debugger. Z Defunct or “zombie” process. N Low priority task, “nice.” W Paging. (Not for Linux kernel 2.6 onwards.) s Process is a session leader. + Process is in the foreground process group. l Process is multithreaded. High priority task * * 练习: we@we:~/test$ ps PID TTY TIME CMD 1898 pts/2 00:00:00 bash 2773 pts/2 00:00:00 ps we@we:~/test$ ls /proc/1898/cwd * * * * 子进程结束后,它与父进程的关系仍然维持,一直到父进程正常结束或调用exit()函数退出。在此之前,它仍然呆在任务表中,其退出码仍然等待父进程查询。倘若父进程异常退出,则子进程立即成为INIT(PID=1)的子进程,等待INIT将其从任务表中清除。 * * * 子进程结束后,它与父进程的关系仍然维持,一直到父进程正常结束或调用exit()函数退出。在此之前,它仍然呆在任务表中,其退出码仍然等待父进程查询。倘若父进程异常退出,则子进程立即成为INIT(PID=1)的子进程,等待INIT将其从任务表中清除。 Using fork to create processes can be very useful, but you must keep track of child processes. When a child process terminates, an association with its parent survives until the parent in turn either terminates normally or calls wait. The child process entry in the process table is therefore not freed up immediately. Although no longer active, the child process is still in the system because its exit code needs to be stored in case the parent subsequently calls wait. It becomes what is known as defunct, or a zombie process. If the parent then terminates abnormally,

文档评论(0)

liwenhua00 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档