Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Quoted from http://en.wikipedia.org/wiki/Interrupt:

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.

I was wondering what "asynchronous" and "synchronous" mean?

share|improve this question
add comment

3 Answers

up vote 5 down vote accepted

When that Wikipedia article mentions an asynchronous interrupt, they are using the classical clocked vs. non-clocked definition of (a)synchronous, which applies to a digital circuit.

A digital circuit is said to be synchronous when every part of the logic is connected to a common clock (like in your CPU). At the rise or fall of every clock cycle, the state of the circuit is updated. An asynchronous digital circuit, on the other hand, is not clocked, but rather the next state is dependent on the current one (and will switch as soon as it can). Reading logic from other circuits that don't share the same common clock can also be defined as asynchronous, but with respect to the other circuit.

If an asynchronous interrupt is triggered, it means that the processor will (most likely at the next clock cycle) save its current executing environment, and service the interrupt request. This is an example of a hardware interrupt (one that is triggered by an external connection to the processor). All software interrupts, as mentioned in the article, are technically synchronous, since they are initiated by the CPU itself - which is a synchronous circuit.

Since no external devices share the same common clock as the CPU, all external interrupts can be said to be asynchronous. Even though the device that triggered the interrupt may be a synchronous circuit, from the CPU's point-of-view, those interrupts are triggered asynchronously (since it is not sharing a common clock signal with the device).


The actual external interrupt signal itself is asynchronous, but all CPU interrupt handlers are synchronous, they will only detect an interrupt on the next clock tick, since that's the point of a synchronous system (to only allow the system's state to change together). If you're curious as to how a processor handles interrupts, see this great resource from Intel (specifically, Volume 3, Part 1).

share|improve this answer
    
Asynchronous is not non-clocked in this instance. Asynchronous hardware interrupts are clocked when one is using APICs, for instance. They are clocked to the APICCLK signal of the APIC bus. Asynchronous doesn't mean non-clocked. It merely means not synchronized to the relevant clock: the CPU's system bus interface clock. –  JdeBP Aug 3 '11 at 6:24
    
The APIC just sits between the CPU logic and the interrupt logic, but the actual interrupt signal itself is still asynchronous. The APIC just helps to direct the CPU control when dealing with multiple physical cores. –  Breakthrough Aug 3 '11 at 10:21
1  
@JdeBP sorry, after skimming through the Intel Architecture Manual, the APIC also handles software interrupts as well. Even though it is clocked in phase with the input, it still qualifies as part of the CPU, and this is only done to avoid the logic from changing part-way through a clock signal. The APIC just helps to prioritize interrupts and avoid resource conflicts on a hardware level. Finally, the APIC in x86 architectures actually shares the CPU clock. –  Breakthrough Aug 3 '11 at 10:32
1  
@JdeBP, from the Intel Architectures Software Developer's Manual I linked to above, Volume 3A Part 1, Chapter 10 states that the APIC does handle software interrupts: "Local APICs can receive interrupts from the following sources: [...] Inter-processor interrupts (IPIs) - An Intel 64 or IA-32 processor can use the IPI mechanism to interrupt another processor or group of processors on the system bus. IPIs are used for software self-interrupts, interrupt forwarding, or preemptive scheduling." Also, I already said that the APIC was synchronized with the CPU clock. –  Breakthrough Aug 3 '11 at 12:53
1  
You are wrongly conflating software interrupts with IPIs, just because one sentence in a manual happens to use the word "software" to say that software can choose to trigger an IPI. You and the person who is upvoting your comments both need to read those manuals a lot more closely, in particular the section that is actually entitled Software Interrupts. –  JdeBP Aug 4 '11 at 13:17
show 1 more comment

From the Etymology Dictionary for Synchronous,

1660s, "existing or happening at the same time,"
from L.L. synchronus "simultaneous,"
from Gk. synchronos "happening at the same time,"
from syn- "together" + khronos "time."
Meaning "recurring at the same successive instants of time" is attested from 1670

asynchronous means "not synchronous".

Now you read all that in the context of interrupts again.

The asynchronous interrupt would be not directly related to the activity at hands -- think of it like, you are reading this and suddenly you hear a noise behind you; you turn around -- that is because you were asynchronously interrupted to do so :-)

Now, if you are reading the wikipedia page for interrupts, and you see the word asynchronous, you look it up (as above) -- that is a synchronous interrupt in your flow of thought; the cause of this interrupt was what you read -- as a result, you stopped reading, looked up the word, and eventually came back to reading this.

share|improve this answer
    
Thanks! I wonder what and what don't happen at the same time in asynchronous interruption? –  Tim Aug 2 '11 at 18:13
    
So are their meanings in the interrupt context different from in the dictionary? –  Tim Aug 2 '11 at 18:21
    
+1 for much clearer than my answer. –  soandos Aug 2 '11 at 18:22
1  
Nope. He's just saying it clearer. Sync means you expected it to happen next. Async means you didn't know when or if it would happen. –  soandos Aug 2 '11 at 18:26
1  
@sonados the term synchronous has nothing to do with expecting anything to happen, it refers to everything being clocked together/in phase. No device "expects" a synchronous interrupt to occur, an interrupt is an interrupt - something that the CPU was not expecting at that moment in time, synchronous or not. The same thing happens if I call a software interrupt or trigger a hardware interrupt on the CPU. –  cp2141 Aug 3 '11 at 2:55
show 2 more comments

Basically, it is a way to get the attention of the kernel or a program.

An example: Lets say i have a program download a file. I want my program to still be responsive while the file is downloading and I need to tell my program that I am done. In the meantime however, my program should continue doing whatever it wants, until it is ** interrupted** by the completion of a downloaded file. It then does whatever it needs to do. It in asynchronous because it will not happen at a predefined time or in a predefined order.

Sync means you expected it to happen next. Async means you didn't know when or if it would happen.

share|improve this answer
    
Thanks! But I don't understand the difference between synchronous and asynchronous interrupts, by "synchronous interrupt is when a program sends a message to the OS that it needs something, or that something has just finished." –  Tim Aug 2 '11 at 18:16
    
See revised answer. –  soandos Aug 2 '11 at 18:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.