LINUX PROCESSES


Jim Jackson <jj@franjam.org.uk>


References to use of ps refers to GNU ps

This document can be found at http://www.franjam.org.uk/linux/processes.html


In the Beginning.....


Unix Processes...


Starting A New Unix process...


         |-xterm(778)---bash(782)---vi(1212)
	 
xterm is the parent of bash which in turn is the parent of vi

see http://yolinux.com/TUTORIALS/ForkExecProcesses.html a YoLinux Tutorial on Fork, Exec and Process control


Parental Responsibilities...

see http://www.linuxsa.org.au/tips/zombies.html


The GrandDaddy of them all...


Families of processes...

Why process groups & sessions ? It's mainly to provide job control facilities. For more info see http://www.win.tue.nl/~aeb/linux/lk/lk-10.html


... Complex Processes - Threads...

Some OSes, including other Unixes, have the seperate concept of a process optionally consisting of several seperate threads, or light weight processes. Each thread is part of the same program but are scheduled individually.

Until comparatively recently Linux just had processes, but it provides a more versatile sort of fork, called clone, which allows more control over the relationship between parent and child, allowing them to share memory space, file handles, signals etc and so provide thread facilities using Linux processes

Since Linux 2.4.19 (or so) threads can share the pid of the parent process and have a seperate thread id, tid . Most processes have just the one thread and so their tid is is same as their pid

For more info see http://yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html for a tutorial on POSIX threads usage under Linux.


Some CLI commands for viewing Process data...

ps uax
List all processes given some basic usage on utility use
pstree
Lists processes as a tree showing parental relationships
pstree -p
ditto but showing process numbers (pid)
ps -eo pid,ppid,user,pgid,args --sort pid
list all processes showing process id, parent pid, user name, process grop id and command arguments, sorted by pid
ps -eLf
list all processes showing pid, ppid, tid (LWP), and number of threads in group, NLWP

An example of a thread.....

UID        PID  PPID   LWP  C NLWP STIME TTY          TIME CMD
...
root      1753     1  1753  0    2 Feb27 ?        00:00:01 auditd
root      1753     1  1755  0    2 Feb27 ?        00:00:03 auditd

Notice the same PID but with different LWP (TID).

see the man ps more far more details than you can possible want.


HomePage http://www.franjam.org.uk



This document was generated using AFT v5.095