Process processing method and device, electronic equipment and storage medium

By dynamically adjusting the number of processes according to the memory pressure value and the number of applications, the performance problem of a fixed number of processes in the operating system is solved, and the system performance and resource utilization efficiency are improved.

CN120653375APending Publication Date: 2025-09-16BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410289144.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-13
Publication Date
2025-09-16

Smart Images

  • Figure CN120653375A_ABST
    Figure CN120653375A_ABST
Patent Text Reader

Abstract

The invention provides a process processing method and device, electronic equipment and a storage medium, and the method comprises the steps: obtaining a memory pressure value and / or the number of started application programs at a target processing moment, determining a target number of processes needing to be created in a system at the target processing moment according to the memory pressure value and / or the number of the application programs, and processing the processes according to the target number. According to the method, the number of the created processes in the system is adjusted, the target number of the processes needing to be created in the system is dynamically determined based on the memory pressure condition of the system and the starting condition of the application program, the process requirements of the system under different conditions are met, and the system performance is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a process processing method, device, electronic device, and storage medium. Background Art

[0002] The operating system will create a fixed number of processes in advance. When an application is started, the already created process is directly assigned to the started application, thus eliminating the need to create the process in order to improve system performance.

[0003] However, in actual applications, pre-creating a fixed number of processes in the system may increase the system load and reduce system performance. Summary of the Invention

[0004] The present application aims to solve one of the technical problems in the related art at least to a certain extent.

[0005] To this end, the present application proposes a process processing method, device, electronic device and storage medium to improve system performance by dynamically adjusting the number of created processes.

[0006] In one aspect, an embodiment of the present application provides a process processing method, including:

[0007] Obtain the memory pressure value and / or the number of started applications at the target processing moment;

[0008] Determining a target number of processes that need to be created in the system at the target processing time according to the memory pressure value and / or the number of applications;

[0009] According to the target number, the number of processes created in the system is adjusted.

[0010] Another embodiment of the present application provides a process processing device, including:

[0011] An acquisition module, used to obtain a memory pressure value and / or the number of started applications at a target processing moment;

[0012] a determination module, configured to determine a target number of processes to be created in the system at the target processing time according to the memory pressure value and / or the number of applications;

[0013] The adjustment module is used to adjust the number of processes created in the system according to the target number.

[0014] Another embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the method described in the above aspect is implemented.

[0015] Another aspect of the present application provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method described in the aforementioned aspect is implemented.

[0016] Another embodiment of the present application provides a computer program product having a computer program stored thereon, which implements the method described in the above aspect when the program is executed by a processor.

[0017] The process processing method, device, electronic device and storage medium proposed in this application obtain the memory pressure value and / or the number of started applications at the target processing moment, determine the target number of processes that need to be created in the system at the target processing moment based on the memory pressure value and / or the number of applications, adjust the number of processes already created in the system based on the target number, and dynamically determine the target number of processes that need to be created in the system based on the system's memory pressure situation and the startup situation of the applications, so as to meet the system's process requirements in different situations and improve system performance.

[0018] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0020] Figure 1 A flowchart of a process processing method provided in an embodiment of the present application;

[0021] Figure 2 A flowchart of another process processing method provided in an embodiment of the present application;

[0022] Figure 3 A schematic diagram of a process processing method provided in an embodiment of the present application;

[0023] Figure 4 A schematic diagram of the structure of a process processing device provided in an embodiment of the present application;

[0024] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0025] The following describes in detail embodiments of the present application, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.

[0026] The following describes the process processing method, device, electronic device and storage medium of the embodiments of the present application with reference to the accompanying drawings.

[0027] Figure 1 A flowchart of a process processing method provided in an embodiment of the present application.

[0028] The executor of the process processing method in the embodiment of the present application is a process processing device, which can be set in an electronic device, including a mobile phone, a television, a smart wearable device and a vehicle-mounted device, which is not limited in this embodiment.

[0029] like Figure 1 As shown, the method may include the following steps:

[0030] Step 101: Obtain a memory pressure value and / or the number of started application programs at a target processing moment.

