rtel wrote on Wednesday, December 02, 2015:
If you have two tasks that have the same priority, and no other tasks in
the Ready state, then:
With configUSE_TIME_SLICING set to 1 a context switch will occur on each
tick interrupt. This context switching on the tick interrupt is the
time slicing, and the behaviour that setting configUSE_TIME_SLICING
should suppress. Therefore…
With configUSE_TIME_SLICING set to 0 a context switch should not occur
on a tick interrupt, but only when a higher priority task enters the
Ready state, or when an interrupt other than the tick interrupt requests
a context switch.
…if you are getting a context switch on each tick interrupt even when
configUSE_TIME_SLICING is 0, and when there are no other tasks an no
other interrupts (as I think you are reporting) then something is wrong.
I have just tried this again, this time on a Cortex-M, with the simple code:
volatile uint32_t t1 = 0, t2 = 0;
void task1( void * pv )
{
for( ;; )
{
t1++;
}
}
void task2( void * pv )
{
for( ;; )
{
t2++;
}
}
int main( void )
{
prvSetupHardware();
xTaskCreate( task1, "t1", configMINIMAL_STACK_SIZE, NULL, 1, NULL );
xTaskCreate( task2, "t2", configMINIMAL_STACK_SIZE, NULL, 1, NULL );
vTaskStartScheduler();
}
With configUSE_TIME_SLICING set to 1, both t1 and t2 incremented. With
configUSE_TIME_SLICING set to 0, only t1 incremented and t2 remained at
zero.
Questions:
- Which port are you using?
- Do you have a tick hook defined that could be requesting a context switch?
Regards.