MQX Interrupt Preemption Question

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MQX Interrupt Preemption Question

810件の閲覧回数
jmag99
Contributor II

I have a quick question about the operation of MQX.  Let's say we have the following senario:

Low Priority Task Running

Interrupt Occurs and causes a higher priority task to become ready to run.

Upon exiting from the ISR, does MQX immediately task switch to the higher task, or does it wait for the next systick period before changing context?

I believe most RTOS immediately change, but we are not seeing this behavior on our system.  We are seeing it wait until the next system tick period before changing to the higher priority task.

0 件の賞賛
返信
2 返答(返信)

413件の閲覧回数
Carlos_Musich
NXP Employee
NXP Employee


You can find a simple example in the following thread:

https://community.freescale.com/thread/324484

BR,

Carlos

0 件の賞賛
返信

413件の閲覧回数
matthewkendall
Contributor V

The newly ready-to-run task should run immediately.

There is an explanation of how this works in the MQX User Guide, section 3.9. Essentially there is a Kernel interrupt that acts as a wrapper around user-defined interrupt code. When the user-defined ISR returns, it returns to the kernel ISR which executes a context switch if required.

For this to work you need to install your ISR using the mechanisms provided (i.e. _int_install_isr, see 3.9.2). If you just hook user-defined ISR code to raw interrupt vectors then MQX will have no knowledge that anything has happened, and you won't see a context switch until the next tick.

0 件の賞賛
返信