简体   繁体   中英

Is it possible to design Arinc653 scheduler with Azure-RTOS?

I want to design a scheduler that works in Arinc653 manner just for experimental issues. Is this possible to manipulate the scheduler in this way?

There is time-slicing in threadX I know but all examples I've encountered are using TX_NO_TIME_SLICE (And my shots with that did not work either.). Besides I'm not sure if time-slice make the thread wait until its deadline met or put it into sleep so that other threads get running.

For short; Arinc653 scheduler defines a constant major frame that each 'thread' has its definite amount of running times and repeats major frame endlessly. If a thread assigned with ie 3ms within a major frame and it finishes its job in 1 ms; kernel still waits 2ms to switch next 'thread'.

您可以使用时间切片来限制每个线程运行的时间: https : //docs.microsoft.com/en-us/azure/rtos/threadx/chapter4#tx_thread_create

I understand that the characteristic of of the Arinc653 scheduler that you want to emulate is time partitioning. The ThreadX schedule policy is based on priority, preemption threshold and time-slicing.

You can emulate time partitioning with ThreadX. To achieve that you can use a timer, where you can suspend/resume threads for each frame. Timers execute in a different context than threads, they are light weight and not affected by priorities. By default ThreadX uses a timer thread, set to the highest priority, to execute threads; but to get better performance you can compile ThreadX to run the timers inside an IRQ (define the option TX_TIMER_PROCESS_IN_ISR).

An example:

  • Threads thd1,thd2,thd3 belong to frame A
  • Threads thd4,thd5,thd6 belong to frame B
  • Timer tm1 is triggered once every frame change

Pseudo code for tm1:

tm1()
{
  static int i = 0;
  if (i = ~i)
  {
    tx_thread_suspend(thd1);
    tx_thread_suspend(thd2);
    tx_thread_suspend(thd3);
    tx_thread_resume(thd4);
    tx_thread_resume(thd5);
    tx_thread_resume(thd6);
  }
  else
  {
    tx_thread_suspend(thd4);
    tx_thread_suspend(thd5);
    tx_thread_suspend(thd6);
    tx_thread_resume(thd1);
    tx_thread_resume(thd2);
    tx_thread_resume(thd3);
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM