Claims
- 1. A method comprising:
managing a multi-dimensional sleep queue, the managing comprising:
inserting a thread into the multi-dimensional sleep queue; and removing the thread from the multi-dimensional sleep queue.
- 2. A method as recited in claim 1, wherein the multi-dimensional sleep queue is a real-time multi-dimensional sleep queue.
- 3. A method as recited in claim 1, wherein the multi-dimensional sleep queue is a two-dimensional sleep queue.
- 4. A method as recited in claim 1, wherein inserting a thread into the multi-dimensional sleep queue is performed in a manner that allows a thread scheduling mechanism to schedule other threads for execution within a deterministic amount of time.
- 5. A method as recited in claim 1, wherein inserting a thread into the multi-dimensional sleep queue further comprises:
inserting the thread into the multi-dimensional sleep queue such that a group of threads can be removed from the multi-dimensional sleep queue in a deterministic amount of time.
- 6. A method as recited in claim 1, wherein the multi-dimensional sleep queue comprises a group of threads, and wherein the method further comprises:
removing the group of threads from the multi-dimensional sleep queue in a deterministic amount of time, each thread in the group having a same wake-up time.
- 7. A method as recited in claim 1, wherein the thread has a wake-up time and a priority; and
wherein inserting the thread into the multi-dimensional sleep queue further comprises:
sorting the thread with respect to a first dimension of threads and a second dimension of threads, the first dimension of threads being sorted based on respective thread wake-up times, the second dimension of threads being sorted based on respective thread priorities, the thread being sorted first with respect to the first dimension and second with respect to the second dimension.
- 8. A method as recited in claim 7, wherein the first dimension of threads comprises a plurality of threads, each thread in the first plurality having a different respective thread wake-up time.
- 9. A method as recited in claim 7, wherein the second dimension of threads comprises a plurality of threads, each thread in the second plurality having a same respective thread wake-up time.
- 10. A method as recited in claim 7, wherein the thread is a new thread, and wherein sorting the thread further comprises:
determining that a wake-up time corresponding to the new thread is different as compared to each respective wake-up time of each other thread in the first dimension of threads; and responsive to the determining, introducing the new thread into the first dimension of threads.
- 11. A method as recited in claim 7, wherein sorting the thread further comprises:
identifying a different thread in the first dimension of threads that has a same wake-up time as the new thread wake-up time; and responsive to identifying the different thread:
concluding that a first priority corresponding to the new thread priority is higher than a second priority corresponding to the different thread; and replacing the different thread in the first dimension with the new thread, such the new thread is a member of both the first and the second dimensions of threads, and such that the replaced thread has a secondary position with respect to the first and second dimensions of threads.
- 12. A method as recited in claim 7, wherein sorting the thread further comprises:
identifying a different thread in the first dimension of threads that has a same wake-up time as the new thread wake-up time; responsive to identifying the different thread:
determining that a first priority corresponding to the new thread is lower than a second priority that corresponds to the different thread; and inserting the new thread into the second dimension of threads, such the new thread occupies a secondary position with respect to the first and second dimensions of threads.
- 13. A computer-readable medium comprising computer-executable instructions for:
managing a multi-dimensional sleep queue, the instructions for managing comprising:
inserting a thread into the multi-dimensional sleep queue; and removing the thread from the multi-dimensional sleep queue.
- 14. A computer-readable medium as recited in claim 13, wherein the multi-dimensional sleep queue is a real-time multi-dimensional sleep queue.
- 15. A computer-readable medium as recited in claim 13, wherein the instructions for inserting a thread into the multi-dimensional sleep queue are performed in a manner that allows a thread scheduling mechanism to schedule other threads for execution in a deterministic amount of time.
- 16. A computer-readable medium as recited in claim 13, wherein the instructions for inserting a thread into the multi-dimensional sleep queue further comprise instructions for:
inserting the thread into the multi-dimensional sleep queue such that a group of threads can be removed from the multi-dimensional sleep queue in a deterministic amount of time.
- 17. A computer-readable medium as recited in claim 13, wherein the multi-dimensional sleep queue comprises a group of threads, and wherein the computer-executable instructions further comprise instructions for:
removing the group of threads from the multi-dimensional sleep queue in a deterministic amount of time, each thread in the group having a same wake-up time.
- 18. A computer-readable medium as recited in claim 13, wherein the thread has a wake-up time and a priority; and
wherein the instructions for inserting the thread into the multi-dimensional sleep queue further comprise instructions for:
sorting the thread with respect to a first dimension of threads and a second dimension of threads, the first dimension of threads being sorted based on respective thread wake-up times, the second dimension of threads being sorted based on respective thread priorities, the thread being sorted first with respect to the first dimension and second with respect to the second dimension.
- 19. A computer-readable medium as recited in claim 18, wherein the first dimension of threads comprises a plurality of threads, each thread in the first plurality having a different respective thread wake-up time.
- 20. A computer-readable medium as recited in claim 18, wherein the second dimension of threads comprises a plurality of threads, each thread in the second plurality having a same respective thread wake-up time.
- 21. A computer-readable medium as recited in claim 18, wherein the thread is a new thread, and wherein the instructions for sorting the thread further comprise instructions for:
determining that a wake-up time corresponding to the new thread is different as compared to each respective wake-up time of each other thread in the first dimension of threads; and responsive to the determining, introducing the new thread into the first dimensions.
- 22. A computer-readable medium as recited in claim 18, wherein the instructions for sorting the thread further comprise instructions for:
identifying a different thread in the first dimension of threads that has a same wake-up time as the new thread wake-up time; and responsive to identifying the different thread:
concluding that a first priority corresponding to the new thread priority is higher than a second priority corresponding to the different thread; and replacing the different thread in the first dimension with the new thread, such the new thread is a member of both the first and the second dimensions of threads, and such that the replaced thread has a secondary position with respect to the first and second dimensions of threads.
- 23. A computer-readable medium as recited in claim 18, wherein the instructions for sorting the thread further comprise instructions for:
identifying a different thread in the first dimension of threads that has a same wake-up time as the new thread wake-up time; responsive to identifying the different thread:
determining that a first priority corresponding to the new thread is lower than a second priority that corresponds to the different thread; and inserting the new thread into the second dimension of threads, such the new thread occupies a secondary position with respect to the first and second dimensions of threads.
- 24. A method for managing a multi-dimensional sleep queue comprising:
inserting a new thread into the multi-dimensional sleep queue using a multi-dimensional atomic walk procedure; and removing the new thread from the multi-dimensional sleep queue for insertion into a run queue.
- 25. A method as recited in claim 24, wherein inserting the new thread further comprises:
if the new thread is a first thread, setting a last examined thread to reference the new thread, the last examined thread being used to identify an insertion point for the new thread.
- 26. A method as recited in claim 24, further comprising:
removing a group of threads from the multi-dimensional sleep queue in a deterministic amount of time.
- 27. A method as recited in claim 24, further comprising:
removing a group of threads from the sleep queue in a deterministic amount of time, each thread in the group of threads having a same wake-up time.
- 28. A method as recited in claim 27, wherein the deterministic amount of time is independent of a number of threads in the group of threads.
- 29. A method as recited in claim 24, wherein the multi-dimensional sleep queue comprises at least one other thread, and wherein inserting the new thread further comprises:
establishing a thread insertion point in the multi-dimensional sleep queue for the new thread; and introducing the new thread into the multi-dimensional sleep queue at the insertion point.
- 30. A method as recited in claim 29, wherein establishing the thread insertion point further comprises:
determining if a status of a last examined thread has changed, the status indicating either that the last examined thread was removed from the multi-dimensional sleep queue, or indicating that the last examined thread was moved from a first dimension of threads that is sorted based on respective thread wake-up times, to a second dimension of threads that is ordered based on respective thread priorities; if the status of the last examined thread has changed, searching for the thread insertion point from a beginning of the multidimensional sleep queue; and if the status of the last examined thread has not changed, searching for the thread insertion point from the last examined thread.
- 31. A computer-readable medium comprising computer-executable instructions for managing a sleep queue, the computer executable instructions comprising instructions for:
inserting a new thread into the sleep queue using a multi-dimensional atomic walk procedure; and removing the new thread from the sleep queue for insertion into a run queue.
- 32. A computer-readable medium as recited in claim 31, wherein instructions for inserting the new thread further comprise instructions for:
if the new thread is a first thread, setting a last examined thread to reference the new thread, the last examined thread being used to identify an insertion point for the new thread.
- 33. A computer-readable medium as recited in claim 31, further comprising instructions for:
removing a group of threads from the sleep queue in a deterministic amount of time.
- 34. A computer-readable medium as recited in claim 31, further comprising instructions for:
removing a group of threads from the sleep queue in a deterministic amount of time, each thread in the group of threads having a same wake-up time.
- 35. A computer-readable medium as recited in claim 34, wherein the deterministic amount of time is independent of a number of threads in the group of threads.
- 36. A computer-readable medium as recited in claim 31, wherein the multi-dimensional sleep queue comprises at least one other thread, and wherein the instructions for inserting the new thread further comprise instructions for:
establishing a thread insertion point in the multi-dimensional sleep queue for the new thread; and introducing the new thread into the multi-dimensional sleep queue at the insertion point.
- 37. A computer-readable medium as recited in claim 36, wherein the instructions for establishing the thread position further comprise instructions for:
determining if a status of a last examined thread has changed, the status indicating either that the last examined thread was removed from the multi-dimensional sleep queue, or indicating that the last examined thread was moved from a first dimension of threads that is sorted based on respective thread wake-up times, to a second dimension of threads that is ordered based on respective thread priorities; if the status of the last examined thread has changed, searching for the thread insertion point from a beginning of the multidimensional sleep queue; and if the status of the last examined thread has not changed, searching for the thread insertion point from the last examined thread.
- 38. A computer comprising one or more computer-readable media as recited in claim 31.
- 39. A system for managing a sleep queue, the system comprising:
a memory comprising computer-executable instructions and a multi-dimensional sleep queue; a processor operatively coupled to the memory for executing the computer-executable instructions, the computer-executable instructions comprising instructions for:
inserting a thread into a multi-dimensional sleep queue; and removing the thread from the multi-dimensional sleep queue.
- 40. A system as recited in claim 39, wherein the multi-dimensional sleep queue is a real-time multi-dimensional sleep queue.
- 41. A system as recited in claim 39, wherein the instructions for inserting the thread are performed in a manner that allows a thread scheduling mechanism to schedule other threads for execution in a deterministic amount of time.
- 42. A system as recited in claim 39, wherein the instructions for inserting the thread further comprise instructions for:
inserting the thread into the multi-dimensional sleep queue such that a group of threads can be removed from the multi-dimensional sleep queue in a deterministic amount of time.
- 43. A system as recited in claim 39, wherein the multi-dimensional sleep queue further comprises a group of threads, and wherein the computer-executable instructions further comprise instructions for:
inserting the group of threads into the multi-dimensional sleep queue; and removing the group of threads from the multi-dimensional sleep queue in a deterministic amount of time, each thread in the group having a same wake-up time.
- 44. A system as recited in claim 39, wherein the thread has a wake-up time and a priority, and wherein the instructions for inserting the thread further comprise instructions for:
sorting the thread with respect to a first dimension of threads and a second dimension of threads, the first dimension of threads being sorted based on respective thread wake-up times, the second dimension of threads being sorted based on respective thread priorities, the thread being sorted first with respect to the first dimension and second with respect to the second dimension.
- 45. A system as recited in claim 44, wherein the first dimension of threads comprises a plurality of threads, each thread in the first plurality having a different respective thread wake-up time.
- 46. A system as recited in claim 44, wherein the second dimension of threads comprises a plurality of threads, each thread in the second plurality having a same respective thread wake-up time.
- 47. A system as recited in claim 44, wherein the thread is a new thread, and wherein the instructions for sorting the thread further comprise instructions for:
determining that a wake-up time corresponding to the new thread is different as compared to each respective wake-up time of each other thread in the first dimension of threads; and responsive to determining that the wake-up time is different, introducing the new thread into the first dimension of threads.
- 48. A system as recited in claim 44, wherein the instructions for sorting the thread further comprise instructions for:
identifying a different thread in the first dimension of threads that has a same wake-up time as the new thread wake-up time; and responsive to identifying the different thread:
concluding that a first priority corresponding to the new thread priority is higher than a second priority corresponding to the different thread; and replacing the different thread in the first dimension with the new thread, such the new thread is a member of both the first and the second dimensions of threads, and such that the replaced thread has a secondary position with respect to the first and second dimensions of threads.
- 49. A system as recited in claim 44, wherein the instructions for sorting the thread further comprise instructions for:
identifying a different thread in the first dimension of threads that has a same wake-up time as the new thread wake-up time; responsive to identifying the different thread:
determining that a first priority corresponding to the new thread is lower than a second priority that corresponds to the different thread; and inserting the new thread into the second dimension of threads, such the new thread occupies a secondary position with respect to the first and second dimensions of threads.
- 50. A sleep queue data structure comprising:
a first dimension data field for queuing threads based on wake-up time; and a second dimension data field for queuing threads based on priority within a particular wake-up time.
- 51. A sleep queue data structure as recited in claim 50, wherein the first and second data fields are configured with respect to one another such that a thread scheduling mechanism can remove a group of threads from the sleep queue data structure in a determinative amount of time.
- 52. A sleep queue data structure as recited in claim 50, wherein determinative amount of time is independent of a number of threads in the group of threads.
- 53. A sleep queue data structure as recited in claim 50, wherein the first and second dimension data fields further comprise:
a thread data field comprising:
a wake-up time data field; and a priority data field;
- 54. A sleep queue data structure as recited in claim 50, wherein the sleep queue data structure is a linked list sleep queue data structure.
- 55. A sleep queue data structure as recited in claim 50, wherein the sleep queue data structure is configured such that a thread can be inserted into the sleep queue data structure using a multi-dimensional atomic walk procedure.
- 56. A computer-readable medium comprising a data structure as recited in claim 50.
RELATED APPLICATIONS
[0001] This patent application is related to U.S. patent application Ser. No. ______, filed on ______, and titled “Run Queue Management”, which is hereby incorporated by reference.