RTX51 Tiny User's Guide said: "The os_switch_task function allows a task to halt execution and allow another task to run."
If I have 5 tasks on READY state, which task will be switched to run while calling os_switch_task() ?
No body knows ? Can anyone help me ?
In General for OSes The next one based on priority. I assume it is the same
Yes, I understand that you said. But I didn't see any describtion about priority of task in RTX51 Tiny System. Could you see?
But I didn't see any describtion about priority of task in RTX51 Tiny System.
I haven't used RTX Tiny but I do remember reading something about Round Robin scheduling. Doesn't that just mean it's the next in the queue? Maybe you could look up the scheduling types. And maybe there's some OS call to retrieve the process queue itself (don't expect so, too low-level)?
[Quick web-check...]
From http://www.keil.com/c51/rtx51tiny/ :
RTX51 Tiny performs round-robin and cooperative multitasking only. Preemptive task switching and task priorities are not supported.
The scheduling types are described here. http://www.keil.com/support/man/docs/tr51/tr51_rrobin.htm http://www.keil.com/support/man/docs/tr51/tr51_coop.htm
Maybe the queues are sorted by task ID?
Regards, Joost Leeuwesteijn
Joost, I have found some information about priority of task, as follows: In http://www.keil.com/support/man/docs/tr51/tr51_sysreq.htm, it said: Preemptive task switching and task priorities are not supported. If your application requires preemptive task switching you must use the RTX51 Full Real-Time Executive.
In http://www.keil.com/support/man/docs/bl51/bl51_l131.htm, it said: You have assigned a priority for an RTX51 Tiny task. RTX51 Tiny does not support priorities.
In http://www.keil.com/forum/docs/thread5879.asp, Jon Ward wrote:
RE: Question on RTX51Tiny os_wait Jon Ward ...there should be a "next_task" function that I can call simply to give other tasks a chance to execute... This is your lucky day. :-) There is such a function. It's called os_switch_task. Here's the manual page for it: http://www.keil.com/support/man/docs/tr51/tr51_os_switch_task.htm Jon
In www.keil.com/.../c51_le_realtimefunctasks.htm, it said: The Cx51 Compiler supports the RTX51 Full and RTX51 Tiny real-time multitasking operating systems with the _task_ and _priority_ keywords.
In http://www.keil.com/support/docs/1073.htm, it said: Change the priority to a number from 0 to 3.
According to the information above, I guess(determine) conclusion: 1. Only RTX51 Full supports task priority, you can use keyword _priority_ to decide, range from 0(lowest level) to 3(highest level). 2. RTX51 Tiny doesn't support task priority. After I testing, you still can use keyword _priority_, but only value of 0. For example:
void FUNC (void) _task_ 2 _priority_ 0 { }
3. when calling os_switch_task(), if next task after current running task is in READY state, it will run immediately. For example:
void FUNC (void) _task_ 2 { os_switch_task(); /* it will switch to task 3 to run */ }
If task 3 isn't at READY state, it will check task 4, and go on.
4.task_id is from 0 to 15 circurly in RTX51 Tiny.