Scheduling question

nobody wrote on Monday, January 09, 2006:

Hi,

First of all, you did a great job with FreeRTOS. I have a question about priorities. For example, if i’m running 3 tasks (T1, T2, T3). The priority
of T1= 2 and the priority for T2 = 1 and T3 = 1. Can you explain me how the scheduler will execute the code in time ? Does T1 will execute 2 times or
will execute longer ?

T1 -> T2 -> T1 -> T3

or

T1 -> T1 -> T2 -> T3

or …

I Hope my example is clear. Thank you for your help !!

rtel wrote on Monday, January 09, 2006:

Assuming you are using the preemptive scheduler:

T1 is the highest priority task.  Any time T1 is not blocked it will execute.

T2 and T3 have the same priority, but a priority less than T1.  T2 and T3 will only execute if T1 is blocked.  When T1 is blocked T2 and T3 will take it in turns to execute.

Regards.

nobody wrote on Wednesday, January 11, 2006:

the higher priority task takes cpu time until it needs it,after releasing execution other tasks can be runned!

nobody wrote on Wednesday, January 11, 2006:

Richard,
What do you mean by "blocked"

Thanks

nobody wrote on Wednesday, January 11, 2006:

?
Unable to run.

If it calls vTaskDelay(), vTaskDelayUntil() then it will block until the correct time to unblock.

If it calls xQueueReceive() it can specify a block time.  A time it wants to wait for data if data is not already available.

nobody wrote on Wednesday, January 11, 2006:

Is it possible that a task can’t block ?

nobody wrote on Wednesday, January 11, 2006:

A task will block if you tell it to.  If you don’t, it wont.

A task can also exist in a ready state - in this case it is ready to run (not blocked) but not running because a task of higher or equal priority is running.

I think maybe you could do with some background reading.  Start with www.freertos.org/implementation.

nobody wrote on Wednesday, January 11, 2006:

The idle task cannot block - at least your stuffed if it does.  You should know these things before using FreeRTOS.  Are you a student?

nobody wrote on Sunday, March 12, 2006:

ok that much is understood. But now the question is: If 2 or more processes are running ( each of same priority), how much time does each process get?? Is it in a Round Robin fashion? If so it has to split the Tick interrupt timing, right? I understood it as that at each Tick the scheduler check for higher prioroty task. So do the tasks here run for one whole tick??  Where is this code specified (file name,line no.)??
Thank you.

roy333 wrote on Sunday, March 12, 2006:

Previous posting by me itself.
ok that much is understood. But now the question is: If 2 or more processes are running ( each of same priority), how much time does each process get?? Is it in a Round Robin fashion? If so it has to split the Tick interrupt timing, right? I understood it as that at each Tick the scheduler check for higher prioroty task. So do the tasks here run for one whole tick?? Where is this code specified (file name,line no.)??
Thank you.
Roy

nobody wrote on Monday, March 13, 2006:

Yes there is round robin amonst tasks of the same priority.

Read the documentation.

Read the source code.