'busybox ps'에 해당되는 글 1건

  1. 2010.01.12 busybox ps는 BSD 스타일?
프로그램 사용/busybox2010. 1. 12. 13:39
# 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 구차니