Birmingham mumbai



Download 15,21 Mb.
Pdf ko'rish
bet235/482
Sana13.01.2022
Hajmi15,21 Mb.
#355107
1   ...   231   232   233   234   235   236   237   238   ...   482
Bog'liq
Mastering Ubuntu Server Gain expertise in the art of deploying, configuring, managing, and troubleshooting Ubuntu Server by Jay LaCroix (z-lib.org)

[
 177 
]
To better understand what the 
kill
 command does, you first will need to understand 
the basics of 
Linux Signals
. Signals are used by both administrators and developers 
and can be sent to a process either by the kernel, another process, or manually with 
a command. A signal instructs the process of a request or change, and in some cases
to completely terminate. An example of such a signal is 
SIGHUP
, which tells processes 
that their controlling terminal has exited. One situation in which this may occur is 
when you have a terminal emulator open, with several processes inside it running. If 
you close the terminal window (without stopping the processes you were running), 
they'll be sent the 
SIGHUP
 signal, which basically tells them to quit (essentially, it 
means the shell quit or hung up).
Other examples include 
SIGINT
 (where an application is running in the foreground 
and is stopped by pressing 
Ctrl
 + 
c
 on the keyboard) and 
SIGTERM
, which, when sent 
to a process, asks it to cleanly terminate. Yet another example is 
SIGKILL
, which 
forces a process to terminate uncleanly. In addition to a name, each signal is also 
represented by a value, such as 
15
 for 
SIGTERM
 and 
9
 for 
SIGKILL
. Going over each 
of the signals is beyond the scope of this chapter (the advanced topics of signals are 
mainly only useful for developers), but you can view more information about them 
by consulting the man page if you're curious:
man 7 signal 
For the purposes of this section, the two types of signals we are most concerned 
about are 
SIGTERM(15)
 and 
SIGKILL(9)
. When we want to stop a process, we send 
one of these signals to it, and the 
kill
 command allows us to do just that. By default, 
the 
kill
 command sends signal 
15
 (
SIGTERM
), which tells the process to cleanly 
terminate. If successful, the process will free its memory and gracefully close. With 
our previous example 
kill
 command, we sent signal 
15
 to the process, since we 
didn't clarify which signal to send.
Terminating a process with 
SIGKILL(9)
 is considered an extreme last resort. When 
you send signal 
9
 to a process, it's the equivalent of ripping the carpet out from 
underneath it or blowing it up with a stick of dynamite. The process will be force-
closed without giving it any time to react at all, so it's one of those things you 
should avoid using unless you've literally tried absolutely everything you can think 
of. In theory, sending signal 
9
 can cause corrupted files, memory issues, or other 
shenanigans to occur. As for me, I've never actually run into long-term damage 
to software from using it, but theoretically it can happen, so you want to only use 
it in extreme cases. One case where such a signal may be necessary is regarding 
defunct
 or 
Zombie process
 in a situation where they don't close on their own. 
These processes are basically dead already and are typically waiting on their parent 
processes to reap them. 


Controlling and Managing Processes

Download 15,21 Mb.

Do'stlaringiz bilan baham:
1   ...   231   232   233   234   235   236   237   238   ...   482




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish