A method and system for managing the execution of threads uses a single
scheduler for both threads and work items. Objects representing the
threads and the work items are either maintained in separate queues or
are stored together in a single queue. Each thread object or work item
object may contain information that allows the scheduler to determine
what order to execute the corresponding threads or to process the
corresponding work items.