1. A computer-implemented method for thread-based cache content saving for task switching in a computer processor, the method comprising: based on a task switch in the computer processor from a first thread to a second thread: determining a cache entry in a cache of the computer processor that is owned by the first thread, wherein the determination is made based on a hardware thread identifier (ID) of the first thread matching a hardware thread ID in the cache entry, and wherein the hardware thread ID of the first thread comprises an index of a software thread ID of the first thread in a thread ID table of the computer processor; determining whether a software thread ID of the second thread matches an entry in the thread ID table; based on determining that the software thread ID of the second thread matches an entry in the thread ID table, setting an active hardware thread ID of the computer processor equal to an index of the determined cache entry in the thread ID table; and based on determining that the software thread ID of the second thread does not match any entry in the thread ID table: evicting an entry from the thread ID table; replacing the evicted entry with a new entry corresponding to the software thread ID of the second thread; and setting the active hardware thread ID of the computer processor equal to an index of the new entry in the thread ID table; determining whether the determined cache entry is eligible for prefetching; and based on determining that the determined cache entry is eligible for prefetching, setting a marker in the cache entry to active.