0
votes

I have experience with several RTOS (pSOS, VxWorks, QNX) however I'm new to MicroC/OS II (ucos ii). I see that something unique about ucos ii is instead of having a unique ID for tasks it uses the priority to uniquely identify tasks and that all tasks must be at different priorities and thus round robin scheduling is not supported. That much I understand. Here's the question:

If I change the priority of a task with OSTaskChangePrio() doesn't that cause problems for any code or other tasks that had stored the priority (task ID) of the task that just changed its priority. In effect changing priority changes the identity of the task. How is this not a problem?

2

2 Answers

0
votes

That function checks if some task with requested priority/ID already exists and if so it returns an error. Therefore in the case you want to change priority of your task you shall leave appropriate place in tasks table. ucosii can manage up to 255 tasks, but in every project you shall specify OS_LOWEST_PRIO value. This way you limit the amount of the tasks available. ucosii is not like psos or vxworks - it is more like nucleus or threadx - very thin OS.

0
votes

You wouldn't want to change the priority of your tasks unless you are implementing something like a dynamic scheduling algorithm or may be a resource allocation algorithm for your RTOS. In such cases, one does not care about the identity of the task as priority. One would only care about which task needs to run at this moment based on factors such as the task's deadline.

You are correct. In case you do use OSTaskChangePrio, you can no longer identify tasks based on just task priority.