主权项 |
1. A method for migrating data between a volatile memory and a non-volatile memory, the method comprising:
receiving a first request to migrate the data from the volatile memory to the non-volatile memory, wherein:
the data corresponds to a first process having a first priority, andthe first request is received when a second process having a second priority greater than the first priority requires additional memory; in response to receiving the first request:
when a portion of the data corresponding to the first process can be designated for eviction from the volatile memory:
designating the portion of the data for eviction from the volatile memory, freezing the first process,in a first memory space of the volatile memory, determining a first set of memory locations that correspond to the portion of the data that is designated for eviction,for each memory location of the first set of memory locations, storing, to an auxiliary memory that is separate and distinct from each of the volatile memory and the non-volatile memory, a pointer that refers to the memory location,for each pointer stored in the auxiliary memory, copying the portion of the data in the volatile memory referenced by the pointer to the non-volatile memory using one or more selected memory locations that are within a second memory space of the non-volatile memory, wherein the second process is allowed access to the portion of the data in the one or more selected memory locations associated with the non-volatile memory after the portion of the data is evicted from the volatile memory, andstoring, in the auxiliary memory, information about the one or more selected memory locations; receiving a second request to migrate the portion of the data from the non-volatile memory to the volatile memory, wherein the second request is triggered based on a reactivation of the first process that was previously frozen in response to receiving the first request; and in response to receiving the second request:
copying, based on the information about the one or more selected memory locations stored in the auxiliary memory, the portion of the data from the non-volatile memory to the volatile memory. |