Patent ID: 8683476

Claim:
A method for dispatching a thread to a resource, comprising: obtaining the thread by an operating system executing on a computing device, wherein the thread is associated with a request from a user application for the operating system to perform an action; obtaining, by the operating system, utilization data for a plurality of resources, wherein utilization data is stored in a repository and comprises at least a current power state of the plurality of resources; determining whether a first resource affinity entry is stored for the thread in a resource affinity store; identifying a first resource using the first resource affinity entry when the first resource affinity entry is stored for the thread, wherein the first resource is one of the plurality of resources, and wherein the first resource affinity entry comprises a thread identifier (ID) corresponding to the thread, the first resource ID corresponding to the first resource, and a first timestamp associated with when the thread last completed executing on the first resource; determining whether the first resource is qualified under a dispatch policy, wherein the dispatch policy indicates the first resource is qualified to receive a dispatched thread based at least on utilization data of the first resource; determining a second timestamp using utilization data when the first resource is qualified under the dispatch policy, wherein the second timestamp is associated with a time when the first resource last transitioned to a not powered state or a low powered state; when the second timestamp precedes the first timestamp: selecting the first resource for dispatching the thread to; dispatching the thread to the first resource and creating a power management event when the thread is dispatched to the first resource, wherein the power management event comprises a processing state transition of the first resource from the current power state to a target power state for the first resource; determining a third timestamp using utilization data, wherein the third timestamp is associated with a time when the first resource last transitioned to the current power state; and determining a time elapsed value for the first resource using the third timestamp, the time elapsed value being the difference in time between a present time and the third timestamp; obtaining a historical latency time value for the first resource, the historical latency time value being a time required to transition the hardware resource from the current power state to the target power state; comparing the time elapsed value and the historical latency time value to determine whether the power management event for the first resource satisfies a power management policy; and transitioning the first resource from the current power state to the target power state, when the time elapsed value is greater than the historical latency time value; and discarding the power management event if the elapsed time value is less than or equal to the historical latency time.