UNIX Chapter 2 Process
UNIX Chapter 2 Process
Chapter 2
Process
Initializing a process
Types of Processes
- When the parent process is killed before the termination of the child process,
the child processes become orphan processes.
- When a process is killed but still shows its entry in the process status or the
process table is called a zombie process
- They are dead and are not used
3) Daemon process
- Processes that start at system startup and keep running are called daemon
processes or daemons.
- System related background processes that often run with the permissions of
root and services requests from other processes
- Run in the background
- When ps -ef is executed the process with? in the tty field are daemon
processes.
Process Status(ps)
- Fields described by ps are described as:
uid: user id that this process belongs to (the person running it)
pid: Process ID
ppid: Parent process ID (the ID of the process that started it)
c: CPU utilization of process
stime: Process start time
tty: Terminal type associated with the process
time: CPU time is taken by the process
cmd: command that started the process
-a: Shows information about all users
-x: Shows information about processes without terminals
-u: Shows additional information like -f option
-e: Displays extended information
Process Commands
- Kill to terminate a process (Program)
- ?? $$ variable will hold your current process id
- ?? $PPID contains the parent PID
- Monitoring Process
ps: display process running in the current shell
ps -e: display running daemons
ps -f: display processes with full option (Extra information about a process
PID)
ps -l: list more information on process
ps -lp <PID>: specific information for process id
ps -ef: display all processes and daemon on ttys
Ps -elf: to show threads alongside process
Ps -eH = indentation
ps -e --format pid,user,args,c
ps -e --format pid,user,args,c --sort c
ps -e --format pid,user,args,c --sort -c
Ps -U root
ps -e --format user,pid,c,tty,cmd --sort c
- Monitoring Process in real time
Top
In top
❖ 1: number of cpus and usage
❖ 1 & t: solid bar view
❖ m: memory statistics
❖ R: to change the nice value of process
❖ F: filed management
❖ S: to change sort field
❖ Shift + U