UNIX下喚醒進(jìn)程
在Solaris下面做的實(shí)驗(yàn)
man kill
man ps
man signal.h
方便起見(jiàn),先alias一下ps,讓它顯示進(jìn)程號(hào),父進(jìn)程號(hào),進(jìn)程狀態(tài),TTY,CPU時(shí)間,進(jìn)程參數(shù)
bash-3.2$ alias ckps="ps -o pid,ppid,s,tty,time,args"
拿same-gnome做實(shí)驗(yàn)
bash-3.2$ same-gnome
^Z
[2]+ Stopped same-gnome
看一下當(dāng)前進(jìn)程狀態(tài)
bash-3.2$ ckps
PID PPID S TT TIME COMMAND
12399 6868 S pts/7 00:00 bash
12591 12399 T pts/7 00:01 same-gnome
12592 12591 T pts/7 00:00 same-gnome
12594 12399 O pts/7 00:00 ps -o pid,ppid,s,tty,time,args
ckps的結(jié)果顯示,same-gnome(Pid:12591,12592)處于T(Terminated)狀態(tài)。
用25號(hào)信號(hào)喚醒same-gnome (man signal.h)
bash-3.2$ kill -25 12591 12592
再ckps一下
bash-3.2$ ckps
PID PPID S TT TIME COMMAND
12399 6868 S pts/7 00:00 bash
12596 12399 O pts/7 00:00 ps -o pid,ppid,s,tty,time,args
12591 12399 S pts/7 00:01 same-gnome
12592 12591 S pts/7 00:00 same-gnome
same-gnome的狀態(tài)變成S(Sleeping)了,又可以玩老。
AIX用戶(hù)進(jìn)程狀態(tài)
用戶(hù)進(jìn)程
描述
O
Nonexist
A
Active
W
Swapped
I
Idle(Waiting for startup)
Z
Canceled
T
Stopped
Solaris用戶(hù)進(jìn)程狀態(tài)
O Process is running on a processor.
S Sleeping: process is waiting for an event
to complete.
R Runnable: process is on run queue.
T Process is stopped, either by a job con-
trol signal or because it is being
traced.
W Waiting: process is waiting for CPU usage
to drop to the CPU-caps enforced limits.
Z Zombie state: process terminated and
parent not waiting.