PROCESS TYPES
FOREGROUND (FG) / BACKBROUND
(BG)
- bg is used in mount option in /etc/vfstab to mount remote shared
mounts in background, if it unmounted / mountd is not working
- fg mount is default
Let’s have some example …
root@sol-test-2:>/# find ./ -name core &
[1] 27816
root@sol-test-2:>/# find ./ -name statsrep &
[2] 27817
root@sol-test-2:>/# find ./ -name nautilus &
[3] 27818
OK… I initiated 3
processes and send them in background
root@sol-test-2:>/# jobs
[4]- Stopped prstat -c -n4 2 100
[5]+ Stopped prstat -c -n4 2 100
[6] Running find ./ -name core &
[7] Running find ./ -name statsrep &
[8] Running find ./ -name nautilus &
Here all 3 are running
in background with their job id i.e. [6] [7] [8]
root@sol-test-2:>/# fg %8
find ./ -name nautilus
./hgfs/VM_SHARE/x86/nmap-6.40/nmap-6.40/zenmap/radialnet/core
^Z
[8]+ Stopped find ./ -name nautilus
Now I tried to move the
job id 8 in foreground, well it came but now I don’t want it so I did crl+z
(suspend)
We can see the same in
o/p that job id 8 is stopped
root@sol-test-2:>/# jobs
[4] Stopped prstat -c -n4 2 100
[5]- Stopped prstat -c -n4 2 100
[6] Running find ./ -name core &
[7] Running find ./ -name statsrep &
[8]+ Stopped find ./ -name nautilus
root@sol-test-2:>/#
./hgfs/VM_SHARE/x86/nmap-6.40/nmap-6.40/zenmap/radialnet/core
[6] Exit 1 find ./ -name core
Again ctrl+c
root@sol-test-2:>/# jobs
[4] Stopped prstat -c -n4 2 100
[5]- Stopped prstat -c -n4 2 100
[8]+ Stopped find ./ -name nautilus
root@sol-test-2:>/# bg %8
[8]+ find ./ -name nautilus &
root@sol-test-2:>/# ./usr/include/nautilus
./etc/gconf/gconf.xml.defaults/schemas/apps/nautilus
./etc/gconf/gconf.xml.defaults/apps/nautilus
find: stat() error ./proc/27847/fd/54: No such file or directory
find: stat() error ./proc/27847/fd/55: No such file or directory
find: stat() error ./proc/27847/fd/59: No such file or directory
./.gconf/apps/nautilus
Due to ctrl+z the job
id 8 was stopped , now I want it to run again
root@sol-test-2:>/# jobs
[4]- Stopped prstat -c -n4 2 100
[5]+ Stopped prstat -c -n4 2 100
[8] Running find ./ -name nautilus &
Now it is running
root@sol-test-2:>/# kill %8
Now I don’t want this
process anymore
root@sol-test-2:>/# jobs
[4]- Stopped prstat -c -n4 2 100
[5]+ Stopped prstat -c -n4 2 100
[8] Terminated find ./ -name nautilus
SIGNALS
OK… have seen several action movies…
In those movies some Police man’s follow
Police manual and some are deadly Police Man’s
“ no FIR no ARREST… execution on the SPOT “
I am just telling these to understand between
2 kill signals
Kill -9 <pid>
Kill -15 <pid>
Kill -9 is
the deadly police man… just take the gun and fire from point blank range
Kill -15 is
very gentle, following police manual… that first warn the criminal, then chase
the criminal if he starts running, then do a fire in air and finally if
required shoot him under his knees ( and u know…usually criminals never gives a
shit about these type of police man’s)
So the processes treat this signal in same way…
this is default
If
we fire
Kill
<pid>
means we are sending SIG-TERM 15 to the Process, that hey Process
Bro..
plz shut your self … and the process replies go to hell…
I think u understand
the difference very well between these two.
There are total 45
signals (1-45)
Some commonly used are,
Kill -2
<pid> [SIGINIT = interrupts the
process, ctrl+c]
Kill -24 <pid>
[SIG-STOP = stop/suspend requested by user, ctrl+z]
No comments:
Post a Comment