Patent ID: 7849463

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; determining whether or not there are any threads to execute; and responsive to a determination that there are no threads to execute, determining by a scheduler a dynamic variable amount of time based on a maximum amount of time that a thread can yield before needing to be scheduled for execution, wherein the maximum amount of time is based on a sleep state of a set of threads in a sleep queue, the dynamic variable amount of time being independent of the predetermined periodic rate, a key press event, and any event associated with release of a resource, and deactivating one or more of the hardware elements and the program modules for said dynamic variable amount of time, wherein the one or more of the hardware elements and the program modules are going to be activated again only when the operating system needs to perform scheduling a thread for execution upon expiration of the dynamic variable amount of time since the deactivating.