title: How does software recognize an interrupt has occured?
body: <p>As we know we write <code>Embedded C</code> programming, for <code>task management, memory management, ISR, File system</code> and all.<br>
  I would like to know if some <code>task or process is running</code> and at the same time an <code>interrupt occurred</code>, then <code>how SW or process or system comes to know that, the interrupt has occurred?</code> and  <code>pauses</code> the current <code>task execution</code> and <code>starts serving ISR</code>.</p>
  
  <p>Suppose if I will write the below code like;</p>
  
  <pre><code>// Dummy Code
  void main()
  {
      for(;;)
          printf("\n forever");
  }
  
  // Dummy code for ISR for understanding
  void ISR()
  {
      printf("\n Interrupt occurred"); 
  }
  </code></pre>
  
  <p>In this above code if an <code>external interrupt(ISR) occurs</code>, then how <code>main()</code> comes to know that the interrupt occurred? So that it would start serving ISR first?</p>