SYSTEM
PROCESSES
Well… Process that is running on system is called System Process… Ha
ha hah…
OK…OK… sorry for the excellent explanation… but it is more or less
TRUE,
First what is Process?
Any running Program … right?
Fine and that running program can run anywhere a/c to requirement,
here it is running on system so it’s called SYSTEM PROCESSES.
How do we identify a process? Simple question… just as any
organization identifies their employees … by employee id. It’s same here but
called Process ID (every running Pr. Has a unique PID)
A process can create another process called child process and the
initiator will obviously Parent process.
The Process of creating new process (child) from existing (parent) is
called FORKING.
Most Processes in the system are created by “FORK SYSTEM CALLS” , fork
system calls causes the current process to be split into 2 processes… parent
& child
The child process continues to execute on the CPU till completion,
after completion it returns all resources back to system.
While running child process, parent pr. either waits for child’s
completion or continues to execute, if it is executing it will periodically
checks for the completion of child process.
A process goes under many changes during its lifespan…
PROCESS STATES,
[R] ready/runnable
it is ready to execute whenever cpu time is available, it
means it has already taken all the
required resources, just waiting for the green signal by cpu.
[O] running
pr.
Is running
[S] sleeping
My
child is still playing outside so getting bored by waiting and feeling sleepy
Or
I am
ready to cook but there is no rice & vegetables, means pr. Is waiting for
resources
[Z] zombie
Ohhh…
Zombies!!! Well zombies doesn’t always mean Resident Evil, Here it is
A phase in which papa
is waiting for son to come back after play and son returned home from back door
and papa still waiting, no body at home told papa that hey papa child has
returned.
It means that child pr.
Is terminated but its entry is not removed from process table, until the parent
acknowledges the death of child pr by executing the “wait” system call… also
known as “ DEFUNCT PROCESSES”
[W] waiting
Pr. Is waiting for cpu usage to drop
to the cpu-caps enforced limits.
[T] traced
Son
goes missing, papa is searching for him and filed a complaint also… so police
Has found
son and keep him with them.
Pr. Was
stopped by a signal b’coz parent is tracing it,
Son was
stopped by police b’coz papa is searching / tracing him.
OK…OK… enough with theory… but there is only theory …. Well let’s see
some commands
root@sol-test-2:>/# ps
PID TTY TIME CMD
27729 pts/2 0:00 ps
27717 pts/2 0:00 bash
27728 pts/2 0:02 mkfile
root@sol-test-2:>/#
ps
it gives the details about that particular terminal or user on that
terminal only
root@sol-test-2:>/# ps -ef
UID PID
PPID C STIME TTY TIME CMD
root 0
0 0 Aug 16 ? 29:25 sched
root 1
0 0 Aug 16 ? 0:01 /sbin/init
root 2
0 0 Aug 16 ? 0:00 pageout
root 3
0 0 Aug 16 ? 4:42 fsflush
root 4
0 0 Aug 16 ? 0:00 vmtasks
root 380
8 0 Aug 16 console 0:00 /usr/lib/saf/ttymon -g -d
/dev/console -l console -m ldterm,ttcompat -h -p sol-
root 8
1 0 Aug 16 ? 0:07 /lib/svc/bin/svc.startd
root 10
1 0 Aug 16 ? 0:11 /lib/svc/bin/svc.configd
root 27116 27115 0
Aug 17 ? 0:03
/usr/lib/autofs/automountd
root 417
416 0 Aug 16 ? 0:00 /usr/sadm/lib/smc/bin/smcboot
root 149
1 0 Aug 16 ? 0:00 /usr/lib/power/powerd
root 120
1 0 Aug 16 ? 0:00 /usr/lib/sysevent/syseventd
root 237
1 0 Aug 16 ? 0:00 /lib/svc/method/iscsi-initiator
|
|
o/p
removed
|
|
So what this
Ps –ef is telling ?
-e Lists
information about every process on the system.
-f Generates
a full listing.
-l Generates
a long listing.
UID PID PPID
C STIME TTY TIME CMD
UID by which user this pr is running
PID what is the pr. Id of that process
PPID parent process id
C Processor utilization for
scheduling (obsolete)
STIME starting time of
process (HH:MM:SS) (A process begun more than twenty-four hour before the ps
inquiry is executed is given in
months and days.)
TTY The assigned
terminal to the process, ? marked processes has no terminal assigned
TIME Cumulative CPU
time used by process (MM:SS)
CMD command that
generated the process
root@sol-test-1:>/# ps -el
F S UID
PID PPID C PRI NI
ADDR SZ WCHAN TTY TIME CMD
1 T 0
0 0 0 0
SY ? 0
? 0:23 sched
0 S 0
1 0 0 40
20 ? 636
? ? 0:01 init
1 S 0
2 0 0 0
SY ? 0
? ? 0:02 pageout
1 S 0
3 0 0 0
SY ? 0
? ? 3:25 fsflush
1 S 0
4 0 0 0
SD ? 0
? ? 0:00 vmtasks
0 S 1
354 1 0 40
20 ? 705
? ? 0:00 statd
0 S 0
8 1 0 40
20 ? 3159
? ? 0:12 svc.star
0 S 0
10 1 0 40
20 ? 2863
? ? 0:16 svc.conf
||||||||
o/p removed
||||||||
OK.. now what's the ps –el
F S UID
PID PPID C PRI NI
ADDR SZ WCHAN TTY TIME CMD
F flags associated with the processes (useless column)
S process status (i.e. O, S, R, Z, T, W)
UID
PID
PPID
C
PRI priority of
process [without –c (higher value – lower priority)]
[with –c (higher value – higher
priority)]
NI Nice Value,
means scheduling priority… I want to make this process nicer means I have to
Lower the nice
value
ADDR memory address of
the process
SZ SIZE
FIELD-total no. of pages in Process (root@sol-test-1:>/#
pagesize)
WCHAN The address of an
event for which the process is sleeping (if there is just – in this field means that the
process is running)
The Memory address for sleeping process events (WCHAN) , which is <hex no>
for PID <pid>
TTY
TIME
CMD
for PID <pid>
TTY
TIME
CMD
PROCESS GREP (pgrep)
ps + grep = pgrep
root@sol-test-2:>/#pgrep sendmail
940
939
ps + grep = pgrep
root@sol-test-2:>/#pgrep sendmail
940
939
root@sol-test-2:>/#pgrep rpcbind
338
338
PROCESS STATISTICS SUMMARY
( prstat )
Info remains on
the screen and updated periodically
#prstat
#prstat
<option> <interval in sec.> <count>
Options:
-a displays separate reports about process
and users at same time
-c do not overwrite old one, just print the
new ones beneath
-u uid
-n restricts the no. of o/p lines
root@sol-test-2:>/#
prstat
PID
USERNAME SIZE
RSS STATE PRI NICE TIME
CPU PROCESS/NLWP
671
root
8056K 5024K sleep 59 0
0:05:13 0.1% vmtoolsd/1
27777
root 3752K 2864K cpu0 39
0 0:00:00 0.0% prstat/1
937
noaccess 160M
146M sleep 59 0
0:03:49 0.0% java/18
811
root 27M
12M sleep 59 0
0:01:09 0.0% Xorg/1
895
root 11M 5732K sleep 59
0 0:02:05 0.0% dtgreet/1
27717
root 3012K 1732K sleep 49
0 0:00:00 0.0% bash/1
=============== o/p removed ===============
root@sol-test-2:>/#
prstat -a
PID USERNAME
SIZE RSS STATE PRI NICE
TIME CPU PROCESS/NLWP
27778 root
3752K 2872K cpu2 49 0
0:00:00 0.1% prstat/1
671 root
8056K 5024K sleep 59 0
0:05:13 0.0% vmtoolsd/1
937 noaccess
160M 146M sleep 59
0 0:03:49 0.0% java/18
895 root 11M 5732K sleep 59
0 0:02:05 0.0% dtgreet/1
=============== o/p removed ===============
NPROC
USERNAME SWAP RSS MEMORY TIME
CPU
41 root 78M
80M 7.8% 0:18:10 0.1%
1 noaccess
154M 147M 14%
0:03:49 0.0%
1 t2user2
452K 1328K 0.1% 0:00:00 0.0%
1 smmsp
1476K 4012K 0.4% 0:00:01 0.0%
6 daemon
7112K 6144K 0.6% 0:00:00 0.0%
=============== o/p removed ===============
Total:
50 processes, 345 lwps, load averages: 0.04, 0.03, 0.02
root@sol-test-2:>/# prstat -u root -n4 2 5
show me the process statics summary of user root but display only 4
lines with 2 second interval and repeat this for 5 times
root@sol-test-2:>/# prstat
PID USERNAME SIZE RSS STATE
PRI NICE TIME CPU PROCESS/NLWP
PID
USERNAME
SIZE The total virtual memory size of the
process in kilobytes (K), megabytes (M), or gigabytes (G)
RSS The
resident set size of the process in kilobytes (K), megabytes (M), or gigabytes
(G)
(Physical Mem)
STATE The state of the process
cpu The
process is running on the CPU.
sleep The process is waiting for an event
to complete.
run The process is in the run queue.
Zombie The process has terminated, and the
parent is not waiting.
stop The process is stopped.
PRI The priority of the process
NICE The value used in priority computation
TIME The cumulative execution time for the
process
CPU The percentage of recent CPU time used by
the process
PROCESS The name of the process
NLWP The number of lightweight processes (LWPs)
or threads in the process
NOW I want only Particular stats
root@sol-test-2:>/# prstat -s rss
root@sol-test-2:>/# prstat -s cpu
root@sol-test-2:>/# prstat -s size
root@sol-test-2:>/# prstat -s pri
root@sol-test-2:>/# prstat -s time
root@sol-test-2:>/# prstat –a
root@sol-test-2:>/# prstat –t
Provides complete user’s resource utilization
root@sol-test-2:>/# prstat –Z
Provides summary per local zone
REAP A ZOMBIE PROCESS,,
WOOO… zombies again… kill them kill them …. but how ?
root@sol-test-1:>/# ps -ef |grep -i z
Unfortunately I don’t have any zombies in my system… but this will
list them if any
Just find their PID and
#preap <pid>
STOP & RESUME ANY
PROCESS,,
#pstop <pid>
#prun <pid>
GUI,,
#smc &
This Comp – System Status – Processes
No comments:
Post a Comment