1. A computer implemented method for a prefetch threshold for cache restoration, the method comprising: determining, based on a task switch from an outgoing task to a current task in a processor, a prefetch threshold for a next task, the prefetch threshold corresponding to an expected runtime of the current task and an amount of time required to prefetch data for the next task; starting prefetching for the next task while the current task is executing based on the prefetch threshold; determining a most recent runtime for the outgoing task; and determining an updated expected runtime for the outgoing task based on the most recent runtime of the outgoing task.