Other Parts Discussed in Thread: SYSBIOS
What is the scheduling algorithm used for the multitasking firmware running on R5F, MCU2_0,
and is it related to my SDK version,my SDK name is:psdk_rtos_auto_j7_06_01_00_15/bios_6_76_03_01/.
Thanks.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
What is the scheduling algorithm used for the multitasking firmware running on R5F, MCU2_0,
and is it related to my SDK version,my SDK name is:psdk_rtos_auto_j7_06_01_00_15/bios_6_76_03_01/.
Thanks.
It is priority based preemptive multi-tasking..
Rgds,
Brijesh
But I have three tasks A, B, and C with the same priority.
They will not be switched automatically if they are created. If the first one is A, the second one is B, and the third one is C.
Then task A will always occupy the cpu, and other tasks will not print their own logs. If Task_yield () is called in task A, task B will always occupy the cpu and only output the log of task B.
I don't understand the above situation. I think that tasks with the same priority will preempt CPUs by themselves.
It looks like they are using CPUs at the same time, but actually they are not. What do you think of this?
Here is my multitasking code, please advise:
extern "C" {
#include <app.h>
#include <utils/console_io/include/app_log.h>
#include <xdc/runtime/Error.h>
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/knl/Clock.h>
#include <app_ipc_rsctable.h>
}
static uint8_t TskStack0[4*1024]
__attribute__ ((section(".bss:taskStackSection")))
__attribute__ ((aligned(1024)))
;
static uint8_t TskStack1[4*1024]
__attribute__ ((section(".bss:taskStackSection")))
__attribute__ ((aligned(1024)))
;
static uint8_t TskStack2[4*1024]
__attribute__ ((section(".bss:taskStackSection")))
__attribute__ ((aligned(1024)))
;
void fun0(){
printf("111111111111111111111111111111111111111111111111\n");
//Task_yield();
}
void fun1(){
printf("222222222222222222222222222222222222222222222222\n");
}
void fun2(){
printf("33333333333333333333333333333333333333333333333\n");
}
int main(void)
{
Task_Params tskParams;
Error_Block eb;
Task_Handle task0,task1,task2;
appInit();
Error_init(&eb);
Task_Params_init(&tskParams);
InitDevices();
tskParams.arg0 = (UArg) NULL;
tskParams.arg1 = (UArg) NULL;
tskParams.priority = 8u;
tskParams.stack = TskStack0;
tskParams.stackSize = sizeof(TskStack0);
task0 = Task_create((ti_sysbios_knl_Task_FuncPtr)fun0, &tskParams, &eb);
if(NULL == task0){
BIOS_exit(0);
}
tskParams.stack = TskStack1;
tskParams.stackSize = sizeof(TskStack1);
task1 = Task_create((ti_sysbios_knl_Task_FuncPtr)fun1, &tskParams, &eb);
if(NULL == task1){
BIOS_exit(0);
}
tskParams.stack = TskStack2;
tskParams.stackSize = sizeof(TskStack2);
task2 = Task_create((ti_sysbios_knl_Task_FuncPtr)fun2, &tskParams, &eb);
if(NULL == task2){
BIOS_exit(0);
}
BIOS_start();
return 0;
}
Thanks.
Hi
No, if the same priority tasks are waiting, until the task blocks or explicitly release control, it wont go to second task.
Rgds,
Brijesh
OK, I always thought that a task executes a certain amount of instructions, and the scheduler will actively switch to other tasks using cpu.
Thanks.