Questions tagged [interrupt]

Use for questions related to interrupt signals and interrupt handling.

In computing, an interrupt is an asynchronous signal indicating the need for attention or a synchronous event in software indicating the need for a change in execution.

A hardware interrupt happens in response to some hardware event (say mouse movement) and causes the processor to save its state of execution and begin execution of an interrupt handler. At the same time, the possibility for this interrupt is disabled (to prevent it happening repeatedly) and must be re-enabled by software after the current interrupt has been serviced.

Interrupts are usually identified by number, and normally there is a system table somewhere in the OS that maps this number to the address of function that must service the interrupt.

Software interrupts as seen by the programmer do not differ much from the usual function calls. However they are usually implemented as specific instructions in the instruction set so may require less code to be called. Software interrupts are processed in a very similar way to the way hardware interrupts are processed, often using similar context switching and a shared interrupt table for both.

3261 questions
19
votes
2 answers

Enabling floating point interrupts on Mac OS X Intel

On Linux, feenableexcept and fedisableexcept can be used to control the generation of SIGFPE interrupts on floating point exceptions. How can I do this on Mac OS X Intel? Inline assembly for enabling floating point interrupts is provided in…
Geoffrey Irving
  • 6,483
  • 4
  • 32
  • 40
19
votes
1 answer

On x86, when the OS disables interrupts, do they vanish, or do they queue and 'wait' for interrupts to come back on?

My platform is x86 and x86-64, on Windows. The point of the interrupt priority system is to have the highest priority interrupt beat out the others. To enforce this, I'm guessing that Windows will disable all interrupts of lower level completely,…
VoidStar
  • 5,241
  • 1
  • 31
  • 45
19
votes
1 answer

What is Rescheduling interrupts (RES)? What causes it? How is it handled in Linux kernel?

What is the difference between "RES: Rescheduling interrupts" and "LOC: Local timer interrupts"? What is responsible to fire the RES interrupt? Is LOC same as the general timer interrupt that is generated by the Timer h/w in the processor? Also,…
user31986
  • 1,558
  • 1
  • 14
  • 29
18
votes
2 answers

Python Multiprocessing atexit Error "Error in atexit._run_exitfuncs"

I am trying to run a simple multiple processes application in Python. The main thread spawns 1 to N processes and waits until they all done processing. The processes each run an infinite loop, so they can potentially run forever without some user…
ShimmerTroll
18
votes
1 answer

When and how are system calls interrupted?

This is a followup question to Is a successful send() "atomic"?, as I think it actually concerns system calls in general, not just sends on sockets. Which system calls can be interrupted, and when they are, where is the interruption handled? I've…
lxgr
  • 3,719
  • 7
  • 31
  • 46
18
votes
1 answer

Boost Thread - How to acknowledge interrupt

I have blocking task which will be performed by find_the_question() function. However, I do not want thread executing this function take more than 10 seconds. So in case it takes more than 10 seconds, I want to close that thread with cleaning all…
Amey Jah
  • 913
  • 3
  • 11
  • 24
18
votes
4 answers

How are interrupts handled by dual processor machines?

I have an idea of how interrupts are handled by a dual core CPU. I was wondering about how interrupt handling is implemented on a board with more than one physical processor. Is any of the interrupt responsibility determined by the physical…
jeffD
  • 1,230
  • 3
  • 13
  • 18
18
votes
2 answers

Cygwin CTRL-C (Signal Interrupts) not working properly - JVM Shutdown Hooks not starting

I'm working on a Java application that utilises shutdown hooks in order to clean up on termination/interruption of the program, but I've noticed that Cygwin's implementation of CTRL-C doesn't seem to trigger the shutdown hooks. On the surface it…
Quetzalcoatl
  • 3,037
  • 2
  • 18
  • 27
17
votes
3 answers

Which context are softirq and tasklet in?

I know that there are process context and interrupt context but I don't understand when executing softirq or tasklet, which context is it run under. I have seen some people use the term "bottom-halves context", if there's such term, what's the…
kai
  • 1,141
  • 3
  • 15
  • 25
17
votes
2 answers

Interrupting blocked read

My program goes through a loop like this: ... while(1){ read(sockfd,buf,sizeof(buf)); ... } The read function blocks when it is waiting for input, which happens to be from a socket. I want to handle SIGINT and basically tell it to stop the read…
kaykun
  • 2,247
  • 2
  • 24
  • 37
17
votes
4 answers

Why disabling interrupts disables kernel preemption and how spin lock disables preemption

I am reading Linux Kernel Development recently, and I have a few questions related to disabling preemption. In the "Interrupt Control" section of chapter 7, it says: Moreover, disabling interrupts also disables kernel preemption. I also read from…
feirainy
  • 497
  • 1
  • 4
  • 11
16
votes
3 answers

How processor handles case of division by zero

Curious what the processor/CPU does in general or let say, on intel cpu & Linux, when it executes a division by zero instruction. Also how the error is relayed to the application, so that it can log the error or notify the developer? Thank you!
Alfred
  • 1,709
  • 8
  • 23
  • 38
16
votes
5 answers

How do interrupts work on the Intel 8080?

How do interrupts work on the Intel 8080? I have searched Google and in Intel's official documentation (197X), and I've found only a little description about this. I need a detailed explanation about it, to emulate this CPU.
Facon
  • 679
  • 2
  • 7
  • 21
16
votes
1 answer

Why softirq is used for highly threaded and high frequency uses?

What makes the softirq so special that we use it for high frequency uses., like in network drivers and block drivers.
16
votes
1 answer

Hijacking the realtime clock in linux

I want to write a LKM (Linux Kernel Module) that hijacks the realtime clock (interrupt 8). So I want the interrupt to be set to my function and at some point send it back to the old function. I have tried to use the request_irq function without any…
Ramzi Khahil
  • 4,932
  • 4
  • 35
  • 69