[0031] The target processing moment is any processing moment during the operation of the operating system of the electronic device, such as the current processing moment. The processing moment is determined based on a set processing time interval or a set processing cycle. For example, if the processing interval or cycle is 1 second, there will be a corresponding processing moment for every 1-second interval.

[0032] Regarding the memory pressure value, in one implementation of an embodiment of the present application, the user space receives the pressure event sent by the system resource pressure assessment tool (Press Stall Information, PSI) of the kernel space through a setting process in the system, parses the pressure event to determine the memory usage, and determines the memory pressure value, wherein the pressure value of the memory is related to the memory usage, and the higher the memory usage, the greater the memory pressure value. Among them, the setting process can be a daemon process started by the init process, such as the lmkd process, or a daemon process newly added to the system to receive pressure events. In an embodiment of the present application, the feedback of the pressure event in the kernel space is real-time feedback, that is, when a change in memory usage is detected, a pressure event is generated and fed back to the user space.

[0033] In the embodiment of the present application, the memory pressure value may be one or more.

[0034] In one scenario, the memory pressure value at the target processing moment is one, and the pressure value is determined based on the most recently acquired pressure event.

[0035] In another scenario, there are multiple memory pressure values ​​at the target processing moment, and the multiple pressure values ​​are stored through an array. The multiple pressure values ​​are stored in the order of the time of acquisition. A set number of pressure values ​​can be stored in the array, wherein the set number can be set based on demand and is not limited in this embodiment. When the pressure values ​​stored in the array are full, when storing the latest pressure value newly acquired, it is necessary to delete the first saved value array[0] in the array, and shift the pressure values ​​in the array forward one position in turn. The vacant position is used to save the latest pressure value, so as to realize the dynamic update of the memory pressure value stored in the array.

[0036] In an embodiment of the present application, after the operating system is started, it will start commonly used applications and count the number of started applications. After the application is started, the pre-created process will be allocated to the started application for use. Therefore, the more applications are started, the more processes need to be pre-created, and vice versa.

[0037] Step 102: Determine the target number of processes that need to be created in the system at the target processing time according to the memory pressure value and / or the number of application programs.

[0038] In one implementation of the embodiment of the present application, the target number of processes that need to be created in the system at the target processing moment is determined based on the memory pressure value stored in the system at the target processing moment. As an implementation method, the memory pressure value is one, and the correspondence between the memory pressure value and the number of processes that need to be created is obtained. According to the correspondence, the target number corresponding to a memory pressure value stored at the target processing moment can be queried and determined. As another implementation method, there are multiple memory pressure values, and the target number of processes that need to be created in the system at the target processing moment is determined based on the multiple memory pressure values. As an implementation method, a first average value of multiple memory pressure values ​​at the target processing moment is calculated, and a second average value calculated for multiple memory pressure values ​​at the previous processing moment of the target processing moment is obtained. According to the difference between the first average value and the second average value, the first number of processes that need to be created in the system is determined, and the target number is determined based on the first number. The specific implementation method will be described in detail in the subsequent embodiments and will not be repeated in this embodiment.

[0039] In another implementation of the embodiment of the present application, the target number of processes that need to be created in the system at the target processing moment is determined based on the number of applications started by the system at the target processing moment. The more applications that are started, the larger the target number of processes that the system needs to create, and vice versa. Specifically, a relationship table is obtained, wherein the relationship table includes a correspondence between the number of applications and the number of processes that need to be created, wherein the relationship table is determined in advance based on experience, and the relationship table is queried based on the number of applications to determine a second number of processes that need to be created in the system, and the target number is determined based on the second number. As an implementation method, the second number can be used as the target number.

