Program :In Linux, an executable stored on disk is called a program.
Process :A Program loaded into memory and running is called a process.
Thread :A little processes called LWP (Light Weight Process) or otherwise known as threads which will be runs by Process
When a process is started, it is given a unique number called process ID (PID) that identifies that process to the system.
If you ever need to kill a process, for example, you can refer to it by its PID. Since each PID is unique, there is no ambiguity or risk of accidentally killing the wrong process (unless you enter the wrong PID).
See the list of Process on server
[root@gw-server ~]# ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 Aug03 ? 00:23:18 /usr/lib/systemd/systemd --switched-root --system --deserialize 21
root 2 0 0 Aug03 ? 00:00:05 [kthreadd]
root 3 2 0 Aug03 ? 00:05:11 [ksoftirqd/0]
root 7 2 0 Aug03 ? 00:02:17 [migration/0]
root 8 2 0 Aug03 ? 00:00:00 [rcu_bh]
root 9 2 0 Aug03 ? 01:27:07 [rcu_sched]
Check Name of the Process by PID
[root@gw-server ~]# ls -l /proc/1893/exe
[root@gw-server ~]# ps -e -T | grep <application name or pid>
In above output SPID is thread ID of particular Process 1893, means the process 1893 runs the 15 threads called Light Weight Process (LWP).
Process :A Program loaded into memory and running is called a process.
Thread :A little processes called LWP (Light Weight Process) or otherwise known as threads which will be runs by Process
When a process is started, it is given a unique number called process ID (PID) that identifies that process to the system.
If you ever need to kill a process, for example, you can refer to it by its PID. Since each PID is unique, there is no ambiguity or risk of accidentally killing the wrong process (unless you enter the wrong PID).
See the list of Process on server
[root@gw-server ~]# ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 Aug03 ? 00:23:18 /usr/lib/systemd/systemd --switched-root --system --deserialize 21
root 2 0 0 Aug03 ? 00:00:05 [kthreadd]
root 3 2 0 Aug03 ? 00:05:11 [ksoftirqd/0]
root 7 2 0 Aug03 ? 00:02:17 [migration/0]
root 8 2 0 Aug03 ? 00:00:00 [rcu_bh]
root 9 2 0 Aug03 ? 01:27:07 [rcu_sched]
Total Number of Process running on server
[root@gw-server ~]# ps -ef -T | wc -l
416
Total Number of Process and Threads running on server
[root@gw-server ~]# ps -ef -T | wc -l
783
Check Name of the Process by PID
[root@gw-server ~]# ps -ef | grep 1893
oracle 1893 1 0 Oct28 ? 02:19:03 /oracle/GRID/12102/bin/oraagent.bin
root 25162 18727 0 07:31 pts/1 00:00:00 grep --color=auto 1893
[root@gw-server ~]# ls -l /proc/1893/exe
lrwxrwxrwx 1 oracle oinstall 0 Nov 12 06:02 /proc/1893/exe -> /oracle/GRID/12102/bin/oraagent.bin
How to check the process runs Threads or not ?
[root@gw-server ~]# top -H -p 1893
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1895 oracle 20 0 1213240 55040 22400 S 0.3 0.3 86:45.19 oraagent.bin
1893 oracle 20 0 1213240 55040 22400 S 0.0 0.3 3:20.88 oraagent.bin
1896 oracle 20 0 1213240 55040 22400 S 0.0 0.3 0:05.50 oraagent.bin
1897 oracle 20 0 1213240 55040 22400 S 0.0 0.3 5:12.75 oraagent.bin
1899 oracle 20 0 1213240 55040 22400 S 0.0 0.3 0:05.83 oraagent.bin
1902 oracle 20 0 1213240 55040 22400 S 0.0 0.3 11:50.29 oraagent.bin
1906 oracle 20 0 1213240 55040 22400 S 0.0 0.3 2:29.80 oraagent.bin
1907 oracle 20 0 1213240 55040 22400 S 0.0 0.3 0:00.06 oraagent.bin
1911 oracle 20 0 1213240 55040 22400 S 0.0 0.3 0:00.00 oraagent.bin
1914 oracle 20 0 1213240 55040 22400 S 0.0 0.3 0:00.00 oraagent.bin
1916 oracle 20 0 1213240 55040 22400 S 0.0 0.3 0:52.09 oraagent.bin
1917 oracle 20 0 1213240 55040 22400 S 0.0 0.3 0:01.74 oraagent.bin
23257 oracle 20 0 1213240 55040 22400 S 0.0 0.3 0:00.08 oraagent.bin
2389 oracle 20 0 1213240 55040 22400 S 0.0 0.3 0:01.29 oraagent.bin
28455 oracle 20 0 1213240 55040 22400 S 0.0 0.3 0:00.38 oraagent.bin
[root@gw-server ~]# ps -e -T | grep <application name or pid>
-e show's all processes
-T lists all threads
[root@gw-server ~]# ps -e -T | grep 1893
PID SPID TTY TIME CMD
1893 1893 ? 00:03:20 oraagent.bin
1893 1895 ? 01:26:45 oraagent.bin
1893 1896 ? 00:00:05 oraagent.bin
1893 1897 ? 00:05:12 oraagent.bin
1893 1899 ? 00:00:05 oraagent.bin
1893 1902 ? 00:11:50 oraagent.bin
1893 1906 ? 00:02:29 oraagent.bin
1893 1907 ? 00:00:00 oraagent.bin
1893 1911 ? 00:00:00 oraagent.bin
1893 1914 ? 00:00:00 oraagent.bin
1893 1916 ? 00:00:52 oraagent.bin
1893 1917 ? 00:00:01 oraagent.bin
1893 23257 ? 00:00:00 oraagent.bin
1893 2389 ? 00:00:01 oraagent.bin
1893 28455 ? 00:00:00 oraagent.bin
[root@gw-server ~]#
In above output SPID is thread ID of particular Process 1893, means the process 1893 runs the 15 threads called Light Weight Process (LWP).
Post a Comment