Linux - Traps and signals
4K views
Nov 28, 2024
Linux - Traps and signals
View Video Transcript
0:00
now in this video we are going to talk
0:02
about the traps and signals by name
0:04
itself traps perhaps means we are going
0:07
to stuck somewhere so if you are going
0:09
to stuck somewhere what you are going to
0:11
do and signals can be any kind of signal
0:14
it can be your user requests it can be
0:17
any termination signal it can be a
0:19
failure signal signals are nothing but
0:21
any particular event your Linux
0:24
operating system gets or any other
0:26
operating system gets so if any event
0:29
triggers or if any event happens what
0:31
your system does that we are going to
0:33
see here very first what are the signals
0:36
signals are any software interrupts
0:39
which are sent to the program to
0:41
indicate that the important event has
0:44
occurred signals are the software
0:47
interrupts send to a particular program
0:50
to indicate that the important event has
0:53
occurred now this event is not only the
0:56
interrupt interrupt means you are going
0:58
to you know just your system or a
1:00
particular user to get particular tasks
1:03
to be stopped and perform your task it
1:06
can be any kind of interrupt interrupts
1:08
have many type it has a request
1:10
interrupt like we are requesting our
1:13
resources so to stop your work and give
1:15
our pro service two priorities or our
1:18
services or priorities like we have said
1:20
the priorities into the nice values so
1:23
those are the interrupts again if I'm
1:25
creating offer if I'm asking my system
1:28
to save the file it is again an
1:30
interrupt if I do not want a particular
1:33
applications to be performed
1:35
applications to be used I can close
1:38
those particular application that is
1:39
again an interrupt I'm asking my
1:41
resources to close an application so
1:43
whatever we are going to do whatever the
1:45
task will perform it your system take it
1:48
as an interrupt so it is a software
1:51
signals which is your user is performing
1:53
either your system also sometimes gives
1:55
you some kind of interrupts now the
1:58
events or we can say what are the
2:00
interrupts triggers these already is
2:02
requested illegally by the users or your
2:06
illegal memory access errors it might
2:09
happen sometimes your memory is less you
2:13
don't have the insufficient amount of
2:15
RAM for performing any particular task
2:16
so your system will trigger an event
2:19
that your memory is slow or your memory
2:23
is not sufficient that is insufficient
2:25
memory access
2:26
so all this events will be provided by
2:29
the system so they are again of events
2:32
or they are again of signals some
2:35
signals such as interrupt signals which
2:37
we have can indicate that the user has
2:40
asked something to be denied or
2:42
something to be canceled those
2:44
particular signals can also be used
2:46
which shows that particular system that
2:49
this is not a flow which we are going to
2:52
use so sometimes you are using a
2:54
particular process the process and
2:55
services are running and suddenly you
2:57
close that behavior service or you stop
2:59
that service means we are not in the
3:01
usual flow the system has requested
3:04
something which is not into the flow so
3:06
this again signals are called as the
3:08
interrupt signals so let us see which
3:11
are the type of signals we have into our
3:13
systems and when we give any kind of
3:16
interrupts which type of signals we have
3:18
so their signals are in such a way so
3:21
these are the abbreviation of your
3:22
signals sign up and signal int and
3:25
signal quit signal FPE
3:29
signal kill signal alarm and signal
3:32
terminate so these are the signals we
3:34
have and they are also associated with
3:36
the numbers which is used by your Linux
3:40
operating system to understand the
3:41
signals like for sick up we have one
3:45
which hang up the dedicated or it
3:48
detects any particular hang-up or traps
3:50
into a particular process now for
3:52
example you might experience you have
3:54
logged into a terminal and you have run
3:56
some service but a service is not again
3:59
started and even you are not getting the
4:01
prompt or any particular error so you
4:03
are completely hung over there so that
4:06
time if you want that this particular
4:08
signals are getting hung and if you want
4:10
to check what signals your system is
4:12
getting so by default it gets a signal
4:14
that is signal 1 which controls those
4:18
particular signal or we can say it will
4:20
directly get the controlling process
4:23
completely which is controlling the
4:25
signal
4:25
that signal is called as a sick huh sing
4:29
it now second again is an interrupt
4:31
provided by the user for stopping
4:33
certain process by pressing ctrl + C so
4:37
what happens if suppose I'm starting
4:39
with some process for example I can take
4:41
I'm pinging a particular host if I'm
4:43
giving the command ping and the host
4:45
name or a host IP address it
4:46
continuously go on pinging it now if I
4:49
want to stop the communication I can
4:52
press control C so when I press control
4:55
C it will by default take the signal cut
4:57
a signal interrupt that is 2 then we
5:00
have SiC quit SiC quit is when a user
5:03
want to quit out of the terminal either
5:06
we come give the command exit or either
5:08
we give control D so that time the
5:11
signal which is positive to our system
5:13
is signal 3 or we call it as SiC quit
5:16
signal again FPE it is the prog in
5:20
mathematical operation error where if
5:22
suppose I have used some invalid
5:24
operators like in spite of addition I
5:27
have you something else which we
5:28
generally do not use like if I have used
5:30
at the rate sign so it's not any kind of
5:33
automatically operator so that time it
5:35
will be giving me an error this error
5:37
signals will be either 8 while sticking
5:40
into the input and it tooks called as
5:42
sick FBE airs same sick kill sick kill
5:48
is again a particular process which
5:50
terminates a particular service by
5:53
killing the particular service
5:54
completely but it doesn't clean up the
5:56
complete free now for example I have
5:59
started Firefox twice and one of my
6:02
Firefox is not working one of my browser
6:04
is not working we do to any particular
6:06
error so if I stop only that browser so
6:10
it will kill the process but it won't
6:12
kill complete tremens other than that if
6:15
other fire first process are running it
6:17
won't clean up those things that is your
6:19
say kill so it kills a particular
6:22
process then we have sick alarm sig Alam
6:26
is the clock alarms provided by some of
6:29
the signals now for example I have
6:31
scheduled to my system shutdown after
6:33
one hour so before 1:00 our if will
6:35
alarm me that my system is going to shut
6:38
down because I
6:39
scheduled something now for example and
6:41
my system is going to be backed up after
6:43
one week so it will give me our alarm
6:46
the alarm is set on this particular date
6:48
on this particular system so those are
6:51
the signal alarms which it prompts us
6:53
while we have already scheduled
6:54
something the next we have that is sick
6:57
da minute so if suppose we are running
6:59
some software's
7:00
or if you are running some services I
7:02
want to completely kill the tree or if I
7:05
can terminate the whole process along
7:08
with the tree of this process we can go
7:10
for sick jump which input it takes as -
7:13
15 so if suppose you are trapped
7:16
somewhere or if suppose you are not able
7:19
to you move out of a particular console
7:21
you can move into other terminal and you
7:23
can give any of the signals whichever
7:26
you would require from the other
7:27
terminals as well so but while defining
7:30
or managing the signals we have to give
7:33
the command called as kill kill is what
7:36
killing the signals and this signals can
7:38
be used so which kind of termination of
7:40
process do you require so you need to
7:42
specify in such a way kill space and
7:45
then the signal name with - so once you
7:49
have defined this automatically it will
7:50
take this particular signal and will
7:52
provide this kind of termination so let
7:55
us see how we can use the scale process
7:57
for our existing processes which we have
7:59
into our terminal and by using this
8:02
particular kill process will also ensure
8:04
that we have checked all the processes
8:06
and we have tracked something into the
8:08
process and killing the signals by using
8:11
- 15 - 9 as well
#Computer Science
#Monitoring Software
#Operating Systems
#Other
#Programming