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

标签 linux process operating-system daemon orphan

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

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/

相关文章:

python - Tkinter,透明背景,Linux

c - 函数定义的 C 语法是什么

c++ - Bash 在子 shell 中的后台运行命令

java - 如何从java应用程序在xterm shell中运行 "hg clone"命令?

c - 如何使 Ubuntu 命令在 Windows 上运行

operating-system - 是否可以不使用一行 C/C++ 代码来编写整个操作系统?

c - 如果一个不可重入的 linux 函数(比如 select)没有完成执行会发生什么?

c++ - 使用 libcurl - 摘要身份验证执行 HTTP POST,使用curl_easy_send\curl_easy_recv

c - ShellExecute 挂起模式

memory-management - 现代操作系统上的内存分段 : why do you need 4 segments?