Pre-emptive scheduling issue

vchandra wrote on Friday, June 19, 2009:

Dear All

I am getting round robin scheduling ( equal time slice between tasks ) behavior even though i have configured to 
Preemptive scheduling mechanism. I tried to explain my sample application below.

Microcontroller : NEC V850
Tick rate : 8ms

Sample Application : 1
Two tasks were created with priority 1 and 2. In each task,seperate test pin (I/O pin configured as Output) is toggled continuesly for DSO measurement.
I expected that highest priority task always executes continously without allowing low priority task. But it executes by round robin scheduling manner.

Now i have changed both tasks priority to 1. Still it executes by round robin scheduling manner irrespective of priority changes.

Is my expectation correct?

If anything is wrong then please reply!


richard_damon wrote on Friday, June 19, 2009:

Does the higher priority task wait for anything? (Like a call to vTaskDelay?) If so, when it does so it tells the kernel it doesn’t need the processor at the moment and it gives time to the lower priority task.

vchandra wrote on Monday, June 22, 2009:


Thanks for your feedback.

I didn’t use delay routine. I am new to freeRTOS usage. So i want to test pre-emptive schedular feature between tasks and also round robin scheduler feature.

As per my understanding, Low priority will not get chance to get execute if higher task is executing without any possibilities of block/suspend state. Thats what i expected in sample application.


incrediball wrote on Monday, June 22, 2009:

Your assumption is correct. The low priority task will not run as long as the high priority task is not suspended. It can be suspended by a delay command, when taking a semaphore, waiting for queued data, etc.