Shared Physical Memory Reclaim for Background App Switching
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
In scenarios where an application process and a hardware device share a physical memory, the physical memory is permanently occupied by the application process if it does not release the memory, leading to a decrease in available memory when the electronic device is insufficient.
Innovation Solution
The application process actively requests to reclaim the physical memory by sending commands to a memory processing apparatus, which modifies page tables to release and reallocate the memory, ensuring data security and enabling smooth service continuation.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If an application process shares physical memory with a hardware device, then memory usage efficiency is improved, but available memory decreases when the application process does not release the memory
Solution Approach 1:
The patent implements dynamic memory sharing where the application process can switch between foreground and background states. When in background, the memory is automatically released from the application process while maintaining the sharing capability. This dynamic state transition resolves the contradiction by making memory allocation flexible rather than static, allowing the same memory to be shared when needed and released when not needed.
Solution Approach 2:
The patent enables the system to discard (release) physical memory from the application process when it switches to background, and recover (reallocate) the same memory when the application process returns to foreground. This discarding and recovering mechanism ensures that memory is not permanently occupied, thus increasing available memory while maintaining efficient memory sharing when required.
2Quantity of substance
If physical memory is released when application process switches to background, then available memory increases, but data security may be compromised
Solution Approach 1:
The patent introduces a memory management module as an intermediary between the application process and the physical memory. This intermediary manages the memory release and reallocation process, ensuring that memory is properly released when the application process switches to background and securely reallocated when it returns to foreground. The intermediary prevents direct unauthorized access, thus maintaining data security while increasing available memory.
Solution Approach 2:
The patent implements a feedback mechanism where the system continuously monitors the state of the application process (foreground/background) and automatically adjusts memory allocation accordingly. When the application process switches to background, the system receives feedback and releases the memory; when it returns to foreground, the system reallocates the memory. This feedback loop ensures both memory availability and data security through automated, state-dependent memory management.
3Quantity of substance
If page table mapping is modified to release memory, then memory reclamation is achieved, but service continuity may be affected
Solution Approach 1:
The patent performs preliminary actions by pre-establishing the memory release mechanism before the application process actually needs the memory. When the application process switches to background, the memory is released in advance through page table modification. This preliminary action ensures that memory is available for other uses without affecting the application process, as the release happens during the state transition rather than during active service execution.
Solution Approach 2:
The patent uses dynamic page table modification to manage memory allocation. The page tables are updated in real-time based on the application process state, allowing seamless transition between memory allocated and released states. This dynamic approach ensures service continuity because the memory management adapts to the application process state without causing service interruption or requiring complex reallocation procedures.
Data Source
AI summary
Embodiments of this application provide a memory processing method, an electronic device, and a readable storage medium. In the method, in a scenario in which an application program and a hardware device share a first physical memory, when the application program is switched to a background, the application program sends a first command to a memory processing apparatus, where the first command indicates to release the first physical memory of the application program; and the memory processing apparatus releases the first physical memory in response to the first command. In embodiments of this application, when the application program is switched to the background, and temporarily does not need to use the first physical memory, the application program may actively request to release the first physical memory, to increase an available memory of an electronic device.


