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.

Sysbios task management

Hi,

Please check below queries on task management and control and let us know your comments.

 

1) Can we execute a set of tasks in a non-preemptive controlled manner?

     Scenario: We have task1,task2,task3 of same priority and task 4 of higher priority. The execution should start from task1->task2->task3->task4 even if in between the high priority task4 becomes ready to run while lower priority tasks are running or any SWI/HWI occurs in the system. Once these 4 tasks are executed we should be able to service all the interrupts that came in between.

 

2) Can we create a environment where we can deterministically control the length of the execution time slice for same priority tasks?

     Scenario: We have task1,task2,task3 of same priority. Now once the Bios starts we want task1 execution to take t1 usec, task2 execution to take t2 usec and t3 usec for task3. Every task should yield once its time slice is finished without any explicit timer/clock usage.

 Using SysBios6 on TCI6618 DSP.

Please let us know pros and cons of each solution if it’s feasible. Also it will be of great help if you can provide a sample code block to implement such functionality to manage tasks.

 

Regards

Soumya

  • Soumya,

    For scenario #1, could you have task #4 pend on an Event object such that it will only become unblocked after Task's 1,2,3 post their unique events?

    If you need task 4 to also depend on interrupt events, you could add them into the AND mask as well:

    task4()

    {

        Event_pend(evt, Event_Id_00+Event_Id_01+Event_Id_02+ Event_Id_03, 0, BIOS_WAIT_FOREVER);

       /* returns from Event_pend() only when all 4 events have been posted */

    }

    task1()

    {

      while (1) {

      /* do stuff */

      /* then post event */

       Event_post(evt, Event_Id_00);

      /* last task 2 run */

      Task_yield();

       }

    }

    task2()

    {

      while(1) {

      /* do stuff */

      /* then post event */

       Event_post(evt, Event_Id_01);

      /* last task 3 run */

      Task_yield();

     }

    }

    task3()

    {

      while(1) {

      /* do stuff */

      /* then post event */

       Event_post(evt, Event_Id_02);

      /* last task 1 run again */

      Task_yield();

     }

    }

    myHwi()

    {

      Event_post(evt, Event_Id_03);

    }

    Alan

  • Well, I dont really want to use any IPC Object to create the scenario.

    I would like to know if in the Sys BIOS scheduler itself we can configure the same so that a series of task execute sequenially without any preemption.

    I thought of disabling HWI/SWI and task scheduler but will that be a wise option?

    Also how do we getback all these interrupts which we donot serve at real time, insteads want to queue them and proces them once the task flow is done.

  • Soumya,

    Did you question get answered?

    Your scenario really doesn't make sense in BIOS context.  In BIOS, the highest priority thread that is ready should always be executing.
    Why would a higher priority thread be pending on lower priority threads...this sort of defeats the purpose of making it higher priority.
    Why wouldn't you just make it a lower priority thread then when the other thread are finish they can block so the lower one can run?

    Judah

  • I can't see how scenario 2 happens without Clock/Timer being used.  Task do no inherently have a property where it says I will only execute for so much time.

    Judah