anyone understand the comments below ? in function BaseType_t xTaskIncrementTick( void )
/* ToDo: This doesn't really play nice with the logic below: it means when core 1 is
running a low-priority task, it will keep running it until there is a context
switch, even when this routine (running on core 0) unblocks a bunch of high-priority
tasks... this is less than optimal -- JD. */
about xTaskIncrementTick context switch?
Re: about xTaskIncrementTick context switch?
The situation is like this:
1. High priority task T1, pinned to CPU1 is in blocked state (e.g. waiting on a xQueueReceive)
2. Lower priority task T2 is running on CPU1
3. Tick interrupt on CPU0 calls xTaskIncrementTick, which unblocks T1 (by making xQueueReceive timeout expire).
Result (with the current logic in xTaskIncrementTick) is that T1 does not start running immediately, and T2 continues to run. T1 will start running when either of the following happens:
a) Tick interrupt occurs on CPU1 (tick interrupts on the two CPUs are not synchronized, so anywhere between 0 and portTICK_PERIOD_MS can pass until then)
b) T2 blocks or otherwise yields
c) Interrupt happens on CPU1, and interrupt handler calls portYIELD_FROM_ISR()
1. High priority task T1, pinned to CPU1 is in blocked state (e.g. waiting on a xQueueReceive)
2. Lower priority task T2 is running on CPU1
3. Tick interrupt on CPU0 calls xTaskIncrementTick, which unblocks T1 (by making xQueueReceive timeout expire).
Result (with the current logic in xTaskIncrementTick) is that T1 does not start running immediately, and T2 continues to run. T1 will start running when either of the following happens:
a) Tick interrupt occurs on CPU1 (tick interrupts on the two CPUs are not synchronized, so anywhere between 0 and portTICK_PERIOD_MS can pass until then)
b) T2 blocks or otherwise yields
c) Interrupt happens on CPU1, and interrupt handler calls portYIELD_FROM_ISR()
-
- Posts: 9764
- Joined: Thu Nov 26, 2015 4:08 am
Re: about xTaskIncrementTick context switch?
thanks, I get it.
Who is online
Users browsing this forum: No registered users and 74 guests