进程状态:

创建状态:进程在创建时需要申请一个空白PCB,向其中填写控制和管理进程的信息,完成资源分配。如果创建工作无法完成,比如资源无法满足,就无法被调度运行,把此时进程所处状态称为创建状态
就绪状态:进程已经准备好,已分配到所需资源,只要分配到CPU就能够立即运行
执行状态:进程处于就绪状态被调度后,进程进入执行状态
阻塞状态:正在执行的进程由于某些事件(I/O请求,申请缓存区失败)而暂时无法运行,进程受到阻塞。在满足请求时进入就绪状态等待系统调用
终止状态:进程结束,或出现错误,或被系统终止,进入终止状态。无法再执行
查看进程:ps au
[root@master ~]# ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 194248 7380 ? Ss Aug07 0:30 /usr/lib/systemd/systemd --switched-root --system --deserialize 22
root 2 0.0 0.0 0 0 ? S Aug07 0:00 [kthreadd]
root 4 0.0 0.0 0 0 ? S< Aug07 0:02 [kworker/0:0H]
root 6 0.0 0.0 0 0 ? S Aug07 0:40 [ksoftirqd/0]
root 7 0.0 0.0 0 0 ? S Aug07 0:00 [migration/0]
root 8 0.0 0.0 0 0 ? S Aug07 0:00 [rcu_bh]
root 9 0.7 0.0 0 0 ? S Aug07 22:22 [rcu_sched]
root 10 0.0 0.0 0 0 ? S< Aug07 0:00 [lru-add-drain]
root 11 0.0 0.0 0 0 ? S Aug07 0:03 [watchdog/0]
root 12 0.0 0.0 0 0 ? S Aug07 0:05 [watchdog/1]
root 13 0.0 0.0 0 0 ? S Aug07 0:06 [migration/1]
root 14 0.0 0.0 0 0 ? S Aug07 0:29 [ksoftirqd/1]
root 16 0.0 0.0 0 0 ? S< Aug07 0:00 [kworker/1:0H]
root 17 0.0 0.0 0 0 ? S Aug07 0:11 [watchdog/2]
root 18 0.0 0.0 0 0 ? S Aug07 0:00 [migration/2]
查看进程的线程:
ps au -m
[root@master ~]# ps aux -m
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 194248 7380 ? - Aug07 0:30 /usr/lib/systemd/systemd --switched-root --system --deserialize 22
root - 0.0 - - - - Ss Aug07 0:30 -
root 2 0.0 0.0 0 0 ? - Aug07 0:00 [kthreadd]
root - 0.0 - - - - S Aug07 0:00 -
root 49911 0.0 0.0 708380 7492 ? - Aug08 0:10 containerd-shim -namespace moby -workdir /var/lib/docker/containerd/daemon/io.contain
root - 0.0 - - - - Sl Aug08 0:00 -
root - 0.0 - - - - Sl Aug08 0:03 -
root - 0.0 - - - - Sl Aug08 0:00 -
root - 0.0 - - - - Sl Aug08 0:00 -
root - 0.0 - - - - Sl Aug08 0:00 -
root - 0.0 - - - - Sl Aug08 0:00 -
root - 0.0 - - - - Sl Aug08 0:01 -
root - 0.0 - - - - Sl Aug08 0:02 -
root - 0.0 - - - - Sl Aug08 0:01 -
root 49929 0.0 0.0 2300 352 ? - Aug08 0:04 /usr/bin/tini -- /usr/local/bin/jenkins.sh
root - 0.0 - - - - Ss Aug08 0:04 -
root 49957 2.2 25.0 7877576 2001484 ? - Aug08 17:27 java -Duser.home=/var/jenkins_home -Djenkins.model.Jenkins.slaveAgentPort=50000 -Dhud
root - 0.0 - - - - Sl Aug08 0:00 -
root - 0.0 - - - - Sl Aug08 0:05 -
root - 0.0 - - - - Sl Aug08 0:03 -
root - 0.0 - - - - Sl Aug08 0:00 -
root - 0.0 - - - - Sl Aug08 0:17 -
root - 0.0 - - - - Sl Aug08 0:00 -
root - 0.2 - - - - Sl Aug08 1:38 -
root - 0.0 - - - - Sl Aug08 0:09 -
进程相关其他命令
[root@master ~]# jobs 查看停止状态的进程
[root@master ~]# bg # 运行暂停的进程
2694

被折叠的 条评论
为什么被折叠?



