Categories
Linux Tutorial Series

Linux Tutorial Series – 109.1 – Difference between signals and interrupts

The question you may have is: “What is the difference between signals and interrupts?

The difference is as follows: Interrupts are the communication between the CPU (Central Processing Unit – your processor) and the operating system (the kernel), and signals are the communication between processes and the operating system (the kernel). (“Signals and interrupts a comparison,” n.d.)⁠

Let’s go into a bit more depth:

When an interrupt occurs (initiated by either hardware or software) it is actually managed by the CPU itself, which “interrupts” (pauses) the execution of the current process and tells the kernel to invoke the interrupt signal handler (which, to recap, is a program designed to handle interrupts). Signals, on the other hand, are used to communicate between processes. But, when the signal is traveling from the sending process to the receiving process, it is managed by the kernel, which invokes the action appropriate for the signal the process received.

I hope you gained some clarity on the difference between the two. This isn’t so that important and honestly I could have left out the part with the interrupts, but I just wanted for you to know about them since we were already talking about the operating system at such a low level. If you didn’t quite catch it, don’t worry – it won’t be that much of a hinderance.

Hope you learned something useful!

References

Signals and interrupts a comparison. (n.d.). Retrieved February 14, 2020, from https://stackoverflow.com/questions/13341870/signals-and-interrupts-a-comparison

Categories
Linux Tutorial Series

Linux Tutorial Series – 102 – Signals in operating systems – what are they used for?

Here is the video version, if you prefer it:

Today we will take a look at signals. They are very important in regard to operating systems and so they are relevant for Linux. Signals are a way for processes to communicate with one another. (“Signal (IPC),” n.d.)⁠

Processes can’t access each other’s memory locations. So if Process A has memory locations 0 to 99 and Process B has memory locations 100 to 199, then if Process A tries to access memory location 129, operating system will not allow it.

But, it is useful for processes to be able to communicate with each other. Let’s say Process A wants to somehow say to Process B “Stop! Stop!”. It can use a signal to do so.

There are a lot of signals you can send to a process and they are listed here: (“POSIX signals,” n.d.)⁠. You don’t need to know their names. Just know what they are used for – communication between processes (also called inter-process communication (IPC)).

Thank you for reading!

References

POSIX signals. (n.d.). Retrieved February 10, 2020, from https://en.wikipedia.org/wiki/Signal_(IPC)#POSIX_signals

Signal (IPC). (n.d.). Retrieved February 28, 2020, from https://en.wikipedia.org/wiki/Signal_(IPC)