In a multitasking system executing real-time harmonic and dynamic tasks
having various priority levels, slack is stolen from both timeline and
reclaimed slack to enable the execution of high priority non-essential
tasks on a best efforts basis. Counts of the amount of slack consumed,
slack reclaimed, and periodic compute time consumed are maintained by
individual priority level and dynamically updated at certain times. Idle
time is calculated by priority level. Available slack is calculated, and
slack is allocated and consumed by rate, with the highest rate first and
the lowest rate last. Also described are a computer system and various
methods that perform slack stealing in a multitasking system in which
dynamic tasks can request activation or deactivation at any time.