fashionstyle 发表于 2008-05-06 15:10

唤醒进程


                                                UNIX下唤醒进程
在Solaris下面做的实验
man kill
man ps
man signal.h
方便起见,先alias一下ps,让它显示进程号,父进程号,进程状态,TTY,CPU时间,进程参数
bash-3.2$ alias ckps="ps -o pid,ppid,s,tty,time,args"
拿same-gnome做实验
bash-3.2$ same-gnome

^Z
+Stopped               same-gnome
看一下当前进程状态
bash-3.2$ ckps
PID   PPIDS TT    TIMECOMMAND
12399 6868S 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的结果显示,same-gnome(Pid:12591,12592)处于T(Terminated)状态。
用25号信号唤醒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的状态变成S(Sleeping)了,又可以玩老。
AIX用户进程状态
用户进程
描述
O
Nonexist
A
Active
W
Swapped
I
Idle(Waiting for startup)
Z
Canceled
T
Stopped
Solaris用户进程状态
    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 jobcon-
         trol   signalorbecauseitisbeing
         traced.
    W    Waiting: process is waiting for CPU usage
         to drop to the CPU-caps enforced limits.
    Z    Zombiestate:processterminated   and
         parent not waiting.
               
               
               
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/55258/showart_677736.html
页: [1]
查看完整版本: 唤醒进程