# ps
    1 root      3120 S    init
    2 root         0 SW<  [ksoftirqd/0]
    3 root         0 SW   [watchdog/0]
    4 root         0 SW<  [events/0]

STAT의 값들을 보면 ps의 BSD style의 내용과 같다.

Here are the different values that the s, stat and state output specifiers (header "STAT" or "S") will display to
describe the state of a process.
D    Uninterruptible sleep (usually IO)
R    Running or runnable (on run queue)
S    Interruptible sleep (waiting for an event to complete)
T    Stopped, either by a job control signal or because it is being traced.
W    paging (not valid since the 2.6.xx kernel)
X    dead (should never be seen)
Z    Defunct ("zombie") process, terminated but not reaped by its parent.

For BSD formats and when the stat keyword is used, additional characters may be displayed:
<    high-priority (not nice to other users)
N    low-priority (nice to other users)
L    has pages locked into memory (for real-time and custom IO)
s    is a session leader
l    is multi-threaded (using CLONE_THREAD, like NPTL pthreads do)
+    is in the foreground process group

그냥.. 안드로메다 스타일인가? -ㅁ-

아무튼, busybox의 ps에는 priority가 나오지 않는다.
이경우 수작업으로 확인하려면, /proc/{pid}/stat의 19번째 항목을 확인하면 된다.

stat - Status information about the process used by the ps(1) command. Fields are:

1. pid - Process id
2. comm - The executable filename
3. state - R (running), S(sleeping interruptable), D(sleeping), Z(zombie), or T(stopped on a signal).
4. ppid - Parent process ID
5. pgrp - Process group ID
6. session - The process session ID.
7. tty - The tty the process is using
8. tpgid - The process group ID of the owning process of the tty the current process is connected to.
9. flags - Process flags, currently with bugs
10. minflt - Minor faults the process has made
11. cminflt - Minor faults the process and its children have made.
12. majflt
13. cmajflt
14. utime - The number of jiffies (processor time) that this process has been scheduled in user mode
15. stime - in kernel mode
16. cutime - This process and its children in user mode
17. cstime - in kernel mode
18. counter - The maximum time of this processes next time slice.
19. priority - The priority of the nice(1) (process priority) value plus fifteen.
20. timeout - The time in jiffies of the process's next timeout.
21. itrealvalue - The time in jiffies before the next SIGALRM is sent to the process because of an internal timer.
22. starttime - Time the process started after system boot
23. vsize - Virtual memory size
24. rlim - Current limit in bytes of the rss of the process.
25. startcode - The address above which program text can run.
26. endcode - The address below which program text can run.
27. startstack - The address of the start of the stack
28. kstkesp - The current value of esp for the process as found in the kernel stack page.
29. kstkeip - The current 32 bit instruction pointer, EIP.
30. signal - The bitmap of pending signals
31. blocked - The bitmap of blocked signals
32. sigignore - The bitmap of ignored signals
33. sigcatch - The bitmap of catched signals
34. wchan - The channel in which the process is waiting. The "ps -l" command gives somewhat of a list.

[링크 : http://www.comptechdoc.org/os/linux/howlinuxworks/linux_hlproc.html]

# cat /proc/2/stat
2 (ksoftirqd/0) S 1 1 1 0 -1 32832 0 0 0 0 0 332 0 0 10 -5 1 0 5 0 0 4294967295 0 0 0 0 0 0 2147483647 0 0 2314662996 0 0 17 0 0 0

아무튼 이녀석은 -5 nice 값을 가지고, 0보다 우선권을 가지므로 ps에서
<를 출력해서 다른 것들보다 우선순위가 높음을 나타낸다.
Posted by 구차니

댓글을 달아 주세요

Linux2009.11.20 15:46
Kernel Threads

Sometimes the process args will be unavailable; when this is happens, ps will instead print the executable name in brackets.

This is correct, try execl(program_path, NULL) and you will see your process listed in brackets.

[링크 : http://www.linuxquestions.org/questions/linux-newbie-8/square-brackets-in-output-of-ps-aux-not-matching-output-of-ps-ejh-716134/]

Low PIDs. Very perceptive of you. Low PIDs usually denote a process started by init on boot

[링크 : http://www.linuxquestions.org/questions/linux-general-1/ps-process-names-in-brackets-644364/]

딱히 이렇다할 편한 대답은 없는데..
아무튼 부팅시에 구동된 낮은 번호의 PID를 지는 프로세스와, (낮은 숫자가 아니어도.. 되긴한다)
 root     29953    11  0 Nov17 ?        00:00:00     [pdflush]
커널 쓰레드가 []를 둘러 싼다고 하는데
 root      1936     1  0 Oct05 ?        00:00:12   [nfsd]

일단은 전반적으로 root가 돌리는 데몬 프로세스 라는 유사성이 있다.
자세한 내용은 나중에 검색해서 추가해야겠다.
Posted by 구차니

댓글을 달아 주세요

Linux2009.11.20 15:26
state     The state is given by a sequence of characters, for example, "RWNA". The first character indicates the run state of the process:

D     Marks a process in disk (or other short term, uninterruptible) wait.
I     Marks a process that is idle (sleeping for longer than about 20 seconds).
L     Marks a process that is waiting to acquire a lock.
R     Marks a runnable process.
S     Marks a process that is sleeping for less than about 20 seconds.
T     Marks a stopped process.
W     Marks an idle interrupt thread.
Z     Marks a dead process (a "zombie").

Additional characters after these, if any, indicate additional state information:

+     The process is in the foreground process group of its control terminal.
<     The process has raised CPU scheduling priority.
E     The process is trying to exit.
J     Marks a process which is in jail(2). The hostname of the prison can be found in /proc/<pid/status>.
L     The process has pages locked in core (for example, for raw I/O).
N     The process has reduced CPU scheduling priority (see setpriority(2)).
s     The process is a session leader.
V     The process is suspended during a vfork(2).
W     The process is swapped out.
X     The process is being traced or debugged.

[링크 : http://www.gsp.com/cgi-bin/man.cgi?section=1&topic=ps]

Posted by 구차니

댓글을 달아 주세요

  1. kill -9 2mb

    2009.11.20 15:30 [ ADDR : EDIT/ DEL : REPLY ]
    • 프로세스 이름이 숫자로 시작하면 알흠답지 못하죠 ㅋ

      kill -9 MBLee.no.barin

      2009.11.20 15:46 [ ADDR : EDIT/ DEL ]