Skip to main content

Command Palette

Search for a command to run...

What is a signal in Linux

Published
3 min read
What is a signal in Linux
M

Hi, How are you !! Hope you doing good....

I got introduced to Cloud initially. As I went ahead learning what is cloud and how it works, then got to know a field which is DevOps that makes Cloud model more effective.

So, as I started working & got good experience on AWS. I have been learning the DevOps tool and technologies on how to use it with the Cloud, which will give me good understanding on how Cloud and DevOps go hand in hand to deploy my applications.

Last Blog Review

In the last blog we understood, the process priority can scheduled manually during it’s launch process via. nice cmd. But if a running process’s priority has to be re-scheduled then it can done via. renice command.

What are signals ?

Signal is nothing but a interrupt to notify process an external event is occurring. Normally a process get’s executed. Consider we want to stop or kill a process, we will press the crtl+c or use a kill command.

What happens when we press crtl+c or run kill command ?

When we run a kill command when a process is running a signal called as SIGKILL is generated and sent to the process running, When we press crtl+c then a signal SIGINT is generated to kill the running process in background.

Available signals used in Linux

1. SIGHUP → This signal is used to Hangup or death of controlling process

2. SIGINT → This signal is used to interrupt from keyboard like ctrl + c, ctrl + z

3. SIGQUIT → This signal is used to quit from keyboard

4. SIGILL → It is used to for Illegal instruction

5. SIGTRAP → This signal is used to trace or breakpoint trap

6. SIGABRT → It is used to abort signal

7. SIGFPE → Floating point exception

8. SIGKILL → Process terminates immediately

9. SIGSEGV → Invalid memory reference

10. SIGPIPE → Broken pipe

11. SIGALRM → Alarm signal

12. SIGTERM → Terminate the process

13. SIGCHLD → Child stopped or terminated

14. SIGSTOP → This signal is used to stop the process

15. SIGPWR → Power failure

Scenario →

You are managing a Linux server that runs a critical background service called data_collector.
One day you notice:

  • The service is running (ps -ef | grep data_collector)

  • But it is not responding to client requests

  • CPU usage is low

  • No error logs are being generated

  • Restarting the entire server is not allowed

You need to diagnose what the process is doing right now, without killing it.

Question

Which signal can you send to the process to force it to take a core dump or generate debugging information so you can analyze what went wrong — without abruptly killing the machine?
Explain why.

Solution

To debug a stuck/unresponsive process, you want:

✔ The process to produce a core dump
✔ So you can inspect its state (threads, memory, stack) using tools like gdb
✔ But you do not want to immediately terminate the entire environment

The correct signal for this is SIGQUIT.

I would send SIGQUIT to the data_collector process.

SIGQUIT forces the process to exit and produce a core dump.
This allows me to investigate why it became unresponsive (deadlock, infinite loop, memory issue) without rebooting the machine.

kill -QUIT <PID>

Conclusion →

In this blog we understood, what is a signal actually. Different types of signal in the Linux OS.

💡
Thats a wrap for today’s post! I hope this has provided you some valuable insights. Be sure to explore more articles on our blog further advices. See ya in next post!