|
|
Question : Signals and Interrupts
|
|
What is the difference between a signal and an interrupt?
|
Answer : Signals and Interrupts
|
|
>Software can generate them, too, but only in kernel level, as I understand >things
Software running at user level generates interrupts all the time. For example, if a user program tries to store into Address 0, that causes an interrupt. It's called a software interrupt, by the way, because it is caused directly by the execution of a program. In some architectures, this kind of interrupt is called an "exception," and is kept conceptually separate from interrupts.
I'm sure what you meant is that the interrupt is always processed at kernel level by kernel code. When the user program tries to store into Address 0, control immediately switches to some kernel code and the system enters kernel state. You can't set up a user program to have user code run when an interrupt happens.
There's an interesting connection in this example between interrupts and signals. The kernel code that handles the interrupt (a segmentation violation interrupt) handles it by generating a SIGSEGV signal to the user process, which means the user program can effectively set up an interrupt handler for this particular kind of interrupt.
|
|
|
|
|