[0040] In another implementation of the embodiment of the present application, the target number of processes that need to be created in the system at the target processing moment is determined based on the memory pressure value and the number of applications. Specifically, the first number of processes that need to be created in the system at the target processing moment can be determined based on the memory pressure value, and the second number of processes that need to be created in the system at the target processing moment can be determined based on the number of applications. The target number is determined based on the first number and the second number. The number of processes maintained by the system application is determined by the memory pressure value and the number of started applications, thereby improving accuracy. As an implementation method, the smaller number can be determined from the first number and the second number, and the smaller number can be used as the target number. If the first number is less than the second number, the first number is used as the target number; if the first number is greater than the second number, the second number is used as the target number. As another implementation method, the number obtained by weighted average of the first number and the second number is used as the target number, wherein the weight of the first number and the weight of the second number can be determined based on the needs of the application scenario, which is not limited in this embodiment.

[0041] It should be understood that in the related art, the operating system adopts a mechanism (Unspecialized App Process, USAP) to set a first set number of processes and a second set number of processes that can be pre-created in the operating system, wherein the second set number of processes is less than the first set number of processes. For example, the second set number of processes is 0 and the first set number of processes is 10. The operating system maintains the number of processes pre-created in the operating system based on the first set number of processes and the second set number of processes. The number of pre-created processes can be stored in a process pool. That is to say, if the number of processes in the process pool is lower than the first set number of processes, the USAP process will continue to pre-create processes until the first set number of processes is reached. Therefore, the maximum number of processes in the process pool is the first set number of processes. However, in this application, the first set number of processes is not used to pre-create processes, but the target number is dynamically determined as the number of pre-created processes, which meets the actual process requirements in different scenarios. Therefore, the target number needs to be less than or equal to the first set number of processes that can be pre-created in the operating system, and greater than or equal to the second set number of processes that can be pre-created. In the embodiment of the present application, the target number of processes to be created is determined based on actual needs, and the fixed number of first set processes is no longer used to create processes, thereby improving the accuracy of the number of pre-created processes.

[0042] Step 103: Adjust the number of processes created in the system according to the target number.

[0043] The target number is determined by the system based on the memory pressure and / or the number of open applications (corresponding to different scenarios). It is the maximum number of processes that can be created at the target processing moment while meeting system performance. The number of processes created in the system is based on the target number determined at the previous processing moment of the target processing moment, and the number of created processes is less than or equal to the target number determined at the previous processing moment. The target number determined at the target processing moment and the target number determined at the previous processing moment may be the same or different. Therefore, the number of processes created in the system may be the same as or different from the target number.

[0044] In one scenario of an embodiment of the present application, the target number is compared with the number of processes already created. In response to the target number being greater than the number of processes already created, the number of processes already created in the system is increased until the target number is reached. For example, if the target number of processes that can be created in the system is 8 and 7 processes have already been created in the system, then one more process can be created in the system.

[0045] In the second scenario of the embodiment of the present application, the target number is compared with the number of created processes. In response to the target number being less than the number of created processes, the number of created processes in the system is reduced until the target number is reached. For example, if the target number of processes that can be created in the system is 8 and 9 processes have already been created, then one more process can be deleted from the system. This can be done randomly or based on experience to delete processes with low usage rates.

[0046] In the third scenario of the embodiment of the present application, the target number is compared with the number of created processes. In response to the target number being equal to the number of created processes, the number of created processes in the system is maintained. For example, if the target number of processes that can be created in the system is 8 and 8 processes have already been created in the system, the number of processes is maintained at 8.

[0047] In the process processing method of the embodiment of the present application, the memory pressure value of the system and / or the number of started applications at the target processing moment are obtained, and the target number of processes that need to be created in the system at the target processing moment is determined based on the memory pressure value and / or the number of applications. According to the target number, the number of processes already created in the system is adjusted. Based on the system's memory pressure situation and the startup situation of the application, the target number of processes that need to be created in the system is dynamically determined to meet the system's process requirements in different situations and improve system performance.

[0048] Based on the above embodiments, Figure 2 A flowchart of another process processing method provided in an embodiment of the present application is shown as follows: Figure 2 The figure shows how to determine the system pressure situation based on the memory pressure value and the number of started applications, thereby determining the number of processes actually required by the system and avoiding the creation of unnecessary processes to save memory and processor CPU computing resources and improve system performance. The method includes the following steps:

[0049] Step 201: Obtain the memory pressure value and the number of started application programs at the target processing moment.

[0050] Among them, step 201 can refer to the explanation in the above embodiment, the principle is the same, and it will not be repeated here.

[0051] Step 202: Calculate a first average value of multiple memory pressure values ​​at the target processing time.

[0052] In an embodiment of the present application, the memory module PSIMEMORY in the kernel space uploads pressure events to the daemon process in the user space in real time. The daemon process parses the pressure events to determine the memory pressure value, and based on the memory pressure value, determines the first number of processes that actually need to be pre-created in the operating system. Specifically, the obtained multiple memory pressure values ​​are stored in a set array, which can store a set number of memory pressure values. When a new pressure value arrives, the array is monitored to see if it is full. If it is full, the first-in-first-out principle is adopted to delete the memory pressure value with the longest storage time, and the memory pressure value in the array is shifted one position so that the most recently obtained memory pressure value can be stored in the array. Then, the multiple memory pressure values ​​at the target processing moment are averaged to obtain a first average value. As an implementation method, processing is performed according to a set cycle, and the target processing time corresponds to the time of the target cycle. For example, the cycle is 1 second, that is, the target quantity is updated once every one second. The initial time of the cycle is 0:00 seconds, then the time of the first cycle is 0:01 seconds, the time of the second cycle is 0:02 seconds, and the time of the third cycle is 0:03 seconds. If the target cycle is the fifth cycle, the target processing time is 0:05 seconds.

[0053] As an example, set the array as follows:

[0054] 0 1 2 …… n

[0055] N memory pressures can be stored in the setting array, namely array[0], array[1]...array[n]. When the n+1th memory pressure value is obtained, the first memory pressure value, that is, the memory pressure value array[0] marked as 0, is deleted, and the memory pressure values ​​stored in the array are shifted one place to the left, and the n+1th memory pressure value is stored in array[n] to update the memory pressure value in the array.

[0056] Step 203: Obtain a second average value calculated from a plurality of memory pressure values ​​at a processing moment before the target processing moment.

[0057] The method for determining the second average value is similar in principle to the method for determining the first average value, and will not be described in detail here.

[0058] Step 204: Determine a first number of processes that need to be created in the system according to the difference between the first average value and the second average value.

[0059] In one implementation of the embodiment of the present application, the first average value is subtracted from the second average value to obtain a difference. If the difference is greater than zero, it means that the first average value is greater than the second average value, that is, the average value of the memory pressure value at the target processing moment is greater than the average value of the memory pressure value at the previous processing moment, that is, the memory pressure value has an increasing trend. The increase in the memory pressure value indicates that the pressure on the system is increasing, and the number of pre-created processes needs to be reduced to reduce the pressure on the system. The number of processes to be reduced is determined based on the difference, wherein there is a corresponding relationship between the difference and the number of processes to be reduced. The number of processes to be reduced is determined based on the corresponding relationship, and then, the target number determined at the previous processing moment is reduced according to the reduced number. At the same time, the number of processes after reduction cannot be greater than the set minimum number of processes to determine the first number. For example, if the set minimum number of processes is 0, the first number is at least 0.

[0060] In another implementation of the embodiment of the present application, the first average value is subtracted from the second average value to obtain a difference. If the difference is less than zero, it means that the first average value is less than the second average value, that is, the average value of the memory pressure value at the target processing moment is less than the average value of the memory pressure value at the previous processing moment, that is, the memory pressure value is on a decreasing trend. The decrease in the memory pressure value indicates that the pressure on the system is reduced, and the number of pre-created processes can be increased. The number of processes to be increased is determined based on the difference, wherein there is a corresponding relationship between the difference and the number of processes to be increased. The number of processes to be increased is determined based on the corresponding relationship, and then, the target number determined at the previous processing moment is increased according to the increased number. At the same time, the number of processes after the increase cannot be greater than the set maximum number of processes to determine the first number. For example, if the set maximum number of processes is 10, the maximum first number is 10.

[0061] In another implementation of the embodiment of the present application, in response to the difference being equal to zero, indicating that the memory pressure of the system has not changed, the first quantity is determined based on the target quantity determined at the previous processing moment. As an implementation method, the target quantity at the previous processing moment is used as the first quantity.

[0062] Step 205: Obtain a relationship table, query the relationship table according to the number of application programs, and determine a second number of processes that need to be created in the system.

[0063] The relationship table includes the corresponding relationship between the number of application programs and the number of processes that need to be created.

[0064] Step 206: Determine a target quantity based on the first quantity and the second quantity.

[0065] Among them, steps 205 and 206 can refer to the explanations in the previous embodiment, and the principles are the same, so they will not be repeated here. It should be understood that determining the first quantity in step 205 can be performed before determining the first quantity in steps 202-204, or after, or simultaneously, and this is not limited in this embodiment.

[0066] In an embodiment of the present application, the target number USAP_create_stop is determined based on the first number determined by the memory pressure value and the second number determined by the user's use of the app, and then the processes that need to be created in advance in the system are created according to the target number, thereby improving the accuracy of process number creation.

[0067] Step 207: Adjust the number of processes created in the system according to the target number.

[0068] Among them, step 207 can refer to the explanation in the above embodiment, the principle is the same, and it will not be repeated here.

[0069] In the process processing method of the embodiment of the present application, the number of processes that should be maintained in the system is determined based on the memory pressure situation and the number of applications started in the user usage scenario, which can avoid creating unnecessary processes, thereby saving memory and CPU computing power resources and improving device performance.

[0070] Based on the above embodiments, Figure 3 A schematic diagram of a process processing method provided in an embodiment of the present application is shown in FIG. Figure 3 As shown:

[0071] After the operating system is started, the process named zygote in the operating system will pre-create a set number of processes based on the set minimum number of processes that can be pre-created, USAP_pool_size_min, and the maximum number of processes that can be pre-created, USAP_pool_size_max, by calling the fork() function of the system, and save them in the process pool USAP pool, where USAPPROCESS n is the identification information of the pre-created process. For example, USAP PROCESS1 refers to the first process. If the number of pre-created processes is USAP_pool_size_max, the creation will stop. If it is less than USAP_pool_size_max, the creation will continue until USAP_pool_size_max is reached. In this application, the memory module PSI MEMORY in the kernel space is controlled to upload pressure events to the daemon process in the user space in real time. The daemon process parses the pressure events to determine the memory pressure value, and decides the number of pre-created processes based on the memory pressure value according to the set period, that is, determines the first number of processes that actually need to be pre-created in the operating system, and sends the first number to the USAP process through the Socket communication mechanism.

[0072] In a core component of the application (Activity Manager Service, AMS), the number of launched apps is tracked to determine whether a maximum number of processes should be maintained in the USAP pool. For example, if the user has only used WeChat and the camera since powering on the device, maintaining a maximum of 2-3 processes in the USAP pool is sufficient; there's no need to keep too many USAP processes waiting in the pool. Therefore, the AMS determines the number of USAPs currently in the USAP pool based on the number of launched apps, records the second number, and sends this second number to the USAP process via the socket communication mechanism.

[0073] The USAP process determines a target number USAP_create_stop based on the first number and the second number, and then controls the number of processes pre-created in the operating system based on USAP_create_stop, that is, the number of processes to be created in the operating system is less than or equal to USAP_create_stop.

[0074] In order to implement the above embodiment, the embodiment of the present application also proposes a process processing device.

[0075] Figure 4 A schematic diagram of the structure of a process processing device provided in an embodiment of the present application.

[0076] like Figure 4 As shown, the device may include:

[0077] The acquisition module 41 is configured to acquire a memory pressure value and / or the number of started applications at a target processing moment.

[0078] The determination module 42 is configured to determine a target number of processes that need to be created in the system at the target processing moment according to the memory pressure value and / or the number of application programs.

[0079] The adjustment module 43 is configured to adjust the number of processes created in the system according to the target number.

[0080] Furthermore, in an implementation of the embodiment of the present application, there are multiple memory pressure values, and the determination module 42 is further configured to:

[0081] Calculating a first average value of a plurality of memory pressure values ​​at the target processing moment;

[0082] Obtaining a second average value calculated from a plurality of memory pressure values ​​at a processing moment preceding the target processing moment;

[0083] determining a first number of processes that need to be created in the system at the target processing time according to a difference between the first average value and the second average value;

[0084] The target quantity is determined according to the first quantity.

[0085] In one implementation of the embodiment of the present application, the determining module 42 is further configured to:

[0086] In response to the difference being greater than zero, determining a reduced number of processes based on the difference between the first average value and the second average value;

[0087] The first number is determined according to the reduction number, the target number determined at the previous processing moment, and the minimum number of processes that can be created by the system.

[0088] In one implementation of the embodiment of the present application, the determining module 42 is further configured to:

[0089] In response to the difference being less than zero, determining an increased number of processes based on a difference between the first average value and the second average value;

[0090] The first number is determined according to the increase number, the target number determined at the previous processing moment, and the maximum number of processes that can be created by the system.

[0091] In one implementation of the embodiment of the present application, the determining module 42 is further configured to:

[0092] In response to the difference being equal to zero, the first quantity is determined based on the target quantity determined at the previous processing moment.

[0093] In one implementation of the embodiment of the present application, the determining module 42 is further configured to:

[0094] Obtaining a relationship table; wherein the relationship table includes a correspondence between the number of application programs and the number of processes to be created;

[0095] querying the relationship table according to the number of the application programs to determine a second number of processes that need to be created in the system;

[0096] The target quantity is determined based on the second quantity.

[0097] In one implementation of the embodiment of the present application, the determining module 42 is further configured to:

[0098] The target quantity is determined according to the first quantity and the second quantity.

[0099] It should be noted that the above explanation of the method embodiment is also applicable to the device of this embodiment and will not be repeated here.

[0100] In the process processing device of the embodiment of the present application, the memory pressure value and / or the number of started applications corresponding to the system at the target processing moment are obtained, and the target number of processes that need to be created in the system at the target processing moment is determined based on the memory pressure value and / or the number of applications. According to the target number, the number of processes already created in the system is adjusted. Based on the system's memory pressure situation and the startup situation of the application, the target number of processes that need to be created in the system is dynamically determined to meet the system's process requirements in different situations and improve system performance.

[0101] In order to implement the above embodiments, the present application also proposes an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the method described in the above method embodiments is implemented.

[0102] In order to implement the above embodiments, the present application also proposes a non-transitory computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the method described in the above method embodiments is implemented.

[0103] In order to implement the above embodiments, the present application further proposes a computer program product on which a computer program is stored. When the computer program is executed by a processor, the method described in the above method embodiments is implemented.

[0104] Figure 5This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. For example, the electronic device 800 can be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0105] Reference Figure 5 , the electronic device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .

[0106] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operation, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to perform all or part of the steps of the above-described method. In addition, the processing component 802 may include one or more modules to facilitate interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.

[0107] The memory 804 is configured to store various types of data to support operations on the electronic device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.

[0108] The power component 806 provides power to the various components of the electronic device 800. The power component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 800.

[0109] The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor can not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the electronic device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each front camera and rear camera can be a fixed optical lens system or have a focal length and optical zoom capability.

[0110] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), which is configured to receive external audio signals when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal can be further stored in the memory 804 or transmitted via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.

[0111] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as a keyboard, click wheel, buttons, etc. These buttons may include but are not limited to: a home button, volume buttons, a start button, and a lock button.

[0112] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can detect the open / closed state of the electronic device 800, the relative positioning of components, such as the display and keypad of the electronic device 800. The sensor assembly 814 can also detect changes in the position of the electronic device 800 or a component of the electronic device 800, the presence or absence of user contact with the electronic device 800, the orientation or acceleration / deceleration of the electronic device 800, and temperature changes of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0113] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as WiFi, 4G or 5G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0114] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

