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 that is executing
a thread, one stream as a team master stream and one stream 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
other team has notified that it is ready to be swapped out.