A method and system that prepares a task for being swapped out from processor
utilization
that is executing on a computer with multiple processors that each support multiple
streams. The task has one or more teams of threads, where each team represents
threads executing on a single processor. The task designates, for each stream,
one stream that is executing a thread as a team master stream. The task designates
one stream that is executing a thread as a task master stream. For each team master
stream, the task notifies the operating system that the team is ready to be swapped
out when each other thread of the team has saved its state and has quit its stream.
Finally, for the task master stream, the task notifies the operating system that
the task is ready to be swapped when it has saved its state and each of the other
teams have notified the operating system that that team is ready to be swapped out.