gpt4 book ai didi

linux - 守护进程和孤儿进程之间的区别?

转载 作者:太空狗 更新时间:2023-10-29 11:49:58 25 4
gpt4 key购买 nike

我对守护进程和孤儿进程感到困惑。据我了解:

Daemon Process: "These are special processes that run in background. They are system related process that have no associated terminal.These processes run with root permissions and usually provide services to processes.Usually parent process will terminates and hence child process will become a daemon process as it wont have any terminal.For daemon process, init process will become a parent process"

Orphan Process: "when parent process gets killed before child process terminates, then that process becomes an orphan process. In that case the child processes become orphan and then taken under by the init process."

孤儿进程是守护进程,反之亦然吗?如果不是,它们之间的基本区别是什么?

最佳答案

一个并不严格地暗示另一个:只需将守护进程视为有意孤立的进程。它们旨在在没有父进程的情况下工作,但这并不适用于每个孤立进程!

It is sometimes desirable to intentionally orphan a process, usually to allow a long-running job to complete without further user attention, or to start an indefinitely running service or agent; such processes (without an associated session) are known as daemons, particularly if they are indefinitely running

只要把守护进程想象成做肮脏工作的“奴隶”:你故意把它们放在你的视线之外,但并不是所有离开你视线的东西都是有意或特别想要的;)

我认为维基百科在这种情况下足以满足您的困境:https://en.wikipedia.org/wiki/Orphan_process

关于linux - 守护进程和孤儿进程之间的区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42015522/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com