守护进程 (daemon) 是生存期长的一种进程。在系统引导装入时引导,仅在系统关闭时才终止。
ps查看:
[lyq@ISELAB ~]$ ps -axj
PPID PID PGID SID TTY TPGID STAT UID TIME COMMAND
0 1 1 1 ? -1 Ss 0 52:38 /usr/lib/systemd/systemd --system --deserialize 21
0 2 0 0 ? -1 S 0 0:03 [kthreadd]
2 3 0 0 ? -1 I< 0 0:00 [rcu_gp]
2 4 0 0 ? -1 I< 0 0:00 [rcu_par_gp]
2 6 0 0 ? -1 I< 0 0:00 [kworker/0:0H-events_highpri]
2 9 0 0 ? -1 I< 0 0:00 [mm_percpu_wq]
2 10 0 0 ? -1 S 0 5:08 [ksoftirqd/0]
2 11 0 0 ? -1 I 0 45:01 [rcu_sched]
2 12 0 0 ? -1 S 0 0:11 [migration/0]
2 13 0 0 ? -1 S 0 0:00 [watchdog/0]
2 14 0 0 ? -1 S 0 0:00 [cpuhp/0]
2 15 0 0 ? -1 S 0 0:00 [cpuhp/1]
2 16 0 0 ? -1 S 0 0:01 [watchdog/1]
2 17 0 0 ? -1 S 0 0:08 [migration/1]
man手册中查看 头部 输出的名称:
F (l) Flags (octal and additive) associated with
the process.
S (l) The state of the process.
UID (f,l) The user ID number of the process owner;
the login name is printed under the -f
option.
PID (all) The process ID of the process; it is possi-
ble to kill a process if this datum is
known.
PPID (f,l) The process ID of the parent process.
C (f,l) Processor utilization for scheduling.
PRI (l) The priority of the process; higher numbers
mean lower priority.
NI (l) Nice value; used in priority computation.
ADDR (l) The address of the process.
SZ (l) The size in blocks of the core image of the
process.
WCHAN (l) The event for which the process is waiting
or sleeping; if blank, the process is run-
ning.
STIME (f) Starting time of the process.
TTY (all) The controlling terminal for the process.
TIME (all) The cumulative execution time for the
process.
CMD (all) The command name; the full command name and
its arguments are written under the -f
option.
依赖于OS实现,父进程ID为0的各进程通常是 内核进程,在引导系统时启动(init 是个例外,它是由内核在引导装入时启动的用户层次的命令)。
内核进程通常存在于系统的整个生命期中,以超级用户特权运行,无控制中断,无命令行。
在Linux当中常用的:
kswapd
守护进程,称之为内存换页守护进程。flush
守护进程,在可用内存达到设置的最小阈值时将脏页面冲洗至磁盘。sync_supers
守护进程:定期将文件系统元数据冲洗至磁盘。jbd
守护进程:帮助实现ext4文件系统中的执行功能。rpcbind
守护进程 提供将 远程过程调用 程序号映射为网络端口号。cron
在定期安排的日期和时间执行命令。atd
允许用户在指定的时间执行任务,但是每个任务只执行一次。