Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does lowercase t means in ps state code

Tags:

linux

ps

When I run ps xaf I have a following output:

ps xaf result

So my application has state code t+. But I can't find what it means. In man ps where is no such state code:

man ps

Does it equal to uppercase T state code? If it is, why do I always only get T state code when I do kill -SIGSTOP <pid>?

like image 722
PepeHands Avatar asked Feb 08 '23 13:02

PepeHands


2 Answers

Not all versions of Linux know about the t code. It was introduced in 2.6.33 as tracing stop that is different from signal stop indicated by T. In the latest versions of proc(5) (2014-07-10 or later) you will find the following:

                    T  Stopped (on a signal) or (before Linux 2.6.33)
                       trace stopped
                    t  Tracing stop (Linux 2.6.33 onward)
                    W  Paging (only before Linux 2.6.0)
                    X  Dead (from Linux 2.6.0 onward)
                    x  Dead (Linux 2.6.33 to 3.13 only)
                    K  Wakekill (Linux 2.6.33 to 3.13 only)
                    W  Waking (Linux 2.6.33 to 3.13 only)
                    P  Parked (Linux 3.9 to 3.13 only)

In addition to the usual R,S,D,Z,T,W status codes.

See the latest version on Michael Kerrisk page.

like image 72
Dmitri Chubarov Avatar answered Feb 11 '23 00:02

Dmitri Chubarov


According to task_state_array[] from kernel sources 't' translates into "tracing stop", while 'T' is just "stopped".

/*
 * The task state array is a strange "bitmap" of
 * reasons to sleep. Thus "running" is zero, and
 * you can test for combinations of others with
 * simple bit tests.
 */
static const char * const task_state_array[] = {
    "R (running)",      /*   0 */
    "S (sleeping)",     /*   1 */
    "D (disk sleep)",   /*   2 */
    "T (stopped)",      /*   4 */
    "t (tracing stop)", /*   8 */
    "X (dead)",     /*  16 */
    "Z (zombie)",       /*  32 */
};
like image 41
molivier Avatar answered Feb 10 '23 22:02

molivier