QUESTION MARK ? PROCESS IN LINUX

When we check a process in linux , we sometimes see this weird ‘?’ symbol as the terminal.

Below example shows multiple process with ‘?’ as terminal which are parallel process spawned by database system.

[oracle@exdbadm01 ~]$ ps -ef|grep 'ora_p0'
oracle   13577     1  0 Jun07 ?        00:00:02 ora_p000_exdbx1
oracle   13579     1  0 Jun07 ?        00:00:00 ora_p001_exdbx1
oracle   13581     1  0 Jun07 ?        00:00:00 ora_p002_exdbx1
oracle   13583     1  0 Jun07 ?        00:00:00 ora_p003_exdbx1
oracle   13588     1  0 Jun07 ?        00:00:00 ora_p004_exdbx1
oracle   13590     1  0 Jun07 ?        00:00:00 ora_p005_exdbx1
oracle   13592     1  0 Jun07 ?        00:00:00 ora_p006_exdbx1
oracle   13594     1  0 Jun07 ?        00:00:00 ora_p007_exdbx1
oracle   13596     1  0 Jun07 ?        00:00:00 ora_p008_exdbx1
oracle   13598     1  0 Jun07 ?        00:00:00 ora_p009_exdbx1
oracle   13600     1  0 Jun07 ?        00:00:00 ora_p010_exdbx1
oracle   13602     1  0 Jun07 ?        00:00:00 ora_p011_exdbx1
oracle   13604     1  0 Jun07 ?        00:00:00 ora_p012_exdbx1
oracle   13606     1  0 Jun07 ?        00:00:00 ora_p013_exdbx1
oracle   13608     1  0 Jun07 ?        00:00:00 ora_p014_exdbx1
oracle   13612     1  0 Jun07 ?        00:00:00 ora_p015_exdbx1
oracle   13616     1  0 Jun07 ?        00:00:00 ora_p016_exdbx1
oracle   13618     1  0 Jun07 ?        00:00:00 ora_p017_exdbx1
oracle   13620     1  0 Jun07 ?        00:00:00 ora_p018_exdbx1
oracle   13622     1  0 Jun07 ?        00:00:00 ora_p019_exdbx1
oracle   13624     1  0 Jun07 ?        00:00:00 ora_p020_exdbx1
oracle   13626     1  0 Jun07 ?        00:00:00 ora_p021_exdbx1
oracle   13628     1  0 Jun07 ?        00:00:00 ora_p022_exdbx1
oracle   13630     1  0 Jun07 ?        00:00:00 ora_p023_exdbx1
oracle   13632     1  0 Jun07 ?        00:00:00 ora_p024_exdbx1
oracle   13634     1  0 Jun07 ?        00:00:00 ora_p025_exdbx1

This means that the process is not run by any interactive user or from any user terminal.

The process is executed by any application module or daemon process or parallel process or scripts or background ..

If the user run a script from a terminal interactively or in background, then we will see the terminal as pts/0 ,pts/1 …etc

If we filter with pts , we can see the commands that we run recently on our terminal

[oracle@exdbadm01 trace]$ ps -ef|grep 'pts'
root      4882  2827  1 Jun07 ?        00:02:33 sshd: root@pts/0
root      4889  4882  0 Jun07 pts/0    00:00:00 -bash
root      5504  4889  0 Jun07 pts/0    00:00:00 su - oracle
oracle    5505  5504  0 Jun07 pts/0    00:00:00 -bash
oracle    6620  5505  0 Jun07 pts/0    00:00:00 sqlplus / as sysdba
oracle    9695  5505  0 Jun07 pts/0    00:00:00 top
oracle    9927  5505  0 Jun07 pts/0    00:00:00 top
oracle   10395  5505  0 Jun07 pts/0    00:00:00 top
oracle   10425  5505  0 Jun07 pts/0    00:00:00 top
oracle   10620  5505  0 Jun07 pts/0    00:00:00 top
oracle   10673  5505  0 Jun07 pts/0    00:00:01 top
oracle   12923  5505  0 Jun07 pts/0    00:00:00 top
oracle   14446  5505  0 Jun07 pts/0    00:00:00 top
oracle   14800  5505  0 00:02 pts/0    00:00:00 top

Here we need to know what is tty and pts .Below are the output from man page

man pts
DESCRIPTION


ptmx and pts - pseudo-terminal master and slave
       The file /dev/ptmx is a character file with major number 5 and minor number 2, usually of mode 0666
       and owner.group of root.root.  It is used to create a pseudo-terminal master and slave pair.

       When a process opens /dev/ptmx, it gets a file descriptor for a pseudo-terminal master (PTM), and a
       pseudo-terminal  slave  (PTS)  device  is  created  in the /dev/pts directory. Each file descriptor
       obtained by opening /dev/ptmx is an independent PTM with its own associated PTS, whose path can  be
       found by passing the descriptor to ptsname(3).

       Before  opening the pseudo-terminal slave, you must pass the master’s file descriptor to grantpt(3)
       and unlockpt(3).

       Once both the pseudo-terminal master and slave are open,  the  slave  provides  processes  with  an
       interface that is identical to that of a real terminal.

       Data written to the slave is presented on the master descriptor as input.  Data written to the mas-
       ter is presented to the slave as input.

       In practice, pseudo-terminals are used for implementing terminal emulators  such  as  xterm(1),  in
       which data read from the pseudo-terminal master is interpreted by the application in the same way a
       real terminal would interpret the data, and for implementing remote-login programs such as sshd(8),
       in  which  data read from the pseudo-terminal master is sent across the network to a client program
       that is connected to a terminal or terminal emulator.

       Pseudo-terminals can also be used to send input to programs that normally refuse to read input from
       pipes (such as su(8), and passwd(8)).

FILES
       /dev/ptmx, /dev/pts/*
man tty
NAME
       tty - print the file name of the terminal connected to standard input

SYNOPSIS
       tty [OPTION]...

DESCRIPTION
       Print the file name of the terminal connected to standard input.

       -s, --silent, --quiet
              print nothing, only return an exit status

       --help display this help and exit

       --version
              output version information and exit

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s