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:
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.
STM implements complete 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.