Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

父进程死亡不会影响子进程的生命周期 #15

Open
jzeng9 opened this issue Jun 13, 2020 · 1 comment
Open

父进程死亡不会影响子进程的生命周期 #15

jzeng9 opened this issue Jun 13, 2020 · 1 comment

Comments

@jzeng9
Copy link

jzeng9 commented Jun 13, 2020

在操作系统一节中,笔记提到“所有创建的进程都是shell进程的子进程,这也就是为什么shell一关闭,在shell中执行的进程都自动被关闭的原因”。

这句话称述的原理和现象各自都是对的。但是其中的逻辑是错的。在unix设计里,kill父进程,子进程会被reparent到父进程的父进程。shell的program之所以会关闭,应该是和shell本身的逻辑实现有关。(比如传输了某种signal给running program)

@jzeng9
Copy link
Author

jzeng9 commented Jun 15, 2020

补充一下真实的机制,是shell的signal handler起到了分发这个signal给每一个前台job的这个逻辑。所以是一个shell的feature,和process的parent relation没有关系。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant