WO2022078105A1 - 内存管理方法、电子设备以及计算机可读存储介质 - Google Patents
内存管理方法、电子设备以及计算机可读存储介质 Download PDFInfo
- Publication number
- WO2022078105A1 WO2022078105A1 PCT/CN2021/116550 CN2021116550W WO2022078105A1 WO 2022078105 A1 WO2022078105 A1 WO 2022078105A1 CN 2021116550 W CN2021116550 W CN 2021116550W WO 2022078105 A1 WO2022078105 A1 WO 2022078105A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- state
- memory
- resources
- resource
- management method
- Prior art date
Links
- 230000015654 memory Effects 0.000 title claims abstract description 279
- 238000007726 management method Methods 0.000 title claims abstract description 92
- 238000003860 storage Methods 0.000 title claims abstract description 54
- 238000000034 method Methods 0.000 claims abstract description 626
- 230000008569 process Effects 0.000 claims abstract description 601
- 238000004590 computer program Methods 0.000 claims description 10
- 230000001976 improved effect Effects 0.000 abstract description 13
- 238000004891 communication Methods 0.000 description 33
- 230000006854 communication Effects 0.000 description 33
- 238000013461 design Methods 0.000 description 29
- 230000008859 change Effects 0.000 description 27
- 230000006870 function Effects 0.000 description 23
- 238000012545 processing Methods 0.000 description 21
- 230000005236 sound signal Effects 0.000 description 13
- 238000010295 mobile communication Methods 0.000 description 12
- 210000000988 bone and bone Anatomy 0.000 description 11
- 238000001514 detection method Methods 0.000 description 9
- 238000010586 diagram Methods 0.000 description 9
- 210000004027 cell Anatomy 0.000 description 8
- 238000005516 engineering process Methods 0.000 description 6
- 230000000694 effects Effects 0.000 description 5
- 230000007246 mechanism Effects 0.000 description 5
- 238000013528 artificial neural network Methods 0.000 description 4
- 238000004364 calculation method Methods 0.000 description 4
- 238000004064 recycling Methods 0.000 description 4
- 230000004044 response Effects 0.000 description 4
- 229920001621 AMOLED Polymers 0.000 description 3
- 230000001133 acceleration Effects 0.000 description 3
- 230000001413 cellular effect Effects 0.000 description 3
- 230000002093 peripheral effect Effects 0.000 description 3
- 230000001360 synchronised effect Effects 0.000 description 3
- 230000002159 abnormal effect Effects 0.000 description 2
- 230000036772 blood pressure Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000005192 partition Methods 0.000 description 2
- 239000002096 quantum dot Substances 0.000 description 2
- 230000005855 radiation Effects 0.000 description 2
- 238000009877 rendering Methods 0.000 description 2
- 230000000007 visual effect Effects 0.000 description 2
- 238000013473 artificial intelligence Methods 0.000 description 1
- 230000003416 augmentation Effects 0.000 description 1
- 230000003190 augmentative effect Effects 0.000 description 1
- 238000010009 beating Methods 0.000 description 1
- 230000008901 benefit Effects 0.000 description 1
- 230000007175 bidirectional communication Effects 0.000 description 1
- 230000002457 bidirectional effect Effects 0.000 description 1
- 238000013529 biological neural network Methods 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 210000004556 brain Anatomy 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 230000019771 cognition Effects 0.000 description 1
- 230000000295 complement effect Effects 0.000 description 1
- 239000004020 conductor Substances 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000009826 distribution Methods 0.000 description 1
- 230000004927 fusion Effects 0.000 description 1
- 230000005484 gravity Effects 0.000 description 1
- 230000003862 health status Effects 0.000 description 1
- 230000001939 inductive effect Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 239000010985 leather Substances 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 230000004807 localization Effects 0.000 description 1
- 230000007774 longterm Effects 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 239000011159 matrix material Substances 0.000 description 1
- 210000002569 neuron Anatomy 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 238000012913 prioritisation Methods 0.000 description 1
- 238000011112 process operation Methods 0.000 description 1
- 238000011084 recovery Methods 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 230000002441 reversible effect Effects 0.000 description 1
- 238000005070 sampling Methods 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 230000003238 somatosensory effect Effects 0.000 description 1
- 230000006641 stabilisation Effects 0.000 description 1
- 238000011105 stabilization Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 210000000352 storage cell Anatomy 0.000 description 1
- 230000026676 system process Effects 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
- 230000001755 vocal effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45504—Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
- G06F9/5016—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/485—Task life-cycle, e.g. stopping, restarting, resuming execution
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
- G06F9/5022—Mechanisms to release resources
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/52—Program synchronisation; Mutual exclusion, e.g. by means of semaphores
- G06F9/526—Mutual exclusion algorithms
Definitions
- the embodiments of the present application relate to the field of computer technologies, and in particular, to a memory management method, an electronic device, and a computer-readable storage medium.
- a terminal can run various processes, and the process can be a system process of an operating system and an application process of an application.
- each process will occupy a certain amount of memory during the running process and store its own data in the memory.
- the memory occupied by the process needs to be reclaimed to ensure that the free memory of the terminal meets the memory requirements.
- the Low Memory Killer (LMK) of the current Android system cannot release the memory occupied by processes in an uninterruptible sleep state.
- Embodiments of the present application provide a memory management method, an electronic device, and a computer-readable storage medium, which can improve the stability of an operating system and improve user experience.
- an embodiment of the present application provides a memory management method, including: obtaining a resource requirement corresponding to a waiting process of a process in a kernel space; if it is detected that the first process is in a first state and satisfies a preset condition, changing to the first state If it is detected that the released system resources meet the resource requirements of the first process in the second state, the state of the first process is changed, And swap in memory resources.
- the electronic device can change the first process in the first state to: In the second state, the memory resources of the first process are swapped out. Therefore, the problem that the operating system is in an uninterruptible sleep state due to some processes for a long time can be avoided, the stability of the operating system can be improved, and the electronic equipment can be prevented from being stuck. phenomenon to improve the user experience.
- the method further includes: if it is detected that the released system resources meet the resource requirements of the first process in the second state, changing the state of the first process to the third state, and changing the state of the first process to the third state. into the memory resource.
- the first process in the second state directly acquires the waiting resources after swapping in the memory resources, and can then switch to the first process in the second state. Three states, so that the process can be resumed and the user experience can be improved.
- the method further includes: if it is detected that the released system resources meet the resource requirements of the first process in the second state, changing the state of the first process to the first state, and the system gives the resources to the first process. Based on this design, when the released system resources meet the resource requirements of the first process in the second state, the first process in the first state can be swapped in and then switched to the first state. Therefore, the first process in the first state can be switched to the first state. A process can switch to the third state after acquiring the waiting resource, whereby the process can be resumed.
- the resource required by the resource includes at least one of a memory resource, an IO resource, and a lock resource.
- the type of the released system resources can be used, and then the process can be correspondingly restored, Improved operating system stability.
- the method before changing the first process in the first state to the second state, the method further includes: swapping out storage space for the first process; changing the process of the first process Information is stored in the storage space.
- the process information of the first process can be stored in the storage space to prevent data loss and ensure data security.
- the method further includes: if the resource requirement of the first process is memory resources; if the released system is detected If the resource meets the memory resource that the first process is waiting for, the state of the first process is changed, and the memory resource is swapped in.
- the resource requirement of the first process is memory resources, the process can be restored according to the released memory resources, which improves the stability of the operating system.
- the method further includes: if the resource requirement of the first process is IO resources; if the released system is detected If the resource meets the IO resource that the first process is waiting for, the state of the first process is changed, and the memory resource is swapped in. Therefore, when the resource requirement of the first process is IO resources, the process can be resumed according to the released IO resources, thereby improving the stability of the operating system.
- the method further includes: if the resource requirement of the first process is a lock resource; if a released system is detected If the resource satisfies the lock resource that the first process is waiting for, the state of the first process is changed, and the memory resource is swapped in. Therefore, when the resource requirement of the first process is the lock resource, the process can be resumed according to the released lock resource, thereby further improving the stability of the operating system.
- the process information includes at least one of a process identifier, a time when the process is in the first state, and a data information state of the process. Therefore, when the memory resources of the first process need to be swapped out, the process information of the first process can be stored in the storage space to prevent data loss and ensure data security.
- the method further includes: acquiring the memory size occupied by the first process and the time when the first process enters the first state; based on the memory size occupied by the first process and the time when the first process enters the first state The time when the first process enters the first state, obtain the swap-out priority of the first process; based on the swap-out priority of the first process, determine the first process to be swapped out in the first process . Therefore, the first process that occupies a large amount of memory and enters the first state for a long time can be preferentially swapped out, so that the memory resources occupied by the first process can be swapped out in time, thereby improving the operating efficiency of the system.
- an embodiment of the present application further provides a memory management device, where the memory management device includes:
- the detection module is used to obtain the corresponding waiting resource requirements of the process in the kernel space.
- the process management module is configured to change the first process in the first state to the second state and swap out the memory resources of the first process if it is detected that the first process is in the first state and satisfies the preset condition.
- the process management module is further configured to: if it is detected that the released system resources meet the resource requirements of the first process in the second state, change the state of the first process and swap in memory resources.
- the electronic device can change the first state by changing the first state.
- the process is in the second state, and the memory resources of the first process are swapped out. Therefore, the problem that the operating system is in an uninterruptible sleep state for a long time due to some processes can be avoided, the stability of the operating system can be improved, and the appearance of electronic devices can be avoided. Caton phenomenon, improve user experience.
- the process management module is further configured to change the state of the first process to the third state if it is detected that the released system resources meet the resource requirements of the first process in the second state, And swap in memory resources. Based on this design, when the released system resources meet the resource requirements of the first process in the second state, the first process in the second state directly acquires the waiting resources after swapping in the memory resources, and can then switch to the first process in the second state. Three states, so that the process can be resumed and the user experience can be improved.
- the process management module is further configured to change the state of the first process to the first state if it is detected that the released system resources meet the resource requirements of the first process in the second state, The system gives resources to the first process.
- the first process in the first state can be swapped in and then switched to the first state. Therefore, the first process in the first state can be switched to the first state.
- the first process can switch to the third state after acquiring the waiting resource, so that the process can be resumed.
- the memory management device further includes:
- the allocation module before the process management module changes the first process in the first state to the second state, the allocation module is further configured to swap out storage space for the first process;
- a storage module configured to store the process information of the first process in the storage space.
- the process information of the first process can be stored in the storage space to prevent data loss and ensure data security.
- the detection module is further configured to: the memory management device further includes a determination module,
- the detection module is used to obtain the memory size occupied by the first process and the time when the first process enters the first state, and based on the memory size occupied by the first process and the first process entering the first state.
- the swap-out priority of the first process is obtained; the determining module is configured to determine the first process to be swapped out in the first process according to the swap-out priority of the first process, That is, it is used to determine the priority order of the multiple first processes in the first state to swap out memory resources.
- the first process that occupies a large amount of memory and enters the first state for a long time can be preferentially swapped out, and the memory resources occupied by the first process can be swapped out in time, thereby improving the operating efficiency of the system.
- the embodiments of the present application also provide an electronic device, including:
- a processor for executing the computer program stored in the memory and when the computer program is executed, the processor for executing the method as described above. Therefore, by changing the first process in the first state to the second state and swapping out the memory resources of the first process, the stability of the operating system can be improved, the electronic device can be prevented from being stuck, and the user experience can be improved.
- the electronic device can change the first process in the first state to: In the second state, the memory resources of the first process are swapped out. Therefore, the problem that the operating system is in an uninterruptible sleep state due to some processes for a long time can be avoided, the stability of the operating system can be improved, and the electronic equipment can be prevented from being stuck. phenomenon to improve the user experience.
- embodiments of the present application further provide a computer-readable storage medium, where the computer-readable storage medium includes computer instructions, and when the computer instructions are executed on an electronic device, the electronic device is made to execute the above-mentioned the method described. Therefore, by changing the first process in the first state to the second state and swapping out the memory resources of the first process, the stability of the operating system can be improved, the electronic device can be prevented from being stuck, and the user experience can be improved.
- the electronic device when the system is in a low memory state or some processes are in an uninterruptible sleep state for more than a preset time, the electronic device can change the first process in the uninterruptible sleep state to the second state, and replace the The memory resources of the first process can improve the stability of the operating system, prevent the electronic device from being stuck, and improve the user experience.
- FIG. 1 is a schematic diagram of an electronic device to which the memory management method provided by the embodiment of the present application is applied.
- FIG. 2 is a schematic structural diagram of an operating system provided by an embodiment of the present application.
- FIG. 3 is a schematic flowchart of a memory management method provided by an embodiment of the present application.
- FIG. 4 is a schematic flowchart of another memory management method provided by an embodiment of the present application.
- FIG. 5 is a schematic flowchart of another memory management method provided by an embodiment of the present application.
- FIG. 6 is a schematic flowchart of another memory management method provided by an embodiment of the present application.
- FIG. 7 is a state switching diagram of a process in a kernel space in an embodiment of the present application.
- FIG. 8 is a schematic diagram of a process operation in an embodiment of the present application.
- FIG. 9 is a schematic flowchart of another memory management method provided by an embodiment of the present application.
- FIG. 10 is a schematic flowchart of another memory management method provided by an embodiment of the present application.
- FIG. 11 is a schematic flowchart of another memory management method provided by an embodiment of the present application.
- FIG. 12 is a schematic structural diagram of a memory management apparatus provided by an embodiment of the present application.
- Air pressure sensor 180C Air pressure sensor 180C
- Proximity light sensor 180G is Proximity light sensor 180G
- the embodiments of the present application disclose a memory management method, an electronic device, and a computer-readable storage medium, which can improve the stability of an operating system, prevent the electronic device from stalling, and improve user experience.
- the memory management method provided by the embodiments of the present application can be applied to electronic equipment, and the electronic equipment may also be referred to as user equipment (User Equipment, UE), mobile station (Mobile Station, MS), mobile terminal (Mobile Terminal), and the like.
- the electronic device may be capable of communicating with a radio access network (Radio Access Network, RAN) and one or more core networks, for example, the electronic device may be a mobile phone (or referred to as a "cellular" phone) , or a mobile computer, etc.
- the operating system of the electronic device may include, but is not limited to, Linux system, Android (Android) system, IOS operating system, Symbian (Symbian) operating system, BlackBerry (Blackberry) operating system, Windows Phone 8 operating system, and the like. It can be understood that the memory management method provided by the embodiment of the present application can be applied to an electronic device having a Linux operating system.
- Kernel space and user space The operating system, as the kernel of a computing device, is independent of ordinary applications, can access protected memory space, and has all permissions to access underlying hardware devices.
- the operating system divides the addressing space (the addressing space can be a part of the memory of the computing device or a virtual storage space) into two parts, one part is The kernel space, which is a protected memory space, is used to store the code and data of the kernel; the other part is the user space, which is used to store the code and data of the application.
- Kernel mode and user mode when a process executes the code of the user program, the process is said to be in user mode.
- the process when a process executes a system call and falls into the execution of the kernel code, the process is said to be in the kernel state.
- User-mode processes run in user space
- kernel-mode processes run in kernel space.
- a sleep state interruptible process also known as a task_interruptable state process: also known as an S state process, when the process execution conditions are met, the sleep state interruptible process will be awakened to start the process. .
- An uninterruptible process in the sleep state also known as an uninterruptible sleep (task_uninterruptable) state process: also known as a D state process, usually formed because the I/O resources are not satisfied, the process is in a sleep state, but The process is now uninterruptible.
- Uninterruptible means that the CPU does not respond to external hardware interrupts, but that the process does not respond to asynchronous signals. It can be understood that the meaning of the uninterruptible sleep state is that some processing flows of the kernel cannot be interrupted. If you respond to an asynchronous signal, a process for processing asynchronous signals will be inserted into the execution process of the program. This inserted process may only exist in kernel mode, or may extend to user mode, so the original process will be interrupted .
- a process in the executable (task_running) state is also called an R state process.
- the process in this state can run on the CPU.
- the executable state indicates that the process can run but does not acquire CPU resources.
- a process in the suspended state (task_stopped) is also called a T-state process.
- the suspended state means that the process is suspended and cannot be run.
- a process with an exit status (task_dead), also known as a Z-state process, indicates that the process has begun to exit.
- each process corresponds to a task_stuct data structure.
- the task_stuct data structure will be loaded into the memory and contain process information.
- Each process will Its information is put into this data structure.
- FIG. 1 shows a schematic structural diagram of an electronic device 100 .
- the electronic device 100 may be a cell phone, tablet computer, desktop computer, laptop computer, handheld computer, notebook computer, ultra-mobile personal computer (UMPC), netbook, as well as cellular telephones, personal digital assistants (personal digital assistants) digital assistant (PDA), augmented reality (AR) devices, virtual reality (VR) devices, artificial intelligence (AI) devices, wearable devices, in-vehicle devices, smart home devices and/or Smart city equipment, the embodiments of the present application do not specifically limit the specific type of the electronic equipment.
- PDA personal digital assistants
- AR augmented reality
- VR virtual reality
- AI artificial intelligence
- the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charge management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2 , mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, buttons 190, motor 191, indicator 192, camera 193, display screen 194, and Subscriber identification module (subscriber identification module, SIM) card interface 195 and so on.
- SIM Subscriber identification module
- the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, and ambient light. Sensor 180L, bone conduction sensor 180M, etc.
- the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the electronic device 100 .
- the electronic device 100 may include more or less components than shown, or combine some components, or separate some components, or arrange different components.
- the illustrated components may be implemented in hardware, software, or a combination of software and hardware.
- the processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), controller, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (neural-network processing unit, NPU), etc. Wherein, different processing units may be independent devices, or may be integrated in one or more processors.
- application processor application processor, AP
- modem processor graphics processor
- ISP image signal processor
- controller video codec
- digital signal processor digital signal processor
- baseband processor baseband processor
- neural-network processing unit neural-network processing unit
- the controller can generate an operation control signal according to the instruction operation code and timing signal, and complete the control of fetching and executing instructions.
- a memory may also be provided in the processor 110 for storing instructions and data.
- the memory in processor 110 is cache memory. This memory may hold instructions or data that have just been used or recycled by the processor 110 . If the processor 110 needs to use the instruction or data again, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby increasing the efficiency of the system.
- the processor 110 may include one or more interfaces.
- the interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous transceiver (universal asynchronous transmitter) receiver/transmitter, UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and / or universal serial bus (universal serial bus, USB) interface, etc.
- I2C integrated circuit
- I2S integrated circuit built-in audio
- PCM pulse code modulation
- PCM pulse code modulation
- UART universal asynchronous transceiver
- MIPI mobile industry processor interface
- GPIO general-purpose input/output
- SIM subscriber identity module
- USB universal serial bus
- the I2C interface is a bidirectional synchronous serial bus that includes a serial data line (SDA) and a serial clock line (SCL).
- the processor 110 may contain multiple sets of I2C buses.
- the processor 110 can be respectively coupled to the touch sensor 180K, the charger, the flash, the camera 193, etc. through different I2C bus interfaces.
- the processor 110 may couple the touch sensor 180K through the I2C interface, so that the processor 110 and the touch sensor 180K communicate with each other through the I2C bus interface, so as to realize the touch function of the electronic device 100 .
- the I2S interface can be used for audio communication.
- the processor 110 may contain multiple sets of I2S buses.
- the processor 110 may be coupled with the audio module 170 through an I2S bus to implement communication between the processor 110 and the audio module 170 .
- the audio module 170 can transmit audio signals to the wireless communication module 160 through the I2S interface, so as to realize the function of answering calls through a Bluetooth headset.
- the PCM interface can also be used for audio communications, sampling, quantizing and encoding analog signals.
- the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface.
- the audio module 170 can also transmit audio signals to the wireless communication module 160 through the PCM interface, so as to realize the function of answering calls through the Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
- the UART interface is a universal serial data bus used for asynchronous communication.
- the bus may be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication.
- a UART interface is typically used to connect the processor 110 with the wireless communication module 160 .
- the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function.
- the audio module 170 can transmit audio signals to the wireless communication module 160 through the UART interface, so as to realize the function of playing music through the Bluetooth headset.
- the MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193 .
- MIPI interfaces include camera serial interface (CSI), display serial interface (DSI), etc.
- the processor 110 communicates with the camera 193 through a CSI interface, so as to realize the photographing function of the electronic device 100 .
- the processor 110 communicates with the display screen 194 through the DSI interface to implement the display function of the electronic device 100 .
- the GPIO interface can be configured by software.
- the GPIO interface can be configured as a control signal or as a data signal.
- the GPIO interface may be used to connect the processor 110 with the camera 193, the display screen 194, the wireless communication module 160, the audio module 170, the sensor module 180, and the like.
- the GPIO interface can also be configured as I2C interface, I2S interface, UART interface, MIPI interface, etc.
- the USB interface 130 is an interface that conforms to the USB standard specification, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, and the like.
- the USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transmit data between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio through the headphones.
- the interface can also be used to connect other electronic devices, such as AR devices.
- the interface connection relationship between the modules illustrated in the embodiments of the present application is only a schematic illustration, and does not constitute a structural limitation of the electronic device 100 .
- the electronic device 100 may also adopt different interface connection manners in the foregoing embodiments, or a combination of multiple interface connection manners.
- the charging management module 140 is used to receive charging input from the charger.
- the charger may be a wireless charger or a wired charger.
- the charging management module 140 may receive charging input from the wired charger through the USB interface 130 .
- the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 charges the battery 142 , it can also supply power to the electronic device through the power management module 141 .
- the power management module 141 is used for connecting the battery 142 , the charging management module 140 and the processor 110 .
- the power management module 141 receives the input from the battery 142 and/or the charging management module 140 and supplies power to the processor 110 , the internal memory 121 , the display screen 194 , the camera 193 , and the wireless communication module 160 .
- the power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle times, battery health status (leakage, impedance).
- the power management module 141 may also be provided in the processor 110 .
- the power management module 141 and the charging management module 140 may also be provided in the same device.
- the wireless communication function of the electronic device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, the baseband processor, and the like.
- Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
- Each antenna in electronic device 100 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.
- the antenna 1 can be multiplexed as a diversity antenna of the wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
- the mobile communication module 150 may provide wireless communication solutions including 2G/3G/4G/5G etc. applied on the electronic device 100 .
- the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA) and the like.
- the mobile communication module 150 can receive electromagnetic waves from the antenna 1, filter and amplify the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation.
- the mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and then turn it into an electromagnetic wave for radiation through the antenna 1 .
- at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110 .
- at least part of the functional modules of the mobile communication module 150 may be provided in the same device as at least part of the modules of the processor 110 .
- the modem processor may include a modulator and a demodulator.
- the modulator is used to modulate the low frequency baseband signal to be sent into a medium and high frequency signal.
- the demodulator is used to demodulate the received electromagnetic wave signal into a low frequency baseband signal. Then the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing.
- the low frequency baseband signal is processed by the baseband processor and passed to the application processor.
- the application processor outputs sound signals through audio devices (not limited to the speaker 170A, the receiver 170B, etc.), or displays images or videos through the display screen 194 .
- the modem processor may be a stand-alone device.
- the modem processor may be independent of the processor 110, and may be provided in the same device as the mobile communication module 150 or other functional modules.
- the wireless communication module 160 can provide applications on the electronic device 100 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellites Wireless communication solutions such as global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared technology (IR).
- WLAN wireless local area networks
- BT Bluetooth
- GNSS global navigation satellite system
- FM frequency modulation
- NFC near field communication
- IR infrared technology
- the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
- the wireless communication module 160 receives the electromagnetic wave via the antenna 2, frequency modulates and filters the electromagnetic wave signal, and sends the processed signal to the processor 110.
- the wireless communication module 160 can also receive the signal to be sent from the processor 110 , perform frequency modulation on it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2 .
- the antenna 1 of the electronic device 100 is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology.
- the wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), broadband Code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC , FM, and/or IR technology, etc.
- the GNSS may include a global positioning system (global positioning system, GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (quasi -zenith satellite system, QZSS) and/or satellite based augmentation systems (SBAS).
- GPS global positioning system
- GLONASS global navigation satellite system
- BDS Beidou navigation satellite system
- QZSS quasi-zenith satellite system
- SBAS satellite based augmentation systems
- the electronic device 100 implements a display function through a GPU, a display screen 194, an application processor, and the like.
- the GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor.
- the GPU is used to perform mathematical and geometric calculations for graphics rendering.
- Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
- Display screen 194 is used to display images, videos, and the like.
- Display screen 194 includes a display panel.
- the display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (active-matrix organic light).
- LED diode AMOLED
- flexible light-emitting diode flexible light-emitting diode (flex light-emitting diode, FLED), Miniled, MicroLed, Micro-oLed, quantum dot light-emitting diode (quantum dot light emitting diodes, QLED) and so on.
- the electronic device 100 may include one or N display screens 194 , where N is a positive integer greater than one.
- the electronic device 100 may implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, and the like.
- the ISP is used to process the data fed back by the camera 193 .
- the shutter is opened, the light is transmitted to the camera photosensitive element through the lens, the light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye.
- ISP can also perform algorithm optimization on image noise, brightness, and skin tone.
- ISP can also optimize the exposure, color temperature and other parameters of the shooting scene.
- the ISP may be provided in the camera 193 .
- Camera 193 is used to capture still images or video.
- the object is projected through the lens to generate an optical image onto the photosensitive element.
- the photosensitive element may be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
- CMOS complementary metal-oxide-semiconductor
- the photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal.
- the ISP outputs the digital image signal to the DSP for processing.
- DSP converts digital image signals into standard RGB, YUV and other formats of image signals.
- the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
- a digital signal processor is used to process digital signals, in addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy and so on.
- Video codecs are used to compress or decompress digital video.
- the electronic device 100 may support one or more video codecs.
- the electronic device 100 can play or record videos of various encoding formats, such as: Moving Picture Experts Group (moving picture experts group, MPEG) 1, MPEG2, MPEG3, MPEG4 and so on.
- MPEG Moving Picture Experts Group
- MPEG2 moving picture experts group
- MPEG3 MPEG4
- MPEG4 Moving Picture Experts Group
- the NPU is a neural-network (NN) computing processor.
- NN neural-network
- Applications such as intelligent cognition of the electronic device 100 can be implemented through the NPU, such as image recognition, face recognition, speech recognition, text understanding, and the like.
- the internal memory 121 may include one or more random access memories (RAM) and one or more non-volatile memories (NVM).
- RAM random access memories
- NVM non-volatile memories
- Random access memory can include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronization Dynamic random access memory (double data rate synchronous dynamic random access memory, DDR SDRAM, such as fifth-generation DDR SDRAM is generally called DDR5 SDRAM), etc.;
- SRAM static random-access memory
- DRAM dynamic random access memory
- SDRAM synchronous dynamic random access memory
- DDR SDRAM double data rate synchronous dynamic random access memory
- DDR SDRAM double data rate synchronous dynamic random access memory
- DDR SDRAM double data rate synchronous dynamic random access memory
- fifth-generation DDR SDRAM is generally called DDR5 SDRAM
- Non-volatile memory may include magnetic disk storage devices, flash memory.
- Flash memory can be divided into NOR FLASH, NAND FLASH, 3D NAND FLASH, etc. according to the operating principle, and can include single-level memory cells (single-level cells, SLC), multi-level memory cells (multi-level memory cells) according to the level of storage cell potential cell, MLC), triple-level cell (TLC), quad-level cell (QLC), etc., according to the storage specification can include universal flash storage (English: universal flash storage, UFS) , embedded multimedia memory card (embedded multi media card, eMMC) and so on.
- SLC single-level memory cells
- multi-level memory cells multi-level memory cells
- MLC multi-level memory cells
- TLC triple-level cell
- QLC quad-level cell
- UFS universal flash storage
- eMMC embedded multimedia memory card
- the random access memory can be directly read and written by the processor 110, and can be used to store executable programs (eg, machine instructions) of an operating system or other running programs, and can also be used to store data of users and application programs.
- executable programs eg, machine instructions
- the random access memory can be directly read and written by the processor 110, and can be used to store executable programs (eg, machine instructions) of an operating system or other running programs, and can also be used to store data of users and application programs.
- the non-volatile memory can also store executable programs and store data of user and application programs, etc., and can be loaded into the random access memory in advance for the processor 110 to directly read and write.
- the external memory interface 120 can be used to connect an external non-volatile memory, so as to expand the storage capacity of the electronic device 100 .
- the external non-volatile memory communicates with the processor 110 through the external memory interface 120 to realize the data storage function. For example, save music, video, etc. files in external non-volatile memory.
- the electronic device 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, an application processor, and the like. Such as music playback, recording, etc.
- the audio module 170 is used for converting digital audio information into analog audio signal output, and also for converting analog audio input into digital audio signal. Audio module 170 may also be used to encode and decode audio signals. In some embodiments, the audio module 170 may be provided in the processor 110 , or some functional modules of the audio module 170 may be provided in the processor 110 .
- Speaker 170A also referred to as a "speaker" is used to convert audio electrical signals into sound signals.
- the electronic device 100 can listen to music through the speaker 170A, or listen to a hands-free call.
- the receiver 170B also referred to as "earpiece" is used to convert audio electrical signals into sound signals.
- the voice can be answered by placing the receiver 170B close to the human ear.
- the microphone 170C also called “microphone” or “microphone” is used to convert sound signals into electrical signals.
- the user can make a sound by approaching the microphone 170C through a human mouth, and input the sound signal into the microphone 170C.
- the electronic device 100 may be provided with at least one microphone 170C. In other embodiments, the electronic device 100 may be provided with two microphones 170C, which can implement a noise reduction function in addition to collecting sound signals. In other embodiments, the electronic device 100 may further be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, and implement directional recording functions.
- the earphone jack 170D is used to connect wired earphones.
- the earphone interface 170D can be the USB interface 130, or can be a 3.5mm open mobile terminal platform (OMTP) standard interface, a cellular telecommunications industry association of the USA (CTIA) standard interface.
- OMTP open mobile terminal platform
- CTIA cellular telecommunications industry association of the USA
- the pressure sensor 180A is used to sense pressure signals, and can convert the pressure signals into electrical signals.
- the pressure sensor 180A may be provided on the display screen 194 .
- the capacitive pressure sensor may be comprised of at least two parallel plates of conductive material. When a force is applied to the pressure sensor 180A, the capacitance between the electrodes changes.
- the electronic device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 180A.
- the electronic device 100 may also calculate the touched position according to the detection signal of the pressure sensor 180A.
- touch operations acting on the same touch position but with different touch operation intensities may correspond to different operation instructions. For example, when a touch operation whose intensity is less than the first pressure threshold acts on the short message application icon, the instruction for viewing the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, the instruction to create a new short message is executed.
- the gyro sensor 180B may be used to determine the motion attitude of the electronic device 100 .
- the angular velocity of electronic device 100 about three axes ie, x, y, and z axes
- the gyro sensor 180B can be used for image stabilization.
- the gyro sensor 180B detects the shaking angle of the electronic device 100, calculates the distance that the lens module needs to compensate according to the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse motion to achieve anti-shake.
- the gyro sensor 180B can also be used for navigation and somatosensory game scenarios.
- the air pressure sensor 180C is used to measure air pressure.
- the electronic device 100 calculates the altitude through the air pressure value measured by the air pressure sensor 180C to assist in positioning and navigation.
- the magnetic sensor 180D includes a Hall sensor.
- the electronic device 100 can detect the opening and closing of the flip holster using the magnetic sensor 180D.
- the electronic device 100 can detect the opening and closing of the flip according to the magnetic sensor 180D. Further, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, characteristics such as automatic unlocking of the flip cover are set.
- the acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally three axes).
- the magnitude and direction of gravity can be detected when the electronic device 100 is stationary. It can also be used to identify the posture of electronic devices, and can be used in applications such as horizontal and vertical screen switching, pedometers, etc.
- the electronic device 100 can measure the distance through infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.
- Proximity light sensor 180G may include, for example, light emitting diodes (LEDs) and light detectors, such as photodiodes.
- the light emitting diodes may be infrared light emitting diodes.
- the electronic device 100 emits infrared light to the outside through the light emitting diode.
- Electronic device 100 uses photodiodes to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100 . When insufficient reflected light is detected, the electronic device 100 may determine that there is no object near the electronic device 100 .
- the electronic device 100 can use the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power.
- Proximity light sensor 180G can also be used in holster mode, pocket mode automatically unlocks and locks the screen.
- the ambient light sensor 180L is used to sense ambient light brightness.
- the electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness.
- the ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures.
- the ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket, so as to prevent accidental touch.
- the fingerprint sensor 180H is used to collect fingerprints.
- the electronic device 100 can use the collected fingerprint characteristics to realize fingerprint unlocking, accessing application locks, taking pictures with fingerprints, answering incoming calls with fingerprints, and the like.
- the temperature sensor 180J is used to detect the temperature.
- the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold value, the electronic device 100 reduces the performance of the processor located near the temperature sensor 180J in order to reduce power consumption and implement thermal protection.
- the electronic device 100 when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to avoid abnormal shutdown of the electronic device 100 caused by the low temperature.
- the electronic device 100 boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
- Touch sensor 180K also called “touch device”.
- the touch sensor 180K may be disposed on the display screen 194 , and the touch sensor 180K and the display screen 194 form a touch screen, also called a “touch screen”.
- the touch sensor 180K is used to detect a touch operation on or near it.
- the touch sensor can pass the detected touch operation to the application processor to determine the type of touch event.
- Visual output related to touch operations may be provided through display screen 194 .
- the touch sensor 180K may also be disposed on the surface of the electronic device 100 , which is different from the location where the display screen 194 is located.
- the bone conduction sensor 180M can acquire vibration signals.
- the bone conduction sensor 180M can acquire the vibration signal of the vibrating bone mass of the human voice.
- the bone conduction sensor 180M can also contact the pulse of the human body and receive the blood pressure beating signal.
- the bone conduction sensor 180M can also be disposed in the earphone, combined with the bone conduction earphone.
- the audio module 170 can analyze the voice signal based on the vibration signal of the vocal vibration bone block obtained by the bone conduction sensor 180M, so as to realize the voice function.
- the application processor can analyze the heart rate information based on the blood pressure beat signal obtained by the bone conduction sensor 180M, and realize the function of heart rate detection.
- the keys 190 include a power-on key, a volume key, and the like. Keys 190 may be mechanical keys. It can also be a touch key.
- the electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100 .
- Motor 191 can generate vibrating cues.
- the motor 191 can be used for vibrating alerts for incoming calls, and can also be used for touch vibration feedback.
- touch operations acting on different applications can correspond to different vibration feedback effects.
- the motor 191 can also correspond to different vibration feedback effects for touch operations on different areas of the display screen 194 .
- Different application scenarios for example: time reminder, receiving information, alarm clock, games, etc.
- the touch vibration feedback effect can also support customization.
- the indicator 192 can be an indicator light, which can be used to indicate the charging state, the change of the power, and can also be used to indicate a message, a missed call, a notification, and the like.
- the SIM card interface 195 is used to connect a SIM card.
- the SIM card can be contacted and separated from the electronic device 100 by inserting into the SIM card interface 195 or pulling out from the SIM card interface 195 .
- the electronic device 100 may support 1 or N SIM card interfaces, where N is a positive integer greater than 1.
- the SIM card interface 195 can support Nano SIM card, Micro SIM card, SIM card and so on. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the plurality of cards may be the same or different.
- the SIM card interface 195 can also be compatible with different types of SIM cards.
- the SIM card interface 195 is also compatible with external memory cards.
- the electronic device 100 interacts with the network through the SIM card to implement functions such as call and data communication.
- the electronic device 100 employs an eSIM, ie: an embedded SIM card.
- the eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100 .
- the software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture.
- the embodiment of the present invention takes an Android system with a layered architecture as an example to illustrate the software structure of the electronic device 100 as an example.
- FIG. 2 is a block diagram of a software structure of an electronic device 100 according to an embodiment of the present invention.
- the layered architecture divides the software into several layers, and each layer has a clear role and division of labor. Layers communicate with each other through software interfaces.
- the Android system is divided into four layers, which are, from top to bottom, an application layer, an application framework layer, an Android runtime (Android runtime) and a system library, and a kernel layer.
- the application layer can include a series of application packages.
- the application package can include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and so on.
- the application framework layer provides an application programming interface (application programming interface, API) and a programming framework for applications in the application layer.
- the application framework layer includes some predefined functions.
- the application framework layer may include window managers, content providers, view systems, telephony managers, resource managers, notification managers, and the like.
- a window manager is used to manage window programs.
- the window manager can get the size of the display screen, determine whether there is a status bar, lock the screen, take screenshots, etc.
- Content providers are used to store and retrieve data and make these data accessible to applications.
- the data may include video, images, audio, calls made and received, browsing history and bookmarks, phone book, etc.
- the view system includes visual controls, such as controls for displaying text, controls for displaying pictures, and so on. View systems can be used to build applications.
- a display interface can consist of one or more views.
- the display interface including the short message notification icon may include a view for displaying text and a view for displaying pictures.
- the phone manager is used to provide the communication function of the electronic device 100 .
- the management of call status including connecting, hanging up, etc.).
- the resource manager provides various resources for the application, such as localization strings, icons, pictures, layout files, video files and so on.
- the notification manager enables applications to display notification information in the status bar, which can be used to convey notification-type messages, and can disappear automatically after a brief pause without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc.
- the notification manager can also display notifications in the status bar at the top of the system in the form of graphs or scroll bar text, such as notifications of applications running in the background, and notifications on the screen in the form of dialog windows. For example, text information is prompted in the status bar, a prompt sound is issued, the electronic device vibrates, and the indicator light flashes.
- Android Runtime includes core libraries and a virtual machine. Android runtime is responsible for scheduling and management of the Android system.
- the core library consists of two parts: one is the function functions that the java language needs to call, and the other is the core library of Android.
- the application layer and the application framework layer run in virtual machines.
- the virtual machine executes the java files of the application layer and the application framework layer as binary files.
- the virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, safety and exception management, and garbage collection.
- a system library can include multiple functional modules. For example: surface manager (surface manager), media library (Media Libraries), 3D graphics processing library (eg: OpenGL ES), 2D graphics engine (eg: SGL), etc.
- surface manager surface manager
- media library Media Libraries
- 3D graphics processing library eg: OpenGL ES
- 2D graphics engine eg: SGL
- the Surface Manager is used to manage the display subsystem and provides a fusion of 2D and 3D layers for multiple applications.
- the media library supports playback and recording of a variety of commonly used audio and video formats, as well as still image files.
- the media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
- the 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
- 2D graphics engine is a drawing engine for 2D drawing.
- the kernel layer is the layer between hardware and software.
- the kernel layer contains at least display drivers, camera drivers, audio drivers, and sensor drivers.
- a corresponding hardware interrupt is sent to the kernel layer.
- the kernel layer processes touch operations into raw input events (including touch coordinates, timestamps of touch operations, etc.). Raw input events are stored at the kernel layer.
- the application framework layer obtains the original input event from the kernel layer, and identifies the control corresponding to the input event. Taking the touch operation as a touch click operation, and the control corresponding to the click operation is the control of the camera application icon, for example, the camera application calls the interface of the application framework layer to start the camera application, and then starts the camera driver by calling the kernel layer.
- the camera 193 captures still images or video.
- FIG. 3 is a flowchart of a memory management method provided by an embodiment of the present application.
- the execution body of the method may be the electronic device 100.
- the specific implementation process of the present application is described by taking the Linux system as an example, but The application scenario of the present application is not limited to the Linux system, but can also be an Android system, an IOS system, Windows, etc., and the electronic device can be a mobile phone, a tablet computer, etc., and the method may include but not limited to the following steps:
- Step S31 Acquire the resource requirements corresponding to waiting of the process in the kernel space.
- the resources used for application processing are limited. Therefore, the electronic device needs to continuously release memory during the operation, so as to ensure the effective operation of the application.
- the resources may refer to software or hardware resources that the electronic device 100 must use when processing application events, such as memory and hardware resources of the electronic device 100 .
- the electronic device 100 may detect the process states of all processes in the kernel space, and may also obtain the resource requirements corresponding to waiting of the processes in the kernel space.
- the electronic device if it is detected that a process in the kernel space is in a state of waiting for resources, the electronic device will obtain the resource requirements that each process is waiting for at this time. Specifically, processes will access system resources during running, and when system resources are busy, these processes need to wait for resources. Among them, different processes have different resource requirements. For example, at the same time, process A can wait for memory resources, process B can wait for IO resources, and process C can wait for lock resources.
- the resource required by the resource may include at least one of a memory resource, an input/output (Input/Output) resource, and a lock resource.
- the memory resources include SDRAM, DDR SDRAM, and RDRAM
- the IO resources may include other peripherals such as storage devices (eg, EMMC or UFS), serial port devices, and the like.
- the lock resources may include resources such as mutex, semaphore, and rcu, which may be used for synchronization between processes.
- the lock resources may also include completion resources, which may be used for synchronization between threads.
- the electronic device 100 may acquire information such as resource requirements and waiting time waiting for each process in real time.
- the conditions for a process to enter an uninterruptible sleep state may be: for example, the first process initiates an IO request, which may be to read data on a disk logical address or read a file in a file system.
- the IO resource When busy, the system IO resources cannot meet the requirements of the first process, and the first process will enter the first state, that is, the D state.
- the first process initiates a memory resource request, but the system memory resources cannot meet the needs of the first process, then the first process will enter the first state, or when the lock resources required by the first process are used by other processes.
- the first process When held by the process, the first process will also enter the first state.
- the first state is an uninterrupted sleep state. That is to say, in the present application, the first process in the first state may run without occupying processor resources, but still occupy resources such as memory and hardware of the electronic device 100 .
- the electronic device may also determine according to the waiting time of the first process, and switch the first process to the first state. For example, it can be determined whether the time the first process is in the state of waiting for resources reaches a preset duration, and if the time of the first process in the state of waiting for resources reaches the preset duration, it is determined to switch the first process to the first state.
- Step S32 if it is detected that the first process is in the first state and reaches the preset condition, the first process in the first state is changed to the second state, and the memory resources of the first process are swapped out.
- the first process being in the first state and satisfying the preset condition may be one of the following situations:
- the time that the first process is in the first state exceeds a preset time, it needs to be determined whether the first process meets the conditions for swapping out memory resources. If the first process meets the conditions for swapping out the memory resources, the first process in the first state is changed to the second state, and the memory resources of the first process are swapped out.
- the swap-out priority threshold of the first process may be calculated, and the swap-out priority threshold may be compared with the first threshold, so the first process may be determined according to the comparison result Whether the conditions for swapping out memory resources are met.
- swap-out priority threshold of the first process is greater than the first threshold, it can be determined that the first process has met the conditions for swapping out memory resources, and the first process in the first state is changed to the second state, swapping out the memory resources of the first process;
- swap-out priority threshold of the first process is smaller than the first threshold, it can be determined that the first process does not meet the conditions for swapping out memory resources, and the memory resources of the first process will not be swapped out.
- the electronic device periodically detects the state of the process in the kernel space.
- the duration of the uninterruptible sleep state is very short. If the first process in the kernel space is in the uninterruptible sleep state for more than a preset time, In this case, the problem of response delay will be brought to the operating system, thereby affecting the stability of the operating system. Therefore, if it is detected that the time that the first process is in the first state exceeds the preset time and the first process has met the conditions for swapping out memory resources, the electronic device will change the first process in the first state to the second state , and swap out the memory resources of the first process.
- a mapping relationship between the first process and the cloud storage space or storage device may be established, that is, the operating system kernel may exchange the content data (ie, process information) of the physical memory of the first process to the cloud storage space. Or on the storage device, and then allocate these physical memory resources to the second process in the kernel space, so as to swap out the memory resources of the first process.
- the storage device may be a Multi-Media Card (MMC). Therefore, the electronic device can process the first process to reclaim the memory resources of the first process.
- MMC Multi-Media Card
- the memory resources of the first process in this second state can be swapped out, but the process information can be placed on disk and the process can be resumed. That is, if the first process in the uninterruptible sleep state satisfies the preset condition, the electronic device can change the state of the first process and swap out the memory resources of the first process. Therefore, by adopting the technical solutions of the embodiments of the present application, it is possible to prevent a process in an uninterruptible sleep state from occupying kernel resources, ensure the operating efficiency of the device, and effectively improve the availability and stability of the system.
- Step S33 If it is detected that the released system resources meet the resource requirements of the first process in the second state, the state of the first process is changed, and memory resources are exchanged.
- the information and memory occupancy information of the applications installed in the terminal can be monitored. If it is confirmed that the current application has met the conditions for memory recycling, the priority of the application whose memory is to be recycled is pre-stored. level order to select applications currently running on the terminal and not being used by the user, and then call the memory recycling interface provided by the kernel mode to perform memory recycling.
- the Swap mechanism in the Linux system when a process requests the operating system for insufficient memory, the operating system will swap out the temporarily unused data in the memory and put it in the Swap partition. This process is Swap Out (swap out) . When a process needs these data and the operating system detects that there is still free physical memory, it will swap the data in the Swap partition back to the physical memory. This process is called Swap In (swap in).
- the above implementations may have the following problems: on the one hand, the memory occupied by the process in the uninterruptible sleep state cannot be recovered, and the process cannot be recovered after the memory is recovered. However, when the duration of the uninterruptible sleep state is long, the The operating system brings a response delay, which affects the stability of the operating system. On the other hand, it is necessary to formulate a list of applications that reclaim memory in advance, and memory that is not in the application list cannot be reclaimed. In addition, the Swap mechanism can only be triggered when the memory is low, and cannot prevent the low memory condition of the terminal in advance.
- the system will release some resources. Therefore, after the memory resources of the first process are swapped out, if the electronic device detects that the released system resources meet the resource requirements of the first process in the second state, the state of the first process is changed, and the state of the first process is changed.
- the operating system kernel can retrieve the corresponding content data from the cloud storage space or storage device, and copy it back to the newly allocated physical memory to exchange the memory resources. Therefore, the memory occupied by the process in the uninterruptible sleep state can be reclaimed, and the process can be resumed after the memory is reclaimed. Therefore, the embodiments of the present application can improve the stability of the operating system, prevent the electronic device from being stuck, and further improve the user experience.
- the embodiment of the present application also provides another more detailed method flow, which may include the following steps:
- Step S41 Detect the process states of all processes in the kernel space.
- the electronic device periodically detects the process states of all processes in the kernel space. It can be understood that, usually due to the lack of system resources, the process in the kernel space will be in a waiting state for resources. When the process enters the waiting state, the electronic device will simultaneously record information such as the resource requirements and waiting time of the process.
- Step S42 Obtain the resource requirements corresponding to waiting of the process in the kernel space.
- the electronic device can obtain the resource requirements corresponding to waiting of the process in the kernel space.
- the electronic device can obtain information such as resource requirements and waiting time of the process.
- Step S43 Determine whether the process enters the first state (ie, determine whether the status in the task_struct structure is task_uninterruptable). If yes, go to step S44, otherwise go back to step S41.
- the first process will enter the first state. It can be understood that the first state is an uninterruptible sleep state. If the time that the second process is in the state of waiting for a resource does not reach a certain time, the second process does not enter the first state.
- Step S44 Determine whether the system has low memory or whether the time in which the first process is in the first state exceeds a preset time. If yes, go to step S45, otherwise go back to step S41.
- the above two cases will affect the operating efficiency of the operating system. Therefore, if the electronic device detects one of the above two situations, it will be used as a trigger event to trigger the memory recycling mechanism in the embodiment of the present application, so as to improve the operating efficiency and stability of the system.
- Step S45 Determine whether the swap-out priority threshold of the first process is greater than the first threshold. If the swap-out priority threshold of the first process is greater than the first threshold, go to step S46; otherwise, return to step S41.
- the swap-out priority threshold may be related to the memory size occupied by the process and the time when the process enters the first state.
- the swap-out priority threshold of the first process is compared with the first threshold. If the swap-out priority threshold of the first process is greater than the first threshold, it is determined that the memory resources of the first process can be swapped out. If the swap-out priority threshold of the first process is smaller than the first threshold, it is determined not to swap out the memory resources of the first process.
- the electronic device can obtain the size of the memory occupied by the first process and the time when the first process enters the first state, and thus determine the number of first processes in combination with the calculation of the weighting coefficient Swap out the priority.
- the electronic device can sort the plurality of first processes in the first state according to the swap-out priority threshold, and first use the first process with the highest swap-out priority threshold as the process to be swapped out, so as to swap out the process.
- the memory occupied by the first process will continue to be the process to be swapped out after the first process with the second highest priority threshold for swapping out. Then, the higher the swap-out priority threshold of the process, the earlier the memory occupied by the process is swapped out, and the lower the swap-out priority of the process, the later the memory occupied by the process is swapped out.
- the first process that occupies a large amount of memory and enters the first state for a long time can be preferentially swapped out, so that the memory resources occupied by the first process can be swapped out in time, and the operating efficiency of the system can be improved.
- Step S46 Swap out the storage space for the first process, and store the process information of the first process in the storage space.
- the electronic device swaps out storage space for the first process, and the electronic device stores process information of the first process in the storage space.
- the electronic device may store the process information of the first process to a storage device or a cloud storage space. Therefore, it not only frees up memory space for the system, but also ensures that data generated when the first process runs is not lost.
- the process information may include a process identifier (for example, the operating system will create a process ID every time a process runs, and the process ID is the process identifier, and the process identifier is used to distinguish different processes. process), the state before the first process changes the state (for example, the process state before the first process changes the process state is the uninterruptible sleep state, then the process information here is the uninterruptible sleep state), the first process The time in the first state (for example, the time when the first process is in an uninterruptible sleep state is 5s, which is 5s in the process information at this time) and the data information state of the first process (for example, the first process is loaded or the data is transmitted. The ratio is 30%, and at this time, in the process information, at least one of the loading completion or the transmission completion ratio is 30%). It can be understood that the above process information is not limited to these information, which is not specifically limited in this application.
- Step S47 Change the first process in the first state to the second state, and swap out the memory resources of the first process.
- the electronic device can change the state of the first process, that is, the first process in the first state is the second state.
- the memory resources occupied by the first process in the second state can be released to exchange the memory resources of the first process.
- Step S48 If it is detected that the released system resources meet the resource requirements of the first process in the second state, the state of the first process is changed, and memory resources are exchanged.
- the method for changing the state of the first process may include but is not limited to steps S51-S53.
- Step S51 The first process in the second state swaps in memory resources.
- the first process in the second state swaps in memory resources, and the operating system kernel storage device retrieve the corresponding content data, copy it back to physical memory, and exchange it for memory resources.
- Step S52 Change the state of the first process to the first state.
- the first process in the second state is swapped into memory resources, the first process in the second state is changed to the first state, that is, the state of the first process is changed to D state.
- Step S53 After the first process acquires the waiting resource, the state of the first process is changed to the third state.
- the first process in the D state can acquire the waiting resources, and then change the state of the first process to the third state.
- the third state in this embodiment of the present application may be an executable state (ie, an R state). Therefore, in the embodiment of the present application, the first process may resume the process according to the released system resources,
- the method for changing the state of the first process may include but is not limited to steps S61-S62.
- Step S61 The first process in the second state swaps in memory resources.
- the first process in the second state swaps in memory resources, and the operating system removes the memory resources from the storage device. retrieve the corresponding process data, copy it back to physical memory, and exchange it for memory resources.
- Step S62 The first process acquires the waiting resource, and changes the state of the first process to a third state.
- the first process in the second state can acquire the waiting resources, and then change the state of the first process to the R state. Therefore, in the embodiment of the present application, the first process may resume the process according to the released system resources. It can be seen from the above that, in the embodiment of the present application, the first process can swap in and out memory resources according to a system mechanism.
- FIG. 7 is a state switching diagram of a process in the kernel space in an embodiment of the present application.
- the embodiment of the present application can add a second state when the first process is in the first state (ie, the D state), that is, change the first process in the first state to the second state, so that the Swap out the memory resources of the first process.
- the first state ie, the D state
- the first state as the D state as an example, in the Linux system, if the system resources of a process running on the CPU cannot meet the resource requirements of the first process, for example, the first process initiates an IO request, that is, waits for the IO state , but when the system resources cannot meet the IO resources waiting for the first process, the first process will switch from occupying the CPU to the D state.
- the first process in the D state will switch to the target state, and the memory resources will be swapped out at this time.
- the released system resources can meet the resource requirements of the first process, the first process in the target state will switch to the R state and swap in memory resources.
- these processes running on the CPU can be switched to the T state, the S state, and the Z state according to the scheduling method of the operating system.
- control process of the process may include:
- the process management module obtains the resource requirements corresponding to the waiting of the process.
- the process switches to the D state.
- the external trigger swapping out memory mechanism that is, to determine whether the system is low memory or whether the time of the process in the D state exceeds the preset time, and if so, determine the swapping out priority of the process.
- the process management module changes the process in the D state to the second state, and swaps out the memory resources of the process.
- the process information is read from the storage space, and then the process is resumed.
- the method may include but not limited to the following steps:
- Step S91 Acquire the resource requirements corresponding to waiting of the process in the kernel space.
- Step S92 Determine whether the system has low memory or whether the time in which the first process is in the first state exceeds a preset time. If yes, go to step S93, otherwise go back to step S91.
- Step S93 Determine whether the swap-out priority threshold of the first process is greater than the first threshold, if the swap-out priority threshold of the first process is greater than the first threshold, then enter step S94, otherwise return to step S91 .
- swap-out priority threshold of the first process is greater than the first threshold, it is determined that the memory resources of the first process can be swapped out. If the swap-out priority threshold of the first process is smaller than the first threshold, it is determined not to swap out the memory resources of the first process.
- Step S94 Swap out the storage space for the first process, and store the process information of the first process in the storage space.
- Step S95 Change the first process in the first state to the second state, and swap out the memory resources of the first process.
- the electronic device can change the state of the first process, that is, the first process in the first state is the second state.
- the memory resources occupied by the first process in the second state can be released to exchange the memory resources of the first process.
- Step S96 The resource requirement of the first process is memory resources.
- Step S97 If it is detected that the released system resources satisfy the memory resources that the first process is waiting for, the state of the first process is changed, and the memory resources are swapped in.
- the state of the first process can be changed and the memory resources can be exchanged to restore the first process.
- the resource requirement of a process is memory resources
- the memory of the first process in the D state can be recovered, thereby reducing the probability of the electronic device being stuck.
- the released system resources can meet the memory resource requirements of the process, the first process can be restored to improve user experience.
- the method may include but not limited to the following steps:
- Step S101 Acquire the resource requirements corresponding to waiting of the process in the kernel space.
- Step S102 Determine whether the system has low memory or whether the time that the first process is in the first state exceeds a preset time. If yes, go to step S103, otherwise go back to step S101.
- Step S103 Determine whether the swap-out priority threshold of the first process is greater than the first threshold, if the swap-out priority threshold of the first process is greater than the first threshold, then enter step S104, otherwise return to step S101 .
- swap-out priority threshold of the first process is greater than the first threshold, it is determined that the memory resources of the first process can be swapped out. If the swap-out priority threshold of the first process is smaller than the first threshold, it is determined not to swap out the memory resources of the first process.
- Step S104 Swap out the storage space for the first process, and store the process information of the first process in the storage space.
- Step S105 Change the first process in the first state to the second state, and swap out the memory resources of the first process.
- the electronic device can change the state of the first process, that is, the first process in the first state is the second state.
- the memory resources occupied by the first process in the second state can be released to exchange the memory resources of the first process.
- Step S106 The resource requirement of the first process is IO resources.
- Step S107 If it is detected that the released system resources satisfy the IO resources that the first process is waiting for, the state of the first process is changed, and memory resources are exchanged.
- the state of the first process can be changed and the memory resources can be exchanged to restore the first process.
- the resource demand of the first process is IO resources
- the memory of the first process in the D state can be recovered, thereby reducing the probability of the electronic device being stuck.
- the released system resources can meet the IO resource requirements of the first process, the first process can be restored to improve user experience.
- the method may include, but is not limited to, the following steps:
- Step S111 Acquire the resource requirement corresponding to waiting of the process in the kernel space.
- Step S112 Determine whether the system has low memory or whether the time in which the first process is in the first state exceeds a preset time. If yes, go to step S113, otherwise go back to step S111.
- Step S113 Determine whether the swap-out priority threshold of the first process is greater than the first threshold, if the swap-out priority threshold of the first process is greater than the first threshold, proceed to step S114, otherwise return to step S111 .
- swap-out priority threshold of the first process is greater than the first threshold, it is determined that the memory resources of the first process can be swapped out. If the swap-out priority threshold of the first process is smaller than the first threshold, it is determined not to swap out the memory resources of the first process.
- Step S114 Swap out the storage space for the first process, and store the process information of the first process in the storage space.
- Step S115 Change the first process in the first state to the second state, and swap out the memory resources of the first process.
- the electronic device can change the state of the first process, that is, the first process in the first state is the second state.
- the memory resources occupied by the first process in the second state can be released to exchange the memory resources of the first process.
- Step S116 The resource requirement of the first process is a lock resource.
- Step S117 if it is detected that the released system resource satisfies the lock resource that the first process is waiting for, the state of the first process is changed, and the memory resource is exchanged.
- the state of the first process can be changed and the memory resources can be exchanged to restore the first process.
- the resource requirement of the first process is the lock resource
- the memory of the first process in the D state can be recovered, thereby reducing the probability of the electronic device being stuck.
- the released system resources can meet the lock resource requirements of the first process, the first process can be restored to improve user experience.
- FIG. 12 is a schematic structural diagram of a memory management apparatus disclosed in an embodiment of the present application.
- the memory management apparatus may be used to execute part or all of the steps of the memory management methods described in FIG. 3 to FIG. 11 .
- the memory management apparatus 200 may include:
- the detection module 201 is configured to obtain the resource requirements corresponding to waiting of the process in the kernel space.
- the process management module 202 is configured to change the first process in the first state to the second state and swap out the memory resources of the first process if it is detected that the first process in the first state meets the preset condition.
- the process management module 202 is further configured to: if it is detected that the released system resources meet the resource requirements of the first process in the second state, change the state of the first process and swap in memory resources.
- the process management module 202 is specifically configured to:
- the state of the first process is changed to the third state, and memory resources are swapped in.
- the process management module 202 is further specifically configured to:
- the state of the first process is changed to the first state, and the system gives resources to the first process.
- the memory management apparatus 200 may further include:
- the allocation module 203 before the process management module 202 changes the first process in the first state to the second state, the allocation module 203 is further configured to swap out storage space for the first process.
- the storage module 204 is configured to store the process information of the first process in the storage space.
- the detection module 201 is also used for:
- the swap-out priority of the first process is acquired based on the size of the memory occupied by the first process and the time when the first process enters the first state.
- the determining module 205 is configured to determine the first process to be swapped out in the first process according to the swap out priority of the first process, that is, to determine that multiple first processes in the first state swap out memory Prioritization of resources.
- each module in the above-mentioned memory management apparatus is only used for illustration, and in other embodiments, the memory management apparatus can be divided into different modules as required to complete all or part of the above-mentioned memory management apparatus.
- each module in the memory management apparatus may be in the form of a computer program.
- the computer program can run on an electronic device or server.
- the program modules constituted by the computer program can be stored in the memory of the terminal or the server.
- the steps described in the embodiments of the present application are implemented.
- the specific implementation of each module in the embodiments of the present application may also correspond to the corresponding descriptions of the method embodiments shown in FIG. 3 to FIG. 11 .
- memory management device described in FIG. 12 memory with low usage rate can be reclaimed in advance, so that application freezes can be avoided and user experience can be improved.
- Embodiments of the present application also provide a computer-readable storage medium.
- the readable storage medium stores computer instructions, and when the instructions run on the computing device, causes the computing device to execute the memory management method provided by the foregoing embodiments.
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
- Telephone Function (AREA)
Abstract
本申请实施例公开一种内存管理方法、电子设备以及计算机可读存储介质,本申请实施例可以获取内核空间中进程对应等待的资源需求,若检测到第一进程处于第一状态满足预设条件,则更改处于第一状态的第一进程为第二状态,换出所述第一进程的内存资源,若检测到释放的系统资源满足处于第二状态的第一进程的资源需求,则更改所述第一进程的状态,并换入内存资源。采用本申请的实施例,可以通过更改处于第一状态的第一进程为第二状态,并且换出所述第一进程的内存资源,因此,可以提高操作系统的稳定性,避免电子设备出现卡顿现象,提升用户的体验度。
Description
本申请实施例涉及计算机技术领域,尤其涉及一种内存管理方法、电子设备和计算机可读存储介质。
随着终端技术的发展,终端可以运行各种各样的进程,进程可以为操作系统的系统进程以及应用的应用进程。然而每个进程在运行过程中会占用一定的内存,在内存中存储自身的数据。随着终端的运行,应用打开数量的增加,其中运行的进程越来越多,占用的内存也会越来越多,空闲内存会越来越少。当终端面临空闲内存不满足内存需求的情况时,需要对进程占用的内存进行回收,以保证终端的空闲内存满足内存需求。然而,当前安卓(Android)系统的低内存回收(Low Memory Killer,LMK)并不能释放处于不可中断的睡眠状态进程所占用的内存。
发明内容
本申请实施例提供一种内存管理方法、电子设备和计算机可读存储介质,可以提高操作系统的稳定性,并提升用户的体验度。
第一方面,本申请的实施例提供一种内存管理方法,包括:获取内核空间中进程对应等待的资源需求;若检测到第一进程处于第一状态满足预设条件,则更改处于第一状态的第一进程为第二状态,换出所述第一进程的内存资源;若检测到释放的系统资源满足处于第二状态的第一进程的资源需求,则更改所述第一进程的状态,并换入内存资源。
本申请实施例提供的方法中,在第一进程进入第一状态后,如在某些进程处于不可中断睡眠状态的时间超过预设时长,电子设备可以通过更改处于第一状态的第一进程为第二状态,并且换出所述第一进程的内存资源,因此,可以避免操作系统因某些进程长时间处于不可中断睡眠状态的问题,可以提高操作系统的稳定性,避免电子设备出现卡顿现象,提升用户的体验度。
在一种可能的设计中,所述方法还包括:若检测到释放的系统资源满足处于第二状态的第一进程的资源需求,则更改所述第一进程的状态为第三状态,并换入内存资源。基于本设计,在释放的系统资源满足处于第二状态的第一进程的资源需求时,因此处于第二状态的第一进程在换入内存资源后直接获取所等待的资源,进而可以切换到第三状态,由此可以重新恢复进程,提升用户的使用体验。
在一种可能的设计中,所述方法还包括:若检测到释放的系统资源满足处 于第二状态的第一进程的资源需求,则更改所述第一进程的状态为第一状态,系统给资源给所述第一进程。基于本设计,在释放的系统资源满足处于第二状态的第一进程的资源需求时,可以将处于第一状态的第一进程换入后再切换到第一状态,因此处于第一状态的第一进程在获取所等待的资源后可以切换到第三状态,由此可以重新恢复进程。
在一种可能的设计中,所述资源需求的资源包括内存资源、IO资源和锁资源中的至少一种。在这样的设计中,通过获取进程对应等待的资源需求,当释放的系统资源可以满足处于第二状态的第一进程的资源需求时,可以根据释放的系统资源的类型,进而可以对应恢复进程,提高了操作系统的稳定性。
在一种可能的设计中,所述更改处于第一状态的第一进程为第二状态之前,所述方法还包括:为所述第一进程换出存储空间;将所述第一进程的进程信息存储于所述存储空间中。在这样的设计中,当需要换出第一进程的内存资源时,可以将第一进程的进程信息存储于存储空间内,防止数据丢失,保证了数据的安全。
在一种可能的设计中,所述更改处于第一状态的第一进程为第二状态之后,所述方法还包括:若所述第一进程的资源需求为内存资源;若检测到释放的系统资源满足所述第一进程等待的内存资源,则更改所述第一进程的状态,并换入内存资源。本设计中,当所述第一进程的资源需求为内存资源时,可以根据释放的内存资源即可重新恢复进程,提高了操作系统的稳定性。
在一种可能的设计中,所述更改处于第一状态的第一进程为第二状态之后,所述方法还包括:若所述第一进程的资源需求为IO资源;若检测到释放的系统资源满足所述第一进程等待的IO资源,则更改所述第一进程的状态,并换入内存资源。因此,当所述第一进程的资源需求为IO资源时,可以根据释放的IO资源即可重新恢复进程,由此提高了操作系统的稳定性。
在一种可能的设计中,所述更改处于第一状态的第一进程为第二状态之后,所述方法还包括:若所述第一进程的资源需求为锁资源;若检测到释放的系统资源满足所述第一进程等待的锁资源,则更改所述第一进程的状态,并换入内存资源。因此,当所述第一进程的资源需求为锁资源时,可以根据释放的锁资源即可重新恢复进程,由此进一步提高了操作系统的稳定性。
在一种可能的设计中,所述进程信息包括进程标识符、进程处于第一状态的时间和进程的数据信息状态中的至少一种。因此,当需要换出第一进程的内存资源时,可以将第一进程的进程信息存储于存储空间内,防止数据丢失,保证了数据的安全。
在一种可能的设计中,所述方法还包括:获取所述第一进程所占用的内存大小和所述第一进程进入第一状态的时间;基于所述第一进程所占用的内存大小和所述第一进程进入第一状态的时间,获取所述第一进程的换出优先级;基于所述第一进程的换出优先级,确定所述第一进程中待换出的第一进程。因此,可以优先将占用内存较大且进入第一状态时间较长的第一进程换出,能够及时地换出第一进程所占用的内存资源,进而提高系统的运行效率。
第二方面,本申请的实施例还提供一种内存管理装置,所述内存管理装置包括:
检测模块,用于获取内核空间中进程对应等待的资源需求。
进程管理模块,用于若检测到第一进程处于第一状态满足预设条件,则更改处于第一状态的第一进程为第二状态,并换出所述第一进程的内存资源。
所述进程管理模块还用于:若检测到释放的系统资源满足处于第二状态的第一进程的资源需求,则更改所述第一进程的状态,并换入内存资源。
采用本申请实施例提供的内存管理装置,在第一进程进入第一状态后,如在某些进程处于不可中断睡眠状态的时间超过预设时长,电子设备可以通过更改处于第一状态的第一进程为第二状态,并且换出所述第一进程的内存资源,因此,可以避免操作系统因某些进程长时间处于不可中断睡眠状态的问题,可以提高操作系统的稳定性,避免电子设备出现卡顿现象,提升用户的体验度。
在一种可能的设计中,所述进程管理模块还用于若检测到释放的系统资源满足处于第二状态的第一进程的资源需求,则更改所述第一进程的状态为第三状态,并换入内存资源。基于本设计,在释放的系统资源满足处于第二状态的第一进程的资源需求时,因此处于第二状态的第一进程在换入内存资源后直接获取所等待的资源,进而可以切换到第三状态,由此可以重新恢复进程,提升用户的使用体验。
在一种可能的设计中,所述进程管理模块还用于若检测到释放的系统资源满足处于第二状态的第一进程的资源需求,则更改所述第一进程的状态为第一状态,系统给资源给所述第一进程。基于这样的设计,在释放的系统资源满足处于第二状态的第一进程的资源需求时,可以将处于第一状态的第一进程换入后再切换到第一状态,因此处于第一状态的第一进程在获取所等待的资源后可以切换到第三状态,由此可以重新恢复进程。
在一种可能的设计中,所述内存管理装置还包括:
分配模块,在所述进程管理模块更改处于第一状态的第一进程为第二状态之前,所述分配模块还用于为所述第一进程换出存储空间;
存储模块,用于将所述第一进程的进程信息存储于所述存储空间中。
基于这样的设计,当需要换出第一进程的内存资源时,可以将第一进程的进程信息存储于存储空间内,防止数据丢失,保证了数据的安全。
在一种可能的设计中,所述检测模块还用于:所述内存管理装置还包括确定模块,
所述检测模块用于获取所述第一进程所占用的内存大小和所述第一进程进入第一状态的时间,并基于所述第一进程所占用的内存大小和所述第一进程进入第一状态的时间,获取所述第一进程的换出优先级;所述确定模块用于根据所述第一进程的换出优先级,确定所述第一进程中待换出的第一进程,即用于确定处于第一状态的多个第一进程换出内存资源的优先顺序。
基于这样的设计,因此可以优先将占用内存较大且进入第一状态时间较长的第一进程换出,能够及时地换出第一进程所占用的内存资源,进而提高系统 的运行效率。
第三方面,本申请的实施例还提供一种电子设备,包括:
存储器,用于存储计算机程序;
处理器,用于执行所述存储器存储的所述计算机程序,当所述计算机程序被执行时,所述处理器用于执行如上述所述的方法。因此,通过更改处于第一状态的第一进程为第二状态,换出所述第一进程的内存资源,可以提高操作系统的稳定性,避免电子设备出现卡顿现象,提升用户的体验度。
采用本申请实施例的技术方案,在第一进程进入第一状态后,如在某些进程处于不可中断睡眠状态的时间超过预设时长,电子设备可以通过更改处于第一状态的第一进程为第二状态,并且换出所述第一进程的内存资源,因此,可以避免操作系统因某些进程长时间处于不可中断睡眠状态的问题,可以提高操作系统的稳定性,避免电子设备出现卡顿现象,提升用户的体验度。
第四方面,本申请的实施例还提供一种计算机可读存储介质,所述计算机可读存储介质包括计算机指令,当所述计算机指令在电子设备上运行时,使得所述电子设备执行如上述所述的方法。因此,通过更改处于第一状态的第一进程为第二状态,换出所述第一进程的内存资源,可以提高操作系统的稳定性,避免电子设备出现卡顿现象,提升用户的体验度。
本申请实施例中,在系统处于低内存状态或者某些进程处于不可中断睡眠状态超过预设时间时,电子设备可以通过更改处于不可中断睡眠状态的第一进程为第二状态,换出所述第一进程的内存资源,可以提高操作系统的稳定性,避免电子设备出现卡顿现象,提升用户的体验度。
图1为本申请实施例提供的内存管理方法适用的一种电子设备的示意图。
图2为本申请实施例提供的一种操作系统的结构示意图。
图3为本申请实施例提供的一种内存管理方法的流程示意图。
图4为本申请实施例提供的另一种内存管理方法的流程示意图。
图5为本申请实施例提供的另一种内存管理方法的流程示意图。
图6为本申请实施例提供的另一种内存管理方法的流程示意图。
图7为本申请实施例中内核空间中进程的状态切换图。
图8为本申请实施例中的进程操作的示意图。
图9为本申请实施例提供的另一种内存管理方法的流程示意图。
图10为本申请实施例提供的另一种内存管理方法的流程示意图。
图11为本申请实施例提供的另一种内存管理方法的流程示意图。
图12为本申请实施例提供的一种内存管理装置的结构示意图。
主要元件符号说明
电子设备 100
处理器 110
外部存储器接口 120
内部存储器 121
USB接口 130
充电管理模块 140
电源管理模块 141
电池 142
天线 1、2
移动通信模块 150
无线通信模块 160
音频模块 170
扬声器 170A
受话器 170B
麦克风 170C
耳机接口 170D
传感器模块 180
压力传感器 180A
陀螺仪传感器 180B
气压传感器 180C
磁传感器 180D
加速度传感器 180E
距离传感器 180F
接近光传感器 180G
指纹传感器 180H
温度传感器 180J
触摸传感器 180K
环境光传感器 180L
骨传导传感器 180M
按键 190
马达 191
指示器 192
摄像头 193
显示屏 194
SIM卡接口 195
内存管理装置 200
检测模块 201
进程管理模块 202
分配模块 203
存储模块 204
确定模块 205
如下具体实施方式将结合上述附图进一步详细说明本申请。
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
本申请实施例公开一种内存管理方法、电子设备和计算机可读存储介质,可以提高操作系统的稳定性,避免电子设备出现卡顿现象,提升用户的体验度。
本申请中所涉及的多个,是指两个或两个以上。另外,需要理解的是,在本申请的描述中,“第一”、“第二”等词汇,仅用于区分描述的目的,而不能理解为指示或暗示相对重要性,也不能理解为指示或暗示顺序。
本申请实施例提供的内存管理方法可以应用于电子设备,所述电子设备也可称之为用户设备(User Equipment,UE)、移动台(Mobile Station,MS)、移动终端(Mobile Terminal)等。可选地,所述电子设备可以具备无线接入网(Radio Access Nework,RAN)与一个或多个核心网进行通信的能力,例如,电子设备可以是移动电话(或称为“蜂窝”电话)、或具有移动性质的计算机等。所述电子设备的操作系统可以包括但不限于Linux系统、Android(安卓)系统、IOS操作系统、Symbian(塞班)操作系统、Black Berry(黑莓)操作系统、Windows Phone 8操作系统等等。可以理解,本申请实施例提供的内存管理方法可以应用于具有Linux操作系统的电子设备。
为了更好的理解本申请实施例,首先对本申请的实施例中所涉及到的几个名词进行解释:
内核空间与用户空间:操作系统作为计算设备的内核,独立于普通的应用程序,可以访问受保护的内存空间,也有访问底层硬件设备的所有权限。为了保证用户进程不直接操作内核,保证内核的安全,操作系统将寻址空间(该寻址空间可以是计算设备的内存中的一部分空间,也可以是虚拟存储空间)划分为两部分,一部分为内核空间,该内核空间是受保护的内存空间,用于存放内核的代码和数据;另一部分为用户空间,用于存放应用程序的代码和数据。
内核态与用户态,当进程执行用户程序的代码时,称进程处于用户态。对应的,当进程执行系统调用而陷入内核代码中执行时,称进程处于内核态。用户态进程运行于用户空间中,内核态进程运行于内核空间中。
睡眠状态可中断的进程,又可称为可中断的睡眠(task_interruptable)状态的进程:也被称作S状态进程,当满足进程执行条件时,睡眠状态可中断的进程会被唤醒以开始执行进程。
睡眠状态不可中断的进程,又可称为不可中断的睡眠(task_uninterruptable)状态的进程:也被称作D状态进程,通常会因为I/O资源得不到满足而形成,进程处于睡眠状态,但是此刻进程是不可中断的。不可中断,指的并不是CPU不响应外部硬件的中断,而是指进程不响应异步信号。可以理解,不可中断的睡眠状态存在的意义就在于,内核的一些处理流程是不能被打断的。如果响应异步信号,那么程序的执行流程中就会被插入一段用于处理异步信号的流程,这个插入的流程可能只存在于内核态,也可能延伸到用户态,于是原有的流程就被中断了。因此,在进程对硬件进行操作时,可能需要使用不可中断的睡眠状态对进程进行保护,以避免进程与设备交互的过程被打断,而造成设备陷入不可控的状态。然而当不可中断睡眠状态的持续时间比较长时,会给操作系统带来响应延迟,进而影响操作系统的稳定性。
可执行(task_running)状态的进程,也被称作R状态进程,在该状态的进程可以在CPU上运行,可执行状态表示进程可以运行但并没有获取CPU资源。暂停状态(task_stopped)的进程,也被称作T状态进程,暂停状态表示进程暂停下来不可运行。退出状态(task_dead)的进程,也被称作Z状态进程,退出状态表示进程已经开始退出。
具体地,以Linux系统为例,上述采用task_stuct结构体进行说明,每个进程对对应一个task_stuct数据结构,进程运行时task_stuct数据结构会被装载到内存中并且包含着进程的信息,每个进程将它的信息放到这个数据结构体中。
图1示出了电子设备100的结构示意图。
电子设备100可以是手机、平板电脑、桌面型计算机、膝上型计算机、手持计算机、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本,以及蜂窝电话、个人数字助理(personal digital assistant,PDA)、增强现实(augmented reality,AR)设备、虚拟现实(virtual reality,VR)设备、人工智能(artificial intelligence,AI)设备、可穿戴式设备、车载设备、 智能家居设备和/或智慧城市设备,本申请实施例对该电子设备的具体类型不作特殊限制。
电子设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。
可以理解的是,本申请实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。
控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。
I2C接口是一种双向同步串行总线,包括一根串行数据线(serial data line,SDA)和一根串行时钟线(derail clock line,SCL)。在一些实施例中,处理器110可以包含多组I2C总线。处理器110可以通过不同的I2C总线接口分别耦合触 摸传感器180K,充电器,闪光灯,摄像头193等。例如:处理器110可以通过I2C接口耦合触摸传感器180K,使处理器110与触摸传感器180K通过I2C总线接口通信,实现电子设备100的触摸功能。
I2S接口可以用于音频通信。在一些实施例中,处理器110可以包含多组I2S总线。处理器110可以通过I2S总线与音频模块170耦合,实现处理器110与音频模块170之间的通信。在一些实施例中,音频模块170可以通过I2S接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。
PCM接口也可以用于音频通信,将模拟信号抽样,量化和编码。在一些实施例中,音频模块170与无线通信模块160可以通过PCM总线接口耦合。在一些实施例中,音频模块170也可以通过PCM接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。所述I2S接口和所述PCM接口都可以用于音频通信。
UART接口是一种通用串行数据总线,用于异步通信。该总线可以为双向通信总线。它将要传输的数据在串行通信与并行通信之间转换。在一些实施例中,UART接口通常被用于连接处理器110与无线通信模块160。例如:处理器110通过UART接口与无线通信模块160中的蓝牙模块通信,实现蓝牙功能。在一些实施例中,音频模块170可以通过UART接口向无线通信模块160传递音频信号,实现通过蓝牙耳机播放音乐的功能。
MIPI接口可以被用于连接处理器110与显示屏194,摄像头193等外围器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI),显示屏串行接口(display serial interface,DSI)等。在一些实施例中,处理器110和摄像头193通过CSI接口通信,实现电子设备100的拍摄功能。处理器110和显示屏194通过DSI接口通信,实现电子设备100的显示功能。
GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据信号。在一些实施例中,GPIO接口可以用于连接处理器110与摄像头193,显示屏194,无线通信模块160,音频模块170,传感器模块180等。GPIO接口还可以被配置为I2C接口,I2S接口,UART接口,MIPI接口等。
USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为电子设备100充电,也可以用于电子设备100与外围设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。
可以理解的是,本申请实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一些有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。在一些无线充电的实施例 中,充电管理模块140可以通过电子设备100的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为电子设备供电。
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,显示屏194,摄像头193,和无线通信模块160等供电。电源管理模块141还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在其他一些实施例中,电源管理模块141也可以设置于处理器110中。在另一些实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。
电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。
天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。
移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。
无线通信模块160可以提供应用在电子设备100上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模 块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。
在一些实施例中,电子设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备100可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。所述GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。
电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。
显示屏194用于显示图像,视频等。显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备100可以包括1个或N个显示屏194,N为大于1的正整数。
电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,电子设备100可以 包括1个或N个摄像头193,N为大于1的正整数。
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。
视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。
内部存储器121可以包括一个或多个随机存取存储器(random access memory,RAM)和一个或多个非易失性存储器(non-volatile memory,NVM)。
随机存取存储器可以包括静态随机存储器(static random-access memory,SRAM)、动态随机存储器(dynamic random access memory,DRAM)、同步动态随机存储器(synchronous dynamic random access memory,SDRAM)、双倍资料率同步动态随机存取存储器(double data rate synchronous dynamic random access memory,DDR SDRAM,例如第五代DDR SDRAM一般称为DDR5 SDRAM)等;
非易失性存储器可以包括磁盘存储器件、快闪存储器(flash memory)。
快闪存储器按照运作原理划分可以包括NOR FLASH、NAND FLASH、3D NAND FLASH等,按照存储单元电位阶数划分可以包括单阶存储单元(single-level cell,SLC)、多阶存储单元(multi-level cell,MLC)、三阶储存单元(triple-level cell,TLC)、四阶储存单元(quad-level cell,QLC)等,按照存储规范划分可以包括通用闪存存储(英文:universal flash storage,UFS)、嵌入式多媒体存储卡(embedded multi media card,eMMC)等。
随机存取存储器可以由处理器110直接进行读写,可以用于存储操作系统或其他正在运行中的程序的可执行程序(例如机器指令),还可以用于存储用户及应用程序的数据等。
非易失性存储器也可以存储可执行程序和存储用户及应用程序的数据等,可以提前加载到随机存取存储器中,用于处理器110直接进行读写。
外部存储器接口120可以用于连接外部的非易失性存储器,实现扩展电子设备100的存储能力。外部的非易失性存储器通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部的非易失性存储器中。
电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。
音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器170A收听音乐,或收听免提通话。
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备100接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。电子设备100可以设置至少一个麦克风170C。在另一些实施例中,电子设备100可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,电子设备100还可以设置三个,四个或更多麦克风170C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。
耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。电子设备100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,电子设备100根据压力传感器180A检测所述触摸操作强度。电子设备100也可以根据压力传感器180A的检测信号计算触摸的位置。在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。
陀螺仪传感器180B可以用于确定电子设备100的运动姿态。在一些实施例中,可以通过陀螺仪传感器180B确定电子设备100围绕三个轴(即,x,y和z轴)的角速度。陀螺仪传感器180B可以用于拍摄防抖。示例性的,当按下快门,陀螺仪传感器180B检测电子设备100抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消电子设备100的抖动,实现防抖。陀螺仪传感器180B还可以用于导航,体感游戏场景。
气压传感器180C用于测量气压。在一些实施例中,电子设备100通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。
磁传感器180D包括霍尔传感器。电子设备100可以利用磁传感器180D检测翻盖皮套的开合。在一些实施例中,当电子设备100是翻盖机时,电子设备100可以根据磁传感器180D检测翻盖的开合。进而根据检测到的皮套的开合状态或翻盖的开合状态,设置翻盖自动解锁等特性。
加速度传感器180E可检测电子设备100在各个方向上(一般为三轴)加速度的大小。当电子设备100静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。
距离传感器180F,用于测量距离。电子设备100可以通过红外或激光测量距离。在一些实施例中,拍摄场景,电子设备100可以利用距离传感器180F测距以实现快速对焦。
接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。电子设备100通过发光二极管向外发射红外光。电子设备100使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定电子设备100附近有物体。当检测到不充分的反射光时,电子设备100可以确定电子设备100附近没有物体。电子设备100可以利用接近光传感器180G检测用户手持电子设备100贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。接近光传感器180G也可用于皮套模式,口袋模式自动解锁与锁屏。
环境光传感器180L用于感知环境光亮度。电子设备100可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测电子设备100是否在口袋里,以防误触。
指纹传感器180H用于采集指纹。电子设备100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。
温度传感器180J用于检测温度。在一些实施例中,电子设备100利用温度传感器180J检测的温度,执行温度处理策略。例如,当温度传感器180J上报的温度超过阈值,电子设备100执行降低位于温度传感器180J附近的处理器的性能,以便降低功耗实施热保护。在另一些实施例中,当温度低于另一阈值时,电子设备100对电池142加热,以避免低温导致电子设备100异常关机。在其他一些实施例中,当温度低于又一阈值时,电子设备100对电池142的输出电压执行升压,以避免低温导致的异常关机。
触摸传感器180K,也称“触控器件”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备100的表面,与显示屏194所处的位置不同。
骨传导传感器180M可以获取振动信号。在一些实施例中,骨传导传感器180M可以获取人体声部振动骨块的振动信号。骨传导传感器180M也可以接触 人体脉搏,接收血压跳动信号。在一些实施例中,骨传导传感器180M也可以设置于耳机中,结合成骨传导耳机。音频模块170可以基于所述骨传导传感器180M获取的声部振动骨块的振动信号,解析出语音信号,实现语音功能。应用处理器可以基于所述骨传导传感器180M获取的血压跳动信号解析心率信息,实现心率检测功能。
按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。电子设备100可以接收按键输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。
马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏194不同区域的触摸操作,马达191也可对应不同的振动反馈效果。不同的应用场景(例如:时间提醒,接收信息,闹钟,游戏等)也可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。
指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。
SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备100的接触和分离。电子设备100可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口195可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口195可以同时插入多张卡。所述多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容不同类型的SIM卡。SIM卡接口195也可以兼容外部存储卡。电子设备100通过SIM卡和网络交互,实现通话以及数据通信等功能。在一些实施例中,电子设备100采用eSIM,即:嵌入式SIM卡。eSIM卡可以嵌在电子设备100中,不能和电子设备100分离。电子设备100的软件系统可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。本发明实施例以分层架构的Android系统为例,示例性说明电子设备100的软件结构。
图2是本发明实施例的电子设备100的软件结构框图。
分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android系统分为四层,从上至下分别为应用程序层,应用程序框架层,安卓运行时(Android runtime)和系统库,以及内核层。
应用程序层可以包括一系列应用程序包。
如图2所示,应用程序包可以包括相机,图库,日历,通话,地图,导航,WLAN,蓝牙,音乐,视频,短信息等应用程序。
应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。
如图2所示,应用程序框架层可以包括窗口管理器,内容提供器,视图系 统,电话管理器,资源管理器,通知管理器等。
窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定屏幕,截取屏幕等。
内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括视频,图像,音频,拨打和接听的电话,浏览历史和书签,电话簿等。
视图系统包括可视控件,例如显示文字的控件,显示图片的控件等。视图系统可用于构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。
电话管理器用于提供电子设备100的通信功能。例如通话状态的管理(包括接通,挂断等)。
资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。
通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于告知下载完成,消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在系统顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话窗口形式出现在屏幕上的通知。例如在状态栏提示文本信息,发出提示音,电子设备振动,指示灯闪烁等。
Android Runtime包括核心库和虚拟机。Android runtime负责安卓系统的调度和管理。
核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。
应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。
系统库可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(Media Libraries),三维图形处理库(例如:OpenGL ES),2D图形引擎(例如:SGL)等。
表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D和3D图层的融合。
媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。
三维图形处理库用于实现三维图形绘图,图像渲染,合成,和图层处理等。
2D图形引擎是2D绘图的绘图引擎。
内核层是硬件和软件之间的层。内核层至少包含显示驱动,摄像头驱动,音频驱动,传感器驱动。
下面结合捕获拍照场景,示例性说明电子设备100软件以及硬件的工作流程。
当触摸传感器180K接收到触摸操作,相应的硬件中断被发给内核层。内核层将触摸操作加工成原始输入事件(包括触摸坐标,触摸操作的时间戳等信息)。原始输入事件被存储在内核层。应用程序框架层从内核层获取原始输入事件,识别该输入事件所对应的控件。以该触摸操作是触摸单击操作,该单击操作所对应的控件为相机应用图标的控件为例,相机应用调用应用框架层的接口,启动相机应用,进而通过调用内核层启动摄像头驱动,通过摄像头193捕获静态图像或视频。
图3是本申请实施例提供的一种内存管理方法的流程图,如图3中所示,该方法的执行主体可以为电子设备100,以Linux系统为例说明本申请的具体实施过程,但是本申请的应用场景不仅限于Linux系统,还可以为安卓系统、IOS系统、Windows等,该电子设备可以为手机、平板电脑等,所述方法可以包括但不限于以下步骤:
步骤S31:获取内核空间中进程对应等待的资源需求。
在一个实施例中,电子设备100在运行过程中,用于应用处理的资源是有限的,因此,电子设备在运行过程中需要不断释放内存,这样才能保证应用的有效运行。资源可以是指电子设备100在处理应用事件时所必须用到的软件或者硬件资源,比如电子设备100的内存、硬件资源等。
在一种可能实现的方式中,电子设备100可以检测内核空间中的所有进程的进程状态,并且还可以获取内核空间中进程对应等待的资源需求。
本申请的实施例中,若检测到内核空间中的进程处于等待资源状态时,电子设备将会获取每个进程此时在等待的资源需求。具体地,进程在运行过程中会访问到系统资源,当系统资源繁忙时,这些进程则需要等待资源。其中,不同的进程具有不同的资源需求,例如在同一时刻,A进程等待的可以是内存资源,B进程等待的可以是IO资源,C进程则等待的可以是锁资源。在一些可能实现的方式中,所述资源需求的资源可以包括内存资源、输入/输出(Input/Output)资源及锁资源中的至少一种。其中,所述内存资源包括SDRAM、DDR SDRAM、RDRAM,所述IO资源可以包括存储设备(例如EMMC或UFS)、串口设备等其它外设。所述锁资源可以包括mutex、semaphore及rcu等资源,可以用于进程间的同步。所述锁资源还可以包括completion资源,可以用于线程间的同步。
在一些实施例中,电子设备100可以实时地获取每个进程等待的资源需求以及等待时间等信息。具体地,在Linux系统中,进程进入不可中断的睡眠状态的条件可以是:例如第一进程发起IO请求,可能是读取磁盘逻辑地址上的数据或者读取文件系统中的文件,当IO资源繁忙时,系统IO资源不能满足第一进程的需求,该第一进程将会进入到第一状态,即D状态。又或者是第一进程发起内存资源请求时,但是系统内存资源并不能满足第一进程的需求,那么该第一进程将会进入到第一状态,又或者当第一进程需要的锁资源被其他进程持 有时,该第一进程亦会进入到第一状态。其中,在一些实施例中,所述第一状态即为一种不可中断的睡眠状态。也就是说,本申请中,处于第一状态的第一进程可以不占用处理器资源进行运行,但是仍然会占用电子设备100的内存和硬件等资源。
在其他的一些可能实现的方式中,电子设备还可以根据第一进程的等待时间来确定,将第一进程切换到第一状态。例如,可以判断第一进程处于等待资源状态的时间是否达到预设时长,若第一进程处于等待资源状态的时间达到预设时长,则确定将第一进程切换到第一状态。
步骤S32:若检测到第一进程处于第一状态达到预设条件,则更改处于第一状态的第一进程为第二状态,换出所述第一进程的内存资源。
所述第一进程处于第一状态满足预设条件可以是以下的一种情形:
判断所述第一进程处于第一状态的时间是否超过预设时间;若所述第一进程处于第一状态的时间没有超过预设时间,则不换出所述第一进程的内存资源;
若所述第一进程处于第一状态的时间超过预设时间,则需要确定所述第一进程是否符合换出内存资源的条件。若所述第一进程符合换出内存资源的条件,则更改处于第一状态的第一进程为第二状态,换出所述第一进程的内存资源。
在一种实现方式中,可以通过计算所述第一进程的换出优先级阈值,并将所述换出优先级阈值与第一阈值进行比较,因此可以根据比较结果来确定所述第一进程是否符合换出内存资源的条件。
具体可以为:
若所述第一进程的换出优先级阈值大于所述第一阈值,可以确定所述第一进程已经符合换出内存资源的条件,则更改处于第一状态的第一进程为第二状态,换出所述第一进程的内存资源;
若所述第一进程的换出优先级阈值小于所述第一阈值,可以确定所述第一进程不符合换出内存资源的条件,则不会换出所述第一进程的内存资源。
具体而言,电子设备周期性地检测内核空间中进程的状态,一般地,不可中断睡眠状态的持续时间很短,若内核空间中的第一进程处于不可中断睡眠状态的时间超过预设时间,在这种情况下,会给操作系统带来响应延迟的问题,进而影响操作系统的稳定性。因此,若检测到第一进程处于第一状态的时间超过预设时间,且所述第一进程已经符合换出内存资源的条件,电子设备将更改处于第一状态的第一进程为第二状态,并换出所述第一进程的内存资源。
举例而言,可以建立起第一进程与云存储空间或者存储器件的映射关系,即操作系统内核可能会将可以将第一进程的物理内存的内容数据(即进程信息)换出到云存储空间或者存储器件上,进而将这些物理内存资源配给内核空间中的第二进程,以此换出所述第一进程的内存资源。在一个具体的实施例中,所述存储器件可以是一种多媒体卡(Multi-Media Card,MMC)。因此,电子设备可以对第一进程进行处理以回收第一进程的内存资源。
在一些实施例中,处于该第二状态的第一进程的内存资源可以被换出,但是可以将进程信息放在磁盘中且进程可以被恢复。也就是说,若处于不可中断 睡眠状态的第一进程满足预设条件时,电子设备可以更改第一进程的状态,并且换出所述第一进程的内存资源。因此,采用本申请实施例的技术方案,可以避免处于不可中断睡眠状态的进程占用内核资源,保证设备的运行效率,有效的提高系统的可用性及稳定性。
步骤S33:若检测到释放的系统资源满足处于第二状态的第一进程的资源需求,则更改所述第一进程的状态,并换入内存资源。
可以理解的是,在一些可能的实现方式中,可以监控终端内安装的应用的信息及内存占用信息,若确认当前应用已经满足内存回收的条件,则根据预先保存的被回收内存的应用的优先级顺序,来选择终端当前正在运行的且用户没有在使用的应用,再调用内核态提供的内存回收接口来进行内存回收。此外,在Linux系统中的Swap机制中,当一个进程向操作系统请求内存不足时,操作系统会把内存中暂时不用的数据交换出去,放在Swap分区中,此过程为Swap Out(换出)。当一个进程又需要这些数据且操作系统检测还有空闲物理内存时,又会把Swap分区中的数据交换回物理内存中,此过程为Swap In(换入)。
然而上述的实现方式中可能存在如下问题:一方面,无法回收处于不可中断的睡眠状态进程所占用的内存,且内存回收后无法恢复进程,然而不可中断睡眠状态的持续时间较长时,会给操作系统带来响应延迟,进而影响操作系统的稳定性;另一方面,需要提前制定回收内存的应用列表,无法回收未在应用列表内的内存。此外,Swap机制需要低内存时才能触发,并不能提前预防终端的低内存状况。
在本申请的一个较佳的实现方式中,随着内核空间中的第二进程的运行或者退出,系统将会释放出部分资源。由此,在换出所述第一进程的内存资源之后,若电子设备检测到释放的系统资源满足处于第二状态的第一进程的资源需求,则更改所述第一进程的状态,并换入内存资源,即操作系统内核可以从云存储空间或者存储器件中找回相应的内容数据,将其拷贝回新分配的物理内存中,以此换入内存资源。因此,可以回收处于不可中断的睡眠状态进程所占用的内存,并且内存回收后还可以再恢复进程。由此,本申请的实施例可以提高操作系统的稳定性,避免电子设备出现卡顿现象,进而提升用户的体验度。
请参阅图4,本申请的实施例还提供了另一更为详细的方法流程,可以包括以下步骤:
步骤S41:检测内核空间中所有进程的进程状态。
本申请的实施例中,电子设备周期性地检测内核空间中的所有进程的进程状态。可以理解,通常由于系统资源的不足,内核空间中的进程将会处于等待资源状态,当进程进入等待资源状态时,电子设备会同时记录进程的资源需求以及等待时间等信息。
步骤S42:获取内核空间中进程对应等待的资源需求。
本申请的实施例中,电子设备可以获取到内核空间中进程对应等待的资源需求。例如,电子设备可以获取到进程的资源需求以及等待时间等信息。
步骤S43:确定进程是否进入第一状态(即判断task_struct结构中status 是否为task_uninterruptable)。若是,则进入步骤S44,否则返回到步骤S41。
举例而言,若第一进程处于等待资源状态的时间达到一定时间,则所述第一进程将进入第一状态。可以理解,所述第一状态为不可中断睡眠状态。若第二进程处于等待资源状态的时间并未达到一定时间,则所述第二进程不进入第一状态。
步骤S44:判断系统是否为低内存或者第一进程处于第一状态的时间是否超过预设时间。若是,则进入步骤S45,否则返回到步骤S41。
可以理解的是,当系统处于低内存状态超过一第一预设时间时,如系统处于低内存状态已经超过2s时,则表示系统的内存资源已经不足以支持系统可以有效率的运行,因而会造成系统卡顿现象,或者,当所述第一进程处于第一状态的时间超过第二预设时间时,如所述第一进程处于第一状态的时间已经超过5s时,即可以表明内核空间中第一进程处于不可中断睡眠状态的时间过长。在这两种情况下,将无疑会给操作系统带来响应延迟的问题,进而影响操作系统的稳定性。
可见,上述两种情况下均会影响操作系统的运行效率。因此,若电子设备检测到上述两种情况之一均会将其作为触发事件,以触发本申请实施例中的内存回收的机制,以提升系统的运行效率及稳定性。
步骤S45:确定第一进程的换出优先级阈值是否大于第一阈值。若所述第一进程的换出优先级阈值大于第一阈值,则进入步骤S46,否则返回步骤S41。
在一种实现方式中,换出优先级阈值可以与进程所占用的内存大小及进程进入第一状态的时间有关。
例如,电子设备可以采用以下公式计算换出优先级阈值:y=k×m+j×t,其中,y表示换出优先级阈值,m表示进程所占用内存的大小,t表示进程进入第一状态的时间,k和j表示计算进程换出优先级的加权系数。
在一种可能的实现方式中,当计算得到所述第一进程的换出优先级阈值后,则再将所述第一进程的换出优先级阈值与所述第一阈值进行比较。若所述第一进程的换出优先级阈值大于所述第一阈值,则确定可以换出所述第一进程的内存资源。若所述第一进程的换出优先级阈值小于所述第一阈值,则确定不换出所述第一进程的内存资源。
可以理解的是,本申请的实施例中,y的数值越大,表示进程的换出优先级越高,y的数值越小,表示进程的换出优先级越低。由此,本申请的一个实施例中,电子设备可以通过获取第一进程所占用的内存大小和第一进程进入第一状态的时间,因此再结合加权系数的运算来确定多个第一进程的换出优先级。
可以理解的是,电子设备可以对处于第一状态的多个第一进程按照换出优先级阈值进行排序,先将换出优先级阈值最高的第一进程作为待换出的进程,以便换出该第一进程所占用的内存,之后会继续将换出优先级阈值第二高的第一进程作为待换出的进程。那么,进程的换出优先级阈值越高,越早换出进程所占用的内存,进程的换出优先级越低,越晚换出进程所占用的内存。
本设计中,通过基于第一进程所占用的内存大小和第一进程进入第一状态 的时间确定待换出的第一进程的方式,可以达到以下技术效果:
可以优先将占用内存较大且进入第一状态时间较长的第一进程换出,能够及时地换出第一进程所占用的内存资源,提高系统的运行效率。
步骤S46:为所述第一进程换出存储空间,并将所述第一进程的进程信息存储于所述存储空间中。
电子设备为所述第一进程换出存储空间,所述电子设备将所述第一进程的进程信息存储于所述存储空间中。
例如,由于不可中断的睡眠状态存在的意义在于,内核的一些处理流程是不能被打断的。因此,如果这些处理流程如果被打断可能会导致数据丢失等问题。因此在更改所述第一进程的状态之前,先保存第一进程的临时数据(即进程信息),可以确保更改后下次恢复能找到这些进程。在一些实施例中,所述电子设备可以将所述第一进程的进程信息存储至存储器件或者云存储空间。因此,既为系统腾出了内存空间还保证了第一进程运行时产生的数据不丢失。
可以理解的是,本申请实施例中,所述进程信息可以包括进程标识符(例如操作系统每运行一个进程都会创建一个进程ID,这个进程ID就是进程标识符,进程标识符用于区别不同的进程)、第一进程更改状态之前的所处的状态(例如第一进程更改进程状态之前的进程状态为不可中断睡眠状态,那么此时进程信息里此处为不可中断睡眠状态)、第一进程处于第一状态的时间(例如第一进程处于不可中断睡眠状态的时间为5s,此时进程信息里此处为5s)以及第一进程的数据信息状态(例如第一进程加载完成或传输数据完成比例为30%,此时进程信息里此处为加载完成或传输完成比例为30%)中的至少一种。可以理解的是,上述进程信息不限于这些信息,对此本申请对此不作具体限定
步骤S47:更改处于第一状态的第一进程为第二状态,换出所述第一进程的内存资源。
电子设备可以更改第一进程的状态,即将处于第一状态的第一进程为第二状态,本申请实施例中,处于第二状态的第一进程所占用的内存资源可以被释放,以换出所述第一进程的内存资源。
步骤S48:若检测到释放的系统资源满足处于第二状态的第一进程的资源需求,则更改所述第一进程的状态,并换入内存资源。
如图5所示,若检测到释放的系统资源满足处于第二状态的第一进程的资源需求,则更改所述第一进程的状态的方法可以包括但不限于步骤S51-S53。
步骤S51:处于第二状态的第一进程换入内存资源。
在一种可能的设计中,当检测到释放的系统资源已经可以满足处于第二状态的第一进程的资源需求时,处于第二状态的第一进程换入内存资源,操作系统内核存储器件中找回相应的内容数据,将其拷贝回到物理内存中,以此换入内存资源。
步骤S52:更改第一进程的状态为第一状态。
在一种可能的设计中,当处于第二状态的第一进程换入内存资源后,则更改处于第二状态的所述第一进程为第一状态,即更改所述第一进程的状态为D 状态。
步骤S53:第一进程获取所等待的资源后,则更改第一进程的状态为第三状态。
在一种可能的设计中,释放的系统资源已经满足第一进程的资源需求后,处于D状态的第一进程将可以获取所等待的资源,接着再更改第一进程的状态为第三状态。可以理解的是,本申请实施例中的所述第三状态可以为可执行状态(即R状态)。由此,本申请的实施例中,所述第一进程可以根据释放的系统资源来重新恢复进程,
如图6所示,若检测到释放的系统资源满足处于第二状态的第一进程的资源需求,则更改所述第一进程的状态的方法可以包括但不限于步骤S61-S62。
步骤S61:处于第二状态的第一进程换入内存资源。
在一种可能的设计中,当检测到释放的系统资源已经可以满足处于第二状态的第一进程的资源需求时,处于第二状态的第一进程换入内存资源,操作系统从存储器件中找回相应的进程数据,将其拷贝回到物理内存中,以此换入内存资源。
步骤S62:第一进程获取所等待的资源,并更改第一进程的状态为第三状态。
在一种可能的设计中,释放的系统资源已经满足第一进程的资源需求后,处于第二状态的第一进程将可以获取所等待的资源,接着再更改第一进程的状态为R状态。由此,本申请的实施例中,所述第一进程可以根据释放的系统资源来重新恢复进程。由上可知,本申请的实施例中,所述第一进程可以根据系统机制来对内存资源进行换入换出。
请参阅图7,图7是本申请实施例中内核空间中进程的状态切换图。
以Linux系统为例,本申请的实施例可以通过在第一进程处于第一状态(即D状态)时增加第二状态,即更改处于第一状态的第一进程为第二状态,由此可以换出所述第一进程的内存资源。
具体地,以第一状态为D状态为例,在Linux系统中,在CPU上运行的进程,若系统资源不能满足第一进程的资源需求时,例如第一进程发起IO请求,即等待IO状态,但是系统资源不能满足第一进程等待的IO资源时,第一进程将会从占有CPU执行切换到D状态。
本设计中,当检测系统处于低内存或者第一进程处于第一状态的时间达到预设时间时,处于D状态的第一进程将会切换到目标状态,此时将会换出内存资源。当释放的系统资源可以满足第一进程的资源需求时,处于目标状态的第一进程将会切换到R状态,并且换入内存资源。当然,在CPU上运行的这些进程,可以根据操作系统的调度方式来切换至T状态、S状态及Z状态。
在本申请一实施例中,为了更好的描述本申请中进程的操作,请参阅图8,进程的控制过程可以包括:
进程在运行时会访问系统的资源,若系统的资源繁忙时,则进程需要等待资源,进程管理模块获取进程对应等待的资源需求。当进程处于等待资源状态 的时间达到一定时间,进程切换到D状态。外部触发换出内存机制,即确定系统是否为低内存或者进程处于D状态的时间是否超过预设时间,若是,则确定进程的换出优先级。
进一步地,进程信息换出到存储空间,进程管理模块更改处于D状态的进程为第二状态,换出所述进程的内存资源。当进程等待的资源已经就绪时,即已经检测到释放的系统资源可以满足处于第二状态的进程的资源需求时,则从存储空间读取进程信息,然后再重新恢复进程。
本申请实施例的进程切换,通过更改处于D状态的第一进程为第二状态,再换出所述第一进程内存资源,再根据第一进程等待的资源需求来对应恢复进程,使得操作系统的运行效率更高、更稳定。
请参阅图9,如下将以第一进程的资源需求是内存资源为应用场景说明本申请的具体实施过程,所述方法可以包括但不限于以下步骤:
步骤S91:获取内核空间中进程对应等待的资源需求。
步骤S92:判断系统是否为低内存或者第一进程处于第一状态的时间是否超过预设时间。若是,则进入步骤S93,否则返回到步骤S91。
步骤S93:判断所述第一进程的换出优先级阈值是否大于第一阈值,若所述第一进程的换出优先级阈值大于所述第一阈值,则进入步骤S94,否则返回到步骤S91。
若所述第一进程的换出优先级阈值大于所述第一阈值,则确定可以换出所述第一进程的内存资源。若所述第一进程的换出优先级阈值小于所述第一阈值,则确定不换出所述第一进程的内存资源。
步骤S94:为所述第一进程换出存储空间,并将所述第一进程的进程信息存储于所述存储空间中。
步骤S95:更改处于第一状态的第一进程为第二状态,换出所述第一进程的内存资源。
电子设备可以更改第一进程的状态,即将处于第一状态的第一进程为第二状态,本申请实施例中,处于第二状态的第一进程所占用的内存资源可以被释放,以换出所述第一进程的内存资源。
步骤S96:所述第一进程的资源需求为内存资源。
步骤S97:若检测到释放的系统资源满足所述第一进程等待的内存资源,则更改所述第一进程的状态,并换入内存资源。
当释放的系统资源可以满足第一进程的内存资源需求时,则可以将更改第一进程的状态,并换入内存资源,以重新恢复所述第一进程。
可见,在图9所描述的方法流程中,在一个进程的资源需求为内存资源时,可以对处于D状态的所述第一进程的内存进行回收,从而减少电子设备出现卡顿现象的概率,并且在释放的系统资源可以满足进程的内存资源需求时,可以重新恢复所述第一进程,提升用户体验。
请参阅图10,如下将以第一进程的资源需求是IO资源为应用场景说明本申请的具体实施过程,所述方法可以包括但不限于以下步骤:
步骤S101:获取内核空间中进程对应等待的资源需求。
步骤S102:确定系统是否为低内存或者第一进程处于第一状态的时间是否超过预设时间。若是,则进入步骤S103,否则返回到步骤S101。
步骤S103:判断所述第一进程的换出优先级阈值是否大于第一阈值,若所述第一进程的换出优先级阈值大于所述第一阈值,则进入步骤S104,否则返回到步骤S101。
若所述第一进程的换出优先级阈值大于所述第一阈值,则确定可以换出所述第一进程的内存资源。若所述第一进程的换出优先级阈值小于所述第一阈值,则确定不换出所述第一进程的内存资源。
步骤S104:为所述第一进程换出存储空间,并将所述第一进程的进程信息存储于所述存储空间中。
步骤S105:更改处于第一状态的第一进程为第二状态,换出所述第一进程的内存资源。
电子设备可以更改第一进程的状态,即将处于第一状态的第一进程为第二状态,本申请实施例中,处于第二状态的第一进程所占用的内存资源可以被释放,以换出所述第一进程的内存资源。
步骤S106:所述第一进程的资源需求为IO资源。
步骤S107:若检测到释放的系统资源满足所述第一进程等待的IO资源,则更改所述第一进程的状态,并换入内存资源。
当释放的系统资源可以满足第一进程的IO资源需求时,则可以将更改第一进程的状态,并换入内存资源,以重新恢复所述第一进程。
可见,在图10所描述的方法流程中,在第一进程的资源需求为IO资源时,可以对处于D状态的所述第一进程的内存进行回收,从而减少电子设备出现卡顿现象的概率,并且在释放的系统资源可以满足第一进程的IO资源需求时,可以重新恢复所述第一进程,提升用户体验。
请参阅图11,如下将以第一进程的资源需求是锁资源为应用场景说明本申请的具体实施过程,所述方法可以包括但不限于以下步骤:
步骤S111:获取内核空间中进程对应等待的资源需求。
步骤S112:判断系统是否为低内存或者第一进程处于第一状态的时间是否超过预设时间。若是,则进入步骤S113,否则返回到步骤S111。
步骤S113:判断所述第一进程的换出优先级阈值是否大于第一阈值,若所述第一进程的换出优先级阈值大于所述第一阈值,则进入步骤S114,否则返回到步骤S111。
若所述第一进程的换出优先级阈值大于所述第一阈值,则确定可以换出所述第一进程的内存资源。若所述第一进程的换出优先级阈值小于所述第一阈值,则确定不换出所述第一进程的内存资源。
步骤S114:为所述第一进程换出存储空间,并将所述第一进程的进程信息存储于所述存储空间中。
步骤S115:更改处于第一状态的第一进程为第二状态,换出所述第一进程 的内存资源。
电子设备可以更改第一进程的状态,即将处于第一状态的第一进程为第二状态,本申请实施例中,处于第二状态的第一进程所占用的内存资源可以被释放,以换出所述第一进程的内存资源。
步骤S116:所述第一进程的资源需求为锁资源。
步骤S117:若检测到释放的系统资源满足所述第一进程等待的锁资源,则更改所述第一进程的状态,并换入内存资源。
当释放的系统资源可以满足第一进程的内存资源需求时,则可以将更改第一进程的状态,并换入内存资源,以重新恢复所述第一进程。
可见,在图11所描述的方法流程中,在第一进程的资源需求为锁资源时,可以对处于D状态的所述第一进程的内存进行回收,从而减少电子设备出现卡顿现象的概率,并且在释放的系统资源可以满足第一进程的锁资源需求时,可以重新恢复所述第一进程,提升用户体验。
请参阅图12,图12是本申请实施例公开的一种内存管理装置的结构示意图。其中,该内存管理装置可以用于执行图3至图11中所描述的内存管理方法的部分或全部步骤,具体请参见图3至图11中的相关描述,在此不再赘述。如图12所示,所述内存管理装置200可以包括:
检测模块201,用于获取内核空间中进程对应等待的资源需求。
进程管理模块202,用于若检测到第一进程处于第一状态满足预设条件,则更改处于第一状态的第一进程为第二状态,并换出所述第一进程的内存资源。
所述进程管理模块202还用于:若检测到释放的系统资源满足处于第二状态的第一进程的资源需求,则更改所述第一进程的状态,并换入内存资源。
可选地,所述进程管理模块202具体用于:
若检测到释放的系统资源满足处于第二状态的第一进程的资源需求,则更改所述第一进程的状态为第三状态,并换入内存资源。
可选地,所述进程管理模块202还具体用于:
若检测到释放的系统资源满足处于第二状态的第一进程的资源需求,则更改所述第一进程的状态为第一状态,系统给资源给所述第一进程。
可选地,所述内存管理装置200还可以包括:
分配模块203,在所述进程管理模块202更改处于第一状态的第一进程为第二状态之前,所述分配模块203还用于为所述第一进程换出存储空间。
存储模块204,用于将所述第一进程的进程信息存储于所述存储空间中。
具体地,所述检测模块201还用于:
获取所述第一进程所占用的内存大小及所述第一进程进入第一状态的时间;
基于所述第一进程所占用的内存大小及所述第一进程进入第一状态的时间,获取所述第一进程的换出优先级。
确定模块205,用于根据所述第一进程的换出优先级,确定所述第一进程中待换出的第一进程,即用于确定处于第一状态的多个第一进程换出内存资源的 优先顺序。
可以理解的是,上述内存管理装置中各个模块的划分仅用于举例说明,在其他的实施例中,可将内存管理装置按照需要划分为不同的模块,以完成上述内存管理装置的全部或部分功能。
本申请实施例中提供的内存管理装置中的各个模块的实现,可为计算机程序的形式。该计算机程序可在电子设备或服务器上运行。该计算机程序构成的程序模块可存储在终端或服务器的存储器上。该计算机程序被处理器执行时,实现本申请实施例中所描述的步骤。在本申请实施例中各个模块的具体实现还可以对应参照图3至图11所示的方法实施例的相应描述。在图12所描述的内存管理装置中,可以提前回收低使用率内存,从而可以避免应用卡顿,提升用户体验。具体内容可以参见上述内存管理的方法的具体实施例,在此不再详述。
本申请实施例还提供了一种计算机可读存储介质。所述可读存储介质中存储有计算机指令,所述指令在计算设备上运行时,使得计算设备执行前述实施例提供的内存管理方法。
对于本领域的技术人员而言,显然本申请不限于上述示范性实施例的细节,而且在不背离本申请的精神或基本特征的情况下,能够以其他具体形式实现本申请。因此,只要在本申请的实质精神范围之内,对以上实施例所作的适当改变和变化都应该落在本申请要求保护的范围之内。
Claims (12)
- 一种内存管理方法,其特征在于,所述内存管理方法包括:获取内核空间中进程对应等待的资源需求;若检测到第一进程处于第一状态满足预设条件时,则更改处于第一状态的第一进程为第二状态,换出所述第一进程的内存资源;若检测到释放的系统资源满足处于第二状态的第一进程的资源需求,则更改所述第一进程的状态,并换入内存资源。
- 如权利要求1所述的内存管理方法,其特征在于,所述内存管理方法还包括:若检测到释放的系统资源满足处于第二状态的第一进程的资源需求,则更改所述第一进程的状态为第三状态,并换入内存资源。
- 如权利要求1或2所述的内存管理方法,其特征在于,所述内存管理方法还包括:若检测到释放的系统资源满足处于第二状态的第一进程的资源需求,则更改所述第一进程的状态为第一状态,系统给资源给所述第一进程。
- 如权利要求1-3任意一项所述的内存管理方法,其特征在于,所述更改处于第一状态的第一进程为第二状态之前,所述内存管理方法还包括:为所述第一进程换出存储空间;将所述第一进程的进程信息存储于所述存储空间中。
- 如权利要求1-3任意一项所述的内存管理方法,其特征在于,所述资源需求的资源包括内存资源、IO资源及锁资源中的至少一种。
- 如权利要求5所述的内存管理方法,其特征在于,所述更改处于第一状态的第一进程为第二状态之后,所述内存管理方法还包括:若所述第一进程的资源需求为内存资源;若检测到释放的系统资源满足所述第一进程等待的内存资源,则更改所述第一进程的状态,并换入内存资源。
- 如权利要求5所述的内存管理方法,其特征在于,所述更改处于第一状态的第一进程为第二状态之后,所述内存管理方法还包括:若所述第一进程的资源需求为IO资源;若检测到释放的系统资源满足所述第一进程等待的IO资源,则更改所述第一进程的状态,并换入内存资源。
- 如权利要求5所述的内存管理方法,其特征在于,所述更改处于第一状态的第一进程为第二状态之后,所述内存管理方法还包括:若所述第一进程的资源需求为锁资源;若检测到释放的系统资源满足所述第一进程等待的锁资源,则更改所述第一进程的状态,并换入内存资源。
- 如权利要求4所述的内存管理方法,其特征在于,所述进程信息包括进 程标识符、进程处于第一状态的时间以及进程的数据信息状态中的至少一种。
- 如权利要求1-9任意一项所述的内存管理方法,其特征在于,所述内存管理方法还包括:获取所述第一进程所占用的内存大小及所述第一进程进入第一状态的时间;基于所述第一进程所占用的内存大小及所述第一进程进入第一状态的时间,获取所述第一进程的换出优先级;基于所述第一进程的换出优先级,确定所述第一进程中待换出的第一进程。
- 一种电子设备,其特征在于,包括:存储器,用于存储计算机程序;处理器,用于执行所述存储器存储的所述计算机程序,当所述计算机程序被执行时,所述处理器用于执行如权利要求1至10任意一项所述的内存管理方法。
- 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质包括计算机指令,当所述计算机指令在电子设备上运行时,使得所述电子设备执行如权利要求1至10任意一项所述的内存管理方法。
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
EP21879151.5A EP4209906A4 (en) | 2020-10-12 | 2021-09-03 | MEMORY MANAGEMENT METHOD, ELECTRONIC DEVICE AND COMPUTER READABLE STORAGE MEDIUM |
US18/248,073 US20230385112A1 (en) | 2020-10-12 | 2021-09-03 | Memory Management Method, Electronic Device, and Computer-Readable Storage Medium |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011086582.1A CN114356537A (zh) | 2020-10-12 | 2020-10-12 | 内存管理方法、电子设备以及计算机可读存储介质 |
CN202011086582.1 | 2020-10-12 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2022078105A1 true WO2022078105A1 (zh) | 2022-04-21 |
Family
ID=81089651
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2021/116550 WO2022078105A1 (zh) | 2020-10-12 | 2021-09-03 | 内存管理方法、电子设备以及计算机可读存储介质 |
Country Status (4)
Country | Link |
---|---|
US (1) | US20230385112A1 (zh) |
EP (1) | EP4209906A4 (zh) |
CN (1) | CN114356537A (zh) |
WO (1) | WO2022078105A1 (zh) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114860347A (zh) * | 2022-05-27 | 2022-08-05 | 上海联影医疗科技股份有限公司 | 一种孪生进程重启方法、设备、医疗系统及存储介质 |
CN115292199A (zh) * | 2022-09-22 | 2022-11-04 | 荣耀终端有限公司 | 一种显存泄露的处理方法及相关装置 |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116089055B (zh) * | 2022-05-16 | 2024-04-02 | 荣耀终端有限公司 | 资源调度方法和装置 |
CN117707753B (zh) * | 2023-06-25 | 2024-09-20 | 荣耀终端有限公司 | 资源更新控制方法、电子设备及芯片系统 |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103713882A (zh) * | 2013-12-20 | 2014-04-09 | 华为技术有限公司 | 一种数据换入内存的方法和装置 |
US20140164718A1 (en) * | 2012-12-07 | 2014-06-12 | Open Kernel Labs, Inc. | Methods and apparatus for sharing memory between multiple processes of a virtual machine |
CN107766151A (zh) * | 2017-09-28 | 2018-03-06 | 郑州云海信息技术有限公司 | 一种页面换出方法 |
CN107885666A (zh) * | 2016-09-28 | 2018-04-06 | 华为技术有限公司 | 一种内存管理方法和装置 |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7523344B2 (en) * | 2006-05-08 | 2009-04-21 | Sun Microsystems, Inc. | Method and apparatus for facilitating process migration |
US8799554B1 (en) * | 2010-10-27 | 2014-08-05 | Amazon Technologies, Inc. | Methods and system for swapping memory in a virtual machine environment |
US10216536B2 (en) * | 2016-03-11 | 2019-02-26 | Vmware, Inc. | Swap file defragmentation in a hypervisor |
-
2020
- 2020-10-12 CN CN202011086582.1A patent/CN114356537A/zh active Pending
-
2021
- 2021-09-03 EP EP21879151.5A patent/EP4209906A4/en active Pending
- 2021-09-03 US US18/248,073 patent/US20230385112A1/en active Pending
- 2021-09-03 WO PCT/CN2021/116550 patent/WO2022078105A1/zh active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140164718A1 (en) * | 2012-12-07 | 2014-06-12 | Open Kernel Labs, Inc. | Methods and apparatus for sharing memory between multiple processes of a virtual machine |
CN103713882A (zh) * | 2013-12-20 | 2014-04-09 | 华为技术有限公司 | 一种数据换入内存的方法和装置 |
CN107885666A (zh) * | 2016-09-28 | 2018-04-06 | 华为技术有限公司 | 一种内存管理方法和装置 |
CN107766151A (zh) * | 2017-09-28 | 2018-03-06 | 郑州云海信息技术有限公司 | 一种页面换出方法 |
Non-Patent Citations (2)
Title |
---|
DENG YAOBIAO: "Design and Implementation of a System for Transparent Remote Memory Accessing", CHINESE MASTER'S THESES FULL-TEXT DATABASE, 26 April 2013 (2013-04-26), pages 1 - 66, XP055922039 * |
See also references of EP4209906A4 * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114860347A (zh) * | 2022-05-27 | 2022-08-05 | 上海联影医疗科技股份有限公司 | 一种孪生进程重启方法、设备、医疗系统及存储介质 |
CN115292199A (zh) * | 2022-09-22 | 2022-11-04 | 荣耀终端有限公司 | 一种显存泄露的处理方法及相关装置 |
CN115292199B (zh) * | 2022-09-22 | 2023-03-24 | 荣耀终端有限公司 | 一种显存泄露的处理方法及相关装置 |
Also Published As
Publication number | Publication date |
---|---|
EP4209906A1 (en) | 2023-07-12 |
US20230385112A1 (en) | 2023-11-30 |
EP4209906A4 (en) | 2024-01-24 |
CN114356537A (zh) | 2022-04-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2020259452A1 (zh) | 一种移动终端的全屏显示方法及设备 | |
WO2020108356A1 (zh) | 一种应用显示方法及电子设备 | |
WO2021213164A1 (zh) | 应用界面交互方法、电子设备和计算机可读存储介质 | |
CN114443277A (zh) | 内存管理方法、装置、电子设备以及计算机可读存储介质 | |
WO2022078105A1 (zh) | 内存管理方法、电子设备以及计算机可读存储介质 | |
WO2021036770A1 (zh) | 一种分屏处理方法及终端设备 | |
CN113553130B (zh) | 应用执行绘制操作的方法及电子设备 | |
WO2022257748A1 (zh) | 虚拟内存管理方法和电子设备 | |
WO2021052415A1 (zh) | 资源调度方法及电子设备 | |
CN111543042A (zh) | 通知消息的处理方法及电子设备 | |
CN111913750B (zh) | 一种应用程序管理方法、装置及设备 | |
WO2022052897A1 (zh) | 调整内存配置参数的方法和装置 | |
WO2021223539A1 (zh) | 射频资源分配方法及装置 | |
CN114461588B (zh) | 调节预读窗口的方法及电子设备 | |
WO2021052070A1 (zh) | 一种帧率识别方法及电子设备 | |
WO2021093626A1 (zh) | 一种内存的管理方法及电子设备 | |
CN114461589B (zh) | 读取压缩文件的方法、文件系统及电子设备 | |
WO2022100141A1 (zh) | 插件管理方法、系统及装置 | |
WO2022095744A1 (zh) | Vr显示控制方法、电子设备及计算机可读存储介质 | |
CN117130773A (zh) | 资源分配方法、装置和设备 | |
CN115206308A (zh) | 一种人机交互的方法及电子设备 | |
CN112783418B (zh) | 一种存储应用程序数据的方法及移动终端 | |
WO2022188511A1 (zh) | 语音助手唤醒方法及装置 | |
CN114816028A (zh) | 屏幕刷新方法、电子设备和计算机可读存储介质 | |
WO2022143891A1 (zh) | 焦点同步方法及电子设备 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 21879151 Country of ref document: EP Kind code of ref document: A1 |
|
WWE | Wipo information: entry into national phase |
Ref document number: 18248073 Country of ref document: US |
|
ENP | Entry into the national phase |
Ref document number: 2021879151 Country of ref document: EP Effective date: 20230404 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |