MQX Interrupt Preemption Question

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

MQX Interrupt Preemption Question

743 次查看
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 回复数

346 次查看
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 项奖励
回复

346 次查看
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 项奖励
回复