Patent ID: 7137117

Claim:
A computer-implemented method for providing thread scheduling in a device, the device comprising one or more hardware elements operatively coupled to an operating system comprising a plurality of program modules, the method comprising: scheduling one or more threads according to a predetermined periodic rate; setting a system timer to generate a notification at the predetermined periodic rate; determining whether or not there are any threads to execute; responsive to a determination that there are no threads to execute: (a) deactivating one or more of the hardware elements and the program modules for a dynamic variable amount of time, the dynamic variable amount of time being independent of the predetermined periodic rate and being based on a sleep state of a set of threads in a sleep queue; and (b) resetting the system timer to generate the notification after the dynamic variable amount of time has elapsed since the deactivating; and wherein the method further comprises: receiving the notification after the dynamic variable amount of time has elapsed since the deactivating; responsive to the receiving: resetting the system timer to generate the notification at the predetermined periodic rate; and activating the one or more of the hardware elements and the program modules.