[0115] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by the processor 820 of the electronic device 800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0116] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine different embodiments or examples described in this specification and features of different embodiments or examples without contradiction.

[0117] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of the technical features being referred to. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of such features. Throughout the description of this application, "plurality" means at least two, for example, two, three, etc., unless otherwise specifically defined.

[0118] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may be performed out of the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present application belong.

[0119] The logic and / or steps represented in the flowcharts or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing the logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (e.g., a computer-based system, a system including a processor, or other system that can fetch and execute instructions from an instruction execution system, apparatus, or device). For purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include the following: an electrical connection with one or more wires (electronic devices), a portable computer disk cartridge (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and programmable read-only memory (EPROM or flash memory), fiber optic devices, and a portable compact disc read-only memory (CDROM). Furthermore, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing it in another suitable manner if necessary, and then storing it in a computer memory.

[0120] It should be understood that various parts of the present application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used to implement: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application-specific integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0121] Those skilled in the art will understand that all or part of the steps in the method of the above embodiment can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable storage medium. When the program is executed, it includes one or a combination of the steps of the method embodiment.

[0122] In addition, the functional units in the various embodiments of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into a module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.

[0123] The storage medium mentioned above may be a read-only memory, a magnetic disk, or an optical disk, etc. Although the embodiments of the present application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present application. Persons skilled in the art may make changes, modifications, substitutions, and variations to the above embodiments within the scope of the present application.

Claims

1. A process processing method, characterized in that: include: Obtain the memory pressure value and / or the number of started applications at the target processing moment; Determining a target number of processes that need to be created in the system at the target processing time according to the memory pressure value and / or the number of applications; According to the target number, the number of processes created in the system is adjusted.

2. The method according to claim 1, wherein There are multiple memory pressure values, and determining a target number of processes to be created in the system at the target processing time according to the memory pressure values ​​includes: Calculating a first average value of a plurality of memory pressure values ​​at the target processing moment; Obtaining a second average value calculated from a plurality of memory pressure values ​​at a processing moment preceding the target processing moment; determining a first number of processes that need to be created in the system at the target processing time according to a difference between the first average value and the second average value; The target quantity is determined according to the first quantity.

3. The method according to claim 2, wherein Determining a first number of processes that need to be created in the system at the target processing time according to the difference between the first average value and the second average value includes: In response to the difference being greater than zero, determining a reduced number of processes based on the difference between the first average value and the second average value; The first number is determined according to the reduction number, the target number determined at the previous processing moment, and the minimum number of processes that can be created by the system.

4. The method according to claim 2, wherein Determining a first number of processes that need to be created in the system at the target processing time according to the difference between the first average value and the second average value includes: In response to the difference being less than zero, determining an increased number of processes based on a difference between the first average value and the second average value; The first number is determined according to the increase number, the target number determined at the previous processing moment, and the maximum number of processes that can be created by the system.

5. The method according to claim 2, wherein Determining a first number of processes that need to be created in the system at the target processing time according to the difference between the first average value and the second average value includes: In response to the difference being equal to zero, the first quantity is determined based on the target quantity determined at the previous processing moment.

6. The method according to claim 1, wherein Determining the target number of processes that need to be created in the system at the target processing time based on the number of application programs includes: Obtaining a relationship table; wherein the relationship table includes a correspondence between the number of application programs and the number of processes to be created; querying the relationship table according to the number of the application programs to determine a second number of processes that need to be created in the system; The target quantity is determined based on the second quantity.

7. The method according to claim 6, wherein Determining the target number of processes to be created in the system at the target processing time according to the memory pressure value and the number of application programs includes: The target quantity is determined according to the first quantity and the second quantity.

8. A process processing device, characterized in that: include: An acquisition module, used to obtain a memory pressure value and / or the number of started applications at a target processing moment; a determination module, configured to determine a target number of processes to be created in the system at the target processing time according to the memory pressure value and / or the number of applications; The adjustment module is used to adjust the number of processes created in the system according to the target number.

9. An electronic device, characterized in that: The method comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method according to any one of claims 1 to 7 is implemented.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.