A method and apparatus for power management is disclosed. The invention reduces
power consumption in multiprocessing systems by dynamically adjusting processor
power based on system workload. Particularly, the method and apparatus determines
the number of required processors based on the number or active threads and sets
a processor affinity to run the active threads on the determined number of required
processors, thereby allowing the free processors to enter a low-power state.