1. A method comprising: detecting a context switch request; in response to detecting the context switch request, performing the operations: halting a master thread from creating new worker threads, estimating a retirement rate of a state associated with a plurality of worker threads; and determining, based upon the estimated state retirement rate associated with the worker threads and a rate of saving state of the worker threads, if the worker threads should be halted and the state of the worker threads saved to a memory; wherein in response to the determining, halting and saving the state of the worker threads to the memory if the rate of saving is greater than the estimated state retirement rate, and wherein the rate of saving is determined based on a portion of a bandwidth available to write to the memory.