This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

multitasking problem

Hi, i am new to real-time systems and rtx. my doubt is i have written a program in which i am creating two tasks one with while loop(task1) and one doesn't have while loop(task2),both with same priority.

my doubt here is when i execute my program when task1 is executing it executes for round robin timeout duration and gives chance to task2 which doesn't have while loop task2 executes once and continues to be in RUNNING state and task1 starts to execute in task2 stack and puts it in delay whereas i should not be put actually.

the code is as follows:

#include <RTL.h>

OS_TID tid;

__task void task3(void)
{
        tid = os_tsk_self();

}

__task void task2(void)
{
        while(1)
                os_dly_wait(10);
}


__task void task1(void)
{

        os_tsk_create(task2 , 0x01);
        os_tsk_create(task3 , 0x01);
        os_tsk_delete_self();
}


int main()
{
        os_sys_init(task1);

}

Parents Reply Children