• <xmp id="om0om">
  • <table id="om0om"><noscript id="om0om"></noscript></table>
  • System Task Manager SDK Reference  5.22
    All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Pages
    Schedule Manager

    Schedule Manager

    To switch between schedules during runtime, the user must create a Schedule Manager which resides in a single OS process and links to the shared library libstm_runtime.so. During system initialization, only one process can call stmScheduleManagerInit(). The Schedule Manager controls which schedule is executed at a certain point of time. It uses two APIs (present in stm_manager.h) to control the execution of the schedule:

    1. stmStartSchedule(uint16 t scheduleId): This starts the execution of the schedule corresponding to the input scheduleId. If no matching schedule is found, it will result in an error and STM will exit.
    2. stmStopSchedule(uint16 t scheduleId): This stops the execution of the schedule corresponding to the input scheduleId. If no matching schedule is found, or if the current executing schedule does not match the input scheduleId, it will result in an error and STM will exit.
    3. stmRollOverSchedule(uint16_t startScheduleId, uint16_t stopScheduleId): This switches the execution from stopScheduleId to startScheduleId in a per-hyperepoch fashion allowing for minimal dead-time of hyperepochs during the switch. This is restricted to switching between two schedules that have the same resource partitions across hyperepochs. An error will result and STM will exit if any of the following occurs:
    • no matching schedule is found for stopScheduleId, or if the current executing schedule does not match stopScheduleId
    • no matching schedule is found for startScheduleId
    • the schedules corresponding to stopScheduleId and startScheduleId do not have the same number of hyperepochs or same resource partitions across hyperepochs

    To exit gracefully, the process calling stmScheduleManagerInit() can call stmScheduleManagerExit(). For example, the application's SIGINT or SIGTERM handler can call stmScheduleManagerExit() to gracefully exit.

    Synchronized Schedule Switch

    STM implements a synchronized schedule switch as depicted in the figure below. Upon receiving a request for stopping the current schedule, each hyperepoch finishes executing its current frame and does not start the execution of the next frame. Schedule execution comes to a halt after all the hyperepochs stop. After that, based on the input from the STM Schedule Manager, execution can restart with a different schedule.

    Overview of Synchronized Schedule Switch

    Rollover Schedule Switch

    STM implements a rollover schedule switch as depicted in the figure below. Upon receiving a request to rollover from schedule A to B, each hyperepoch in schedule A finishes executing its current frame. As soon as a hyperepoch in schedule A finishes its current frame, the corresponding hyperepoch in schedule B begins execution. This allows individual hyperepochs to switch to a new schedule without having to wait for all hyperepochs in the current schedule to finish first like in complete swap. This feature is restricted to schedule pairs that have the same number of hyperepochs and same resource partitions across hyperepochs. A callback function can be registered per client during init time using the API found in stm.h. The callback gets executed per hyperepoch right before schedule B begins exeuction and is typically used for any setup tasks needed during the switch. The stmRollOverSchedule API returns after all hyperepochs have switched to the new schedule. After that, based on the input from the STM Schedule Manager, execution can roll over to a different schedule or stop then start again.

    Overview of Per Hyperepoch Swap Schedule Switch
    人人超碰97caoporen国产