Claims
- 1. A method of balancing workload among a plurality of local run queues, comprising:
identifying a heaviest local run queue and a lightest local run queue, the heaviest local run queue being a local run queue with a highest load average and the lightest local run queue being a local run queue with a lowest load average; calculating a difference in load average between the heaviest local run queue and the lightest local run queue; and performing load balancing if the difference exceeds a threshold amount.
- 2. The method of claim 1, wherein performing load balancing includes:
identifying an unbound thread assigned to the heaviest local run queue; and reassigning the unbound thread to the lightest local run queue.
- 3. The method of claim 2, wherein reassigning the unbound thread includes:
obtaining a lock for the unbound thread; and changing a run queue pointer of the thread to identify the lightest local run queue.
- 4. The method of claim 2, wherein identifying an unbound thread includes:
obtaining a lock for the heaviest local run queue; and scanning the heaviest local run queue for an unbound thread, wherein the scanning of the heaviest local run queue starts with threads having a medium priority.
- 5. The method of claim 1, wherein if the lightest local run queue has benefited from idle load balancing within a determine period of time, load balancing is prevented.
- 6. The method of claim 3, wherein changing the run queue pointer of the thread to identify the lightest local run queue includes holding the thread in a temporary queue prior to changing the run queue pointer of the thread to identify the lightest local run queue.
- 7. The method of claim 1, wherein the threshold amount is 1.5.
- 8. The method of claim 5, wherein idle load balancing includes:
identifying an idle local run queue; scanning the plurality of local run queues for a run queue that satisfies idle load balancing criteria; and if a local run queue is found that satisfies the idle load balancing criteria, stealing a thread from the local run queue satisfying the idle load balancing criteria.
- 9. The method of claim 8, wherein scanning the plurality of local run queues for a run queue that satisfies idle load balancing criteria includes identifying a local run queue that has a largest number of threads, contains more threads than a selected threshold, and contains at least one unbound thread.
- 10. The method of claim 9, wherein the selected threshold is a fraction of a smoothed average load factor of the plurality of local run queues.
- 11. A computer program product in a computer readable medium for balancing workload among a plurality of local run queues, comprising:
first instructions for identifying a heaviest local run queue and a lightest local run queue, the heaviest local run queue being a local run queue with a highest load average and the lightest local run queue being a local run queue with a lowest load average; second instructions for calculating a difference in load average between the heaviest local run queue and the lightest local run queue; and third instructions for performing load balancing if the difference exceeds a threshold amount.
- 12. The computer program product of claim 11, wherein the third instructions include:
instructions for identifying an unbound thread assigned to the heaviest local run queue; and instructions for reassigning the unbound thread to the lightest local run queue.
- 13. The computer program product of claim 12, wherein the instructions for reassigning the unbound thread include:
instructions for obtaining a lock for the unbound thread; and instructions for changing a run queue pointer of the thread to identify the lightest local run queue.
- 14. The computer program product of claim 12, wherein the instructions for identifying an unbound thread include:
instructions for obtaining a lock for the heaviest local run queue; and instructions for scanning the heaviest local run queue for an unbound thread, wherein the scanning of the heaviest local run queue starts with threads having a medium priority.
- 15. The computer program product of claim 11, wherein the third instructions include instructions for not performing the load balancing if the lightest local run queue has benefited from idle load balancing within a determine period of time.
- 16. The computer program product of claim 13, wherein the instructions for changing the run queue pointer of the thread to identify the lightest local run queue include instructions for holding the thread in a temporary queue prior to changing the run queue pointer of the thread to identify the lightest local run queue.
- 17. The computer program product of claim 11, wherein the third instructions include instructions for setting the threshold amount to 1.5.
- 18. A workload balancing apparatus for balancing workload among a plurality of local run queues in a multiple run queue system, comprising:
means for identifying a heaviest local run queue and a lightest local run queue, the heaviest local run queue being a local run queue with a highest load average and the lightest local run queue being a local run queue with a lowest load average; means for calculating a difference in load average between the heaviest local run queue and the lightest local run queue; and means for performing load balancing if the difference exceeds a threshold amount.
- 19. The apparatus of claim 18, wherein the means for performing load balancing includes:
means for identifying an unbound thread assigned to the heaviest local run queue; and means for reassigning the unbound thread to the lightest local run queue.
- 20. The apparatus of claim 19, wherein the means for reassigning the unbound thread includes:
means for obtaining a lock for the unbound thread; and means for changing a run queue pointer of the thread to identify the lightest local run queue.
- 21. The apparatus of claim 19, wherein the means for identifying an unbound thread includes:
means for obtaining a lock for the heaviest local run queue; and means for scanning the heaviest local run queue for an unbound thread, wherein the scanning of the heaviest local run queue starts with threads having a medium priority.
- 22. The apparatus of claim 18, wherein the means for performing load balancing is inactive if the lightest local run queue has benefited from idle load balancing within a determine period of time.
- 23. The apparatus of claim 20, wherein the means for changing the run queue pointer of the thread to identify the lightest local run queue includes means for holding the thread in a temporary queue prior to changing the run queue pointer of the thread to identify the lightest local run queue.
- 24. The apparatus of claim 18, wherein the threshold amount is 1.5.
- 25. The apparatus of claim 23, wherein the means for idle load balancing includes:
means for identifying an idle local run queue; means for scanning the plurality of local run queues for a run queue that satisfies idle load balancing criteria; and means for stealing a thread, if a local run queue is found that satisfies the idle load balancing criteria, from the local run queue satisfying the idle load balancing criteria.
- 26. The apparatus of claim 26, wherein the means for scanning the plurality of local run queues for a run queue that satisfies idle load balancing criteria includes means for identifying a local run queue that has a largest number of threads, contains more threads than a selected threshold, and contains at least one unbound thread.
- 27. The apparatus of claim 26, wherein the selected threshold is a function of a smoothed average load factor of the plurality of local run queues.
- 28. A method of balancing workload among a plurality of processors, comprising:
identifying an idle processor from the plurality of processors; scanning the plurality of processors for a processor meeting idle load balancing criteria; and if a processor meeting the idle load balancing criteria is found, performing idle load balancing.
- 29. The method of claim 28, wherein scanning the plurality of processors for a processor that satisfies idle load balancing criteria includes identifying a processor having a local run queue that has a largest number of threads, contains more threads than a selected threshold, and contains at least one unbound thread.
- 30. The method of claim 29, wherein the selected threshold is a function of a smoothed average load factor of the plurality of processors.
- 31. A multiple processor system, comprising:
a plurality of processors; and a dispatcher, wherein each of the plurality of processors has an associated local run queue and wherein the dispatcher identifies a heaviest local run queue and a lightest local run queue, the heaviest local run queue being a local run queue with a highest load average and the lightest local run queue being a local run queue with a lowest load average, calculates a difference in load average between the heaviest local run queue and the lightest local run queue, and performs load balancing if the difference exceeds a threshold amount.
- 32. The system of claim 31, wherein the dispatcher performs load balancing by:
identifying an unbound thread assigned to the heaviest local run queue; and reassigning the unbound thread to the lightest local run queue.
- 33. The system of claim 32, wherein the dispatcher reassigns the unbound thread by:
obtaining a lock for the unbound thread; and changing a run queue pointer of the thread to identify the lightest local run queue.
- 34. The system of claim 32, wherein the dispatcher identifies an unbound thread by:
obtaining a lock for the heaviest local run queue; and scanning the heaviest local run queue for an unbound thread, wherein the scanning of the heaviest local run queue starts with threads having a medium priority.
- 35. The system of claim 31, wherein if the lightest local run queue has benefited from idle load balancing within a determine period of time, the dispatcher does not perform load balancing.
- 36. The system of claim 33, wherein the dispatcher holds the thread in a temporary queue prior to changing the run queue pointer of the thread to identify the lightest local run queue.
- 37. The system of claim 31, wherein the threshold amount is 1.5.
- 38. The system of claim 35, wherein the dispatcher performs idle load balancing by:
identifying an idle local run queue; scanning the plurality of local run queues for a run queue that satisfies idle load balancing criteria; and if a local run queue is found that satisfies the idle load balancing criteria, stealing a thread from the local run queue satisfying the idle load balancing criteria.
- 39. The system of claim 38, wherein the dispatcher scans the plurality of local run queues for a run queue that satisfies idle load balancing criteria by identifying a local run queue that has a largest number of threads, contains more threads than a selected threshold, and contains at least one unbound thread.
- 40. The system of claim 39, wherein the selected threshold is a function of a smoothed average load factor of the plurality of local run queues.
Parent Case Info
[0001] This application is directed to similar subject matter as commonly assigned U.S. patent application Nos. ______ and ______ (Attorney Docket Nos. AUS990793US1 and AUS990794US1), which are hereby incorporated by reference in their entirety.
Divisions (1)
|
Number |
Date |
Country |
Parent |
09506231 |
Feb 2000 |
US |
Child |
10449200 |
May 2003 |
US |