0

I have read this question, It is not a valid answer when one interrupt is executing it will not disable all the other interrupts always. It is based on the interrupt type (in some case we need to do manually in our program).

My Question is what happens when a interrupt occurs while executing a interrupt ??? If Low priority interrupt is executing then High priority interrupt occurs the what will happen ?

Embedded C
  • 1,448
  • 3
  • 16
  • 29
  • _It is based on the interrupt type_.... mainly it depends on the interrupt level and priority assigned. BTW you are merging to things: `RTOS` and `interrupts`. The question you linked have an accepted valid answer though – LPs May 23 '17 at 08:18
  • My Question is what happens when a interrupt occurs while executing a interrupt ??? If Low priority interrupt is executing then High priority interrupt occurs the what will happen @LPs – Embedded C May 23 '17 at 10:49

4 Answers4

2

It depends on the system. If the microcontroller/interrupt controller supports nested interrupts and the application enables that feature then a higher priority interrupt will interrupt a lower priority interrupt. In this case the lower priority interrupt will resume when the higher priority interrupt is complete. But if the system does not support nested interrupts then the subsequent interrupt request will pend and be serviced when the active interrupt service routine is complete.

kkrambo
  • 6,643
  • 1
  • 17
  • 30
1

It is too broad for SO, I think and it is arch based.

I try to give you a brief overview, expecting some DV on it. ;)

Mainly, if the arch allow nested interrupts, the interrupt with lower priority is interrupted while executing to jump to the ISR of high level interrupt.

But you can have NMI (Non Maskable Interrupt) that have priority on all other interrupts and cannot be disable.

Usually (all I think) archs have also a global interrupt enable flag, so it must be enabled to allow other interrupts to be served. Also means that an ISR, when is executing, can disable other interrupts during its job.

You can think, for example, on an RTOS implementation: the scheduler can be easily developed using a Timer within its interrupt. This interrupt must have the lower priority and mustn't stops other interrupts (usually): this grant that interrupts are served a soon as possible not considering context switch of RTOS scheduler.

LPs
  • 16,045
  • 8
  • 30
  • 61
1

The question was

What happens when a interrupt occurs in RTOS while currently in any task or another ISR?

I have written two commercial RTOS's and there is no answer that satisfies all of the criteria. However, I CAN answer as broadly as the question:

  1. Depending on what is allowed, it will act as a normal interrupt. The problem with this question is that "what happens" is a little broad - some RTOS's do work behind the scenes with interrupts. So, the problem is that the question is not specific enough.

  2. "What happens" in regards to a task is that NOTHING happens in regards to a task. An interrupt is an interrupt and what the relation to a task is depends on the programming. Since I don't read minds, again, the question is not specific enough.

The BEST answer is 42 (HHGTTG)

0

There is no one answer, sometimes nothing happens the lower prio interrupt continues to completion, sometimes the higher one interrupts the lower. It depends first on the chip/system design, second it depends on the individual programmers across the board RTOS and application folks.

Or another way to say it is, what happens is what those individuals desired to happen in their design and implementation.

old_timer
  • 69,149
  • 8
  • 89
  • 168