Question about process states, ps and GDB

Question about process states, ps and GDB

Dan Shimshoni danshimsh at gmail.com
Sun Dec 2 14:57:30 IST 2012


hello,

I have a question about process states:

I have this simplified code which I run under gdb.

#include <stdio.h>
int main()
{
int i;
for(i=0; i < 10; i++)
	printf("Hello, world!\n");

pause();
return 0;
}

I build on x86_64 (fedora 17) with gcc -g hello.c -o hello.
And then:

gdb --quiet hello
Reading symbols from /work/dev/t/sec/hello...done.
(gdb) break main
Breakpoint 1 at 0x400534: file hello.c, line 7.
(gdb) run
Starting program: /work/dev/t/sec/hello

Breakpoint 1, main () at hello.c:7
7	for(i=0; i < 10; i++)
Missing separate debuginfos, use: debuginfo-install glibc-2.15-58.fc17.x86_64
(gdb)


Now with "ps aux | grep hello" I see two processes:
root     10310  0.0  0.7 196432 15188 pts/1    S+   14:42   0:00 gdb
--quiet hello
root     10333  0.0  0.0   4108   344 pts/1    t    14:44   0:00
/work/dev/t/sec/hello

S is for  Interruptible sleep

I assume that the "t" is for process state of "TRACED". Am I right?

Strangely, in the man page there is no lowercase "t" for traced (or
anything else),  only "T".

Could it be that this is an error in the man page ?? (strange, it
should have been noticed before)

from "man ps":
...

PROCESS STATE CODES
       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

The man pages are man-pages-3.35-4.fc17.noarc
...

DS



More information about the Linux-il mailing list