Process speed limiting method and device, chip, equipment, medium and program product
By monitoring and limiting the access rate of the process to be speed-limited, the IO pressure problem caused by multiple processes accessing the hard disk is solved, the hard disk access speed is improved, and device lag is reduced.
Patent Information
- Application Number
- CN202510681156.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-26
- Publication Date
- 2025-09-16
AI Technical Summary
In the Android system, multiple processes accessing the hard disk at the same time causes excessive hard disk IO pressure, resulting in decreased read and write speeds and electronic device freezes.
By monitoring the status information of electronic devices, obtaining hard disk access information, determining the process to be speed-limited, and setting a rate threshold based on the PSI value and access information, the access rate of the process to be speed-limited is limited.
It reduces the IO pressure of the hard disk, improves the access speed of the hard disk, and reduces the probability of electronic equipment freezing.
Smart Images

Figure CN120653194A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the technical field of electronic devices, and in particular to a method, apparatus, chip, device, medium, and program product for limiting the speed of a process. Background Art
[0002] When the Android system is running, there are situations where multiple processes need to access the hard disk of the electronic device. When multiple processes need to access the hard disk, the hard disk is under high input / output (IO) pressure.
[0003] In the related art, when a hard disk is under high IO pressure, its read and write speed will drop. However, multiple processes still access the hard disk intensively, causing the electronic device to freeze. Summary of the Invention
[0004] The embodiments of the present application provide a process speed limiting method, apparatus, chip, device, medium, and program product, which reduce the access rate of some processes, thereby reducing the IO pressure of the hard disk, thereby increasing the access speed of the hard disk and reducing the probability of electronic device freezing.
[0005] In a first aspect, embodiments of the present application provide a method for limiting the speed of a process, which is applied to an electronic device, or a chip or chip module in the electronic device, and the method includes:
[0006] When it is detected that the status information of the electronic device meets the speed limit condition, access information of the hard disk is obtained; the status information includes a pressure blocking information PSI value; the electronic device includes a hard disk;
[0007] Determining at least one process to be rate-limited among the plurality of processes;
[0008] Determine the rate threshold of the process to be speed-limited based on the PSI value and hard disk access information;
[0009] The access rate of the process to be rate-limited is limited according to the rate threshold of the process to be rate-limited.
[0010] In one possible implementation, determining at least one process to be rate-limited among the multiple processes includes:
[0011] For any process, obtain the process ID and the amount of data accessed by the process on the hard disk;
[0012] Sort multiple processes in descending order of the amount of data accessing the hard disk, and obtain the sorting sequence number of each process;
[0013] The processes with sorting numbers less than or equal to N are determined as the processes to be selected; N is a positive integer greater than 1;
[0014] Determine whether the process to be selected meets the elimination condition according to the process ID of the process to be selected;
[0015] Determine that the process to be selected is a process to be rate-limited based on the process to be selected not meeting the elimination condition; or
[0016] Based on the fact that the process to be selected meets the elimination condition, it is determined that the process to be selected is not a process to be speed-limited.
[0017] In a possible implementation, determining whether the process to be selected meets the elimination condition according to the process identifier of the process to be selected includes:
[0018] Determining whether the process ID of the process to be selected satisfies at least one of a plurality of conditions;
[0019] Based on the process identifier of the process to be selected, at least one of the multiple conditions is satisfied, determining that the process to be selected meets the elimination condition; or
[0020] Based on the process identifier of the process to be selected, each of the multiple conditions is not satisfied, determining that the process to be selected does not meet the elimination condition;
[0021] Several conditions include:
[0022] The process ID of the process to be selected belongs to the list of processes that cannot be speed-limited;
[0023] The process ID of the process to be selected indicates that the process to be selected is a foreground process, and the process ID of the process to be selected does not belong to the list of processes that can be rate-limited;
[0024] The process identifier of the process to be selected indicates that the process to be selected is a system process.
[0025] In a possible implementation, the status information includes a pressure blockage information PSI value, whether a low-speed warning message corresponding to the hard disk is received, and a display status of the electronic device; the display status is a screen-on state or a screen-off state;
[0026] When the status information of the electronic device is detected to meet the speed limit condition, hard disk access information is obtained, including:
[0027] When the PSI value is detected to be greater than the PSI threshold and the display state is bright, obtain the hard disk access information; or,
[0028] When the low-speed warning information corresponding to the hard disk is received and the display state is the bright screen state, the access information of the hard disk is obtained.
[0029] In one possible implementation, the hard disk access information includes the hard disk access rate, the number of read storage blocks, and the number of write storage blocks. Determining the rate threshold of the process to be speed-limited based on the PSI value and the hard disk access information includes:
[0030] Determine a speed limit coefficient corresponding to the process to be speed limited according to the PSI value, the number of read storage blocks, and the number of write storage blocks; the speed limit coefficient is the first speed limit coefficient, the second speed limit coefficient, or the third speed limit coefficient; the first speed limit coefficient is greater than the second speed limit coefficient, and the second speed limit coefficient is greater than the third speed limit coefficient;
[0031] Determine the rate threshold of the process to be speed-limited based on the speed limit coefficient and the hard disk access rate.
[0032] In one possible implementation, the PSI value includes a first PSI value and a second PSI value; the first PSI value indicates a proportion of time that at least one of the multiple processes is blocked, and the second PSI value indicates a proportion of time that each of the multiple processes is blocked; determining a speed limit coefficient corresponding to the process to be speed limited based on the PSI value, the number of read storage blocks, and the number of write storage blocks includes:
[0033] determining whether the first PSI value falls within a first preset range and the second PSI value falls within a second preset range;
[0034] Based on the first PSI value being within a first preset range and the second PSI value being within a second preset range, determining a speed limit coefficient corresponding to the process to be speed limited according to the PSI value; or
[0035] Based on the fact that the first PSI value does not belong to the first preset range and / or the second PSI value does not belong to the second preset range, the ratio of the number of read storage blocks to the number of write storage blocks is determined, and based on the number ratio and the number of read storage blocks, the speed limit coefficient corresponding to the process to be speed limited is determined.
[0036] In a second aspect, an embodiment of the present application provides a process rate limiting device, including:
[0037] The monitoring module is used to obtain hard disk access information when it is detected that the status information of the electronic device meets the speed limit condition; the status information includes pressure blocking information PSI value; the electronic device includes a hard disk;
[0038] A screening module, configured to determine at least one process to be rate-limited among a plurality of processes;
[0039] A processing module, configured to determine a rate threshold of a process to be speed-limited based on a PSI value and hard disk access information;
[0040] The control module is used to limit the access rate of the process to be speed-limited according to the rate threshold of the process to be speed-limited.
[0041] In one possible implementation, the screening module is specifically configured to:
[0042] For any process, obtain the process ID and the amount of data accessed by the process on the hard disk;
[0043] Sort multiple processes in descending order of the amount of data accessing the hard disk, and obtain the sorting sequence number of each process;
[0044] The processes with sorting numbers less than or equal to N are determined as the processes to be selected; N is a positive integer greater than 1;
[0045] Determine whether the process to be selected meets the elimination condition according to the process ID of the process to be selected;
[0046] Determine that the process to be selected is a process to be rate-limited based on the process to be selected not meeting the elimination condition; or
[0047] Based on the fact that the process to be selected meets the elimination condition, it is determined that the process to be selected is not a process to be speed-limited.
[0048] In one possible implementation, the screening module is specifically configured to:
[0049] Determining whether the process ID of the process to be selected satisfies at least one of a plurality of conditions;
[0050] Based on the process identifier of the process to be selected, at least one of the multiple conditions is satisfied, determining that the process to be selected meets the elimination condition; or
[0051] Based on the process identifier of the process to be selected, each of the multiple conditions is not satisfied, determining that the process to be selected does not meet the elimination condition;
[0052] Several conditions include:
[0053] The process ID of the process to be selected belongs to the list of processes that cannot be speed-limited;
[0054] The process ID of the process to be selected indicates that the process to be selected is a foreground process, and the process ID of the process to be selected does not belong to the list of processes that can be rate-limited;
[0055] The process identifier of the process to be selected indicates that the process to be selected is a system process.
[0056] In a possible implementation, the status information includes a pressure blockage information PSI value, whether a low-speed warning message corresponding to the hard disk is received, and a display status of the electronic device; the display status is a screen-on state or a screen-off state;
[0057] Monitoring module, specifically used for:
[0058] When the PSI value is detected to be greater than the PSI threshold and the display state is bright, obtain the hard disk access information; or,
[0059] When the low-speed warning information corresponding to the hard disk is received and the display state is the bright screen state, the access information of the hard disk is obtained.
[0060] In a possible implementation, the hard disk access information includes the hard disk access rate, the number of read storage blocks, and the number of write storage blocks; the processing module is specifically configured to:
[0061] Determine a speed limit coefficient corresponding to the process to be speed limited according to the PSI value, the number of read storage blocks, and the number of write storage blocks; the speed limit coefficient is the first speed limit coefficient, the second speed limit coefficient, or the third speed limit coefficient; the first speed limit coefficient is greater than the second speed limit coefficient, and the second speed limit coefficient is greater than the third speed limit coefficient;
[0062] Determine the rate threshold of the process to be speed-limited based on the speed limit coefficient and the hard disk access rate.
[0063] In one possible implementation, the PSI value includes a first PSI value and a second PSI value; the first PSI value indicates a proportion of time that at least one of the multiple processes is blocked, and the second PSI value indicates a proportion of time that each of the multiple processes is blocked; the processing module is specifically configured to:
[0064] determining whether the first PSI value falls within a first preset range and the second PSI value falls within a second preset range;
[0065] Based on the first PSI value being within a first preset range and the second PSI value being within a second preset range, determining a speed limit coefficient corresponding to the process to be speed limited according to the PSI value; or
[0066] Based on the fact that the first PSI value does not belong to the first preset range and / or the second PSI value does not belong to the second preset range, the ratio of the number of read storage blocks to the number of write storage blocks is determined, and based on the number ratio and the number of read storage blocks, the speed limit coefficient corresponding to the process to be speed limited is determined.
[0067] In a third aspect, the present application provides a chip, the chip comprising at least one processor, the processor being configured to execute program instructions to perform any one of the methods of the first aspect.
[0068] In a fourth aspect, the present application provides a chip module having a computer program stored thereon. When the computer program is executed by the chip module, the method according to any one of the first aspects is implemented.
[0069] In a fifth aspect, an embodiment of the present application provides an electronic device, including: a memory and a processor;
[0070] Memory stores computer-executable instructions;
[0071] The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to the first aspect.
[0072] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored, and when the computer-executable instructions are executed by a processor, they are used to implement the method of the first aspect.
[0073] In a seventh aspect, an embodiment of the present application provides a computer program product, comprising computer execution instructions, which, when executed by a processor, enable the method of the first aspect to be executed.
[0074] The embodiments of the present application provide a process speed limiting method, apparatus, chip, device, medium and program product. In this method, the electronic device can obtain the access information of the hard disk when it is detected that the status information of the electronic device meets the rejection conditions; the status information includes the pressure blocking information PSI value. The electronic device determines at least one process to be speed limited among multiple processes. The electronic device can determine the rate threshold of the process to be speed limited based on the PSI value and the access information of the hard disk. The electronic device can limit the access rate of the process to be speed limited based on the rate threshold of the process to be speed limited. In the above manner, when the status information of the electronic device meets the speed limit conditions, the access rate of some processes can be reduced, thereby reducing the IO pressure of the hard disk, thereby increasing the access speed of the hard disk, and reducing the probability of the electronic device being stuck. BRIEF DESCRIPTION OF THE DRAWINGS
[0075] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0076] Figure 1 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0077] Figure 2a A flowchart of a first embodiment of a method for limiting the speed of a process provided in an embodiment of the present application;
[0078] Figure 2b A schematic diagram of a scenario for obtaining information provided in an embodiment of the present application;
[0079] Figure 2c A schematic diagram of another scenario for obtaining information provided in an embodiment of the present application;
[0080] Figure 3 A flowchart of a second embodiment of a method for limiting the speed of a process provided in an embodiment of the present application;
[0081] Figure 4 A flowchart of a third embodiment of a method for limiting the speed of a process provided in an embodiment of the present application;
[0082] Figure 5 A schematic structural diagram of a process speed limiting device provided by an exemplary embodiment of the present application;
[0083] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0084] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0085] The terms "first," "second," "third," "fourth," and so on (if any) in the specification and claims of this application and the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or sequential sequence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of the application described herein can be implemented in orders other than those illustrated or described herein.
[0086] In addition, the terms "comprises" and "having" and any variations thereof are intended to cover a non-exclusive inclusion. For example, a process, method, system, product or apparatus that includes a series of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, product or apparatus.
[0087] In the present application, "at least one" refers to one or more, and "a plurality of" refers to two or more.
[0088] In addition, the term "equal to" in this application can be used in conjunction with "greater than" or "less than." When "equal to" and "greater than" are used together, the technical solution of "greater than" is adopted; when "equal to" and "less than" are used together, the technical solution of "less than" is adopted.
[0089] Application Not Responding (ANR): In the Android system, an error state is triggered when an application fails to respond to user input or perform operations on the application's User Interface (UI) thread (main thread) within a period of time.
[0090] Pressure Stall Information (PSI): provides a method for assessing operating system resource pressure. An operating system has three basic resources: the central processing unit (CPU), memory, and input / output (IO).
[0091] Iolimit: A method of limiting a process based on the amount of data it accesses on the hard disk.
[0092] blk-throttle: A policy that implements I / O throttling through the blkio controller in a control group. It helps optimize system resource allocation, ensuring that critical processes receive sufficient resources while preventing non-critical tasks from consuming too many resources.
[0093] Figure 1 For a schematic diagram of the structure of an electronic device provided in an embodiment of the present application, see Figure 1 , the electronic device 10 includes a processor 101 , a memory 102 and a hard disk 103 .
[0094] The processor 101 may be electrically connected to the memory 102 and the hard disk 103 respectively.
[0095] The processor 101 may be a central processing unit or other components with processing capabilities.
[0096] The memory 102 is also called internal memory and is used to store the calculation data of the processor 101 .
[0097] The hard disk 103 is the main storage device of the electronic device 10. It can be a solid-state hard disk, a mechanical hard disk, or other types of hard disks. The embodiments of the present application are not limited to this.
[0098] It should also be noted that the electronic device 10 can be a smart watch, a mobile phone, a desktop computer, a laptop computer, a tablet computer, etc., and the embodiments of the present application are not limited to this.
[0099] The following is based on Figure 1 The electronic device shown illustrates the process of a process accessing a hard disk.
[0100] The electronic device 10 (the processor 101 of the electronic device 10 ) can run the Android system. During the running of the Android system, there are situations where multiple processes all need to access the hard disk 103 in the electronic device 10 .
[0101] When multiple processes need to access the hard disk 103 , the hard disk 103 is under high input / output (IO) pressure.
[0102] In the related art, the hard disk 103 may experience a decrease in read and write speed under high IO pressure, but multiple processes still access the hard disk 103 intensively, causing the electronic device 10 to freeze.
[0103] Based on the above technical problems, an embodiment of the present application provides a method for limiting the speed of a process. When an electronic device detects that the status information of the electronic device meets the speed limit conditions, the electronic device can obtain access information of the hard disk; the status information includes a pressure blocking information (PSI) value. The electronic device determines at least one process to be speed-limited among multiple processes. The electronic device can determine a rate threshold of the process to be speed-limited based on the PSI value and the access information of the hard disk. The electronic device can limit the access rate of the process to be speed-limited based on the rate threshold of the process to be speed-limited.
[0104] Through the above method, the access rate of some processes can be reduced, thereby reducing the IO pressure of the hard disk, thereby increasing the access speed of the hard disk and reducing the probability of electronic equipment freezing.
[0105] The technical solutions shown in this application are described in detail below through specific embodiments. It should be noted that the following embodiments can exist independently or in combination with each other, and the same or similar contents will not be repeated in different embodiments.
[0106] Figure 2a This is a flow chart of Example 1 of a process rate limiting method provided in this application. Figure 2a , the method may include:
[0107] S201: When it is detected that the status information of the electronic device meets the speed limit condition, access information of the hard disk is obtained.
[0108] In this embodiment, the electronic device may obtain access information of the hard disk (also referred to as storage particle) when detecting that the status information of the electronic device meets the speed limit condition.
[0109] It should be noted that, in one implementation, the hard disk includes multiple storage blocks. The hard disk access information includes the hard disk access rate, the number of read storage blocks, and the number of write storage blocks.
[0110] In addition, it should be noted that the status information includes a pressure stall information (PSI) value.
[0111] In one implementation:
[0112] Based on the fact that the status information includes a PSI value, the electronic device can obtain the access information of the hard disk when it detects that the PSI value is greater than the PSI threshold. In one implementation, the electronic device can obtain the PSI value once every preset collection time interval. The electronic device can obtain the access information of the hard disk when it determines that the PSI value is greater than the PSI threshold. For example, the preset collection time interval can be 10 seconds. In one implementation, the PSI value includes a first PSI value and a second PSI value, the first PSI value indicates the proportion of time that at least one process among multiple processes is blocked, and the second PSI value indicates the proportion of time that each process among multiple processes is blocked. The electronic device can obtain the access information of the hard disk when it detects that the first PSI value is greater than the first PSI threshold, and / or the second PSI value is greater than the second PSI threshold.
[0113] In one implementation:
[0114] Status information includes the pressure blockage information (PSI) value and whether the hard drive's corresponding low-speed warning message has been received. It should be noted that the hard drive can monitor the hard drive access rate. The hard drive can generate a low-speed warning message if the access rate detected is less than a preset rate.
[0115] The electronic device can obtain the access information of the hard disk when detecting that the PSI value is greater than the PSI threshold.
[0116] In addition, the electronic device can also obtain the access information of the hard disk when receiving the low-speed warning information corresponding to the hard disk.
[0117] In one implementation:
[0118] The status information includes the pressure blockage information PSI value, whether the low speed warning information corresponding to the hard disk is received, and the display status of the electronic device. The display status is the screen-on state or the screen-off state (also called the screen-off state).
[0119] The electronic device can obtain the access information of the hard disk when it detects that the PSI value is greater than the PSI threshold and the display state is the bright screen state.
[0120] In addition, the electronic device can also obtain the access information of the hard disk when receiving the low-speed warning information corresponding to the hard disk and the display state is the bright screen state.
[0121] S202: Determine at least one process to be speed-limited among multiple processes.
[0122] In this embodiment, the electronic device may determine at least one process to be speed-limited among multiple processes.
[0123] In one implementation:
[0124] The electronic device may determine any M processes among the multiple processes as processes to be rate-limited, where M is a positive integer.
[0125] In one implementation:
[0126] For any process, the electronic device can obtain the amount of data accessed from the hard disk by the process.
[0127] The electronic device can sort the multiple processes in descending order of the amount of data accessed to the hard disk, and obtain a sorting sequence number for each process.
[0128] The electronic device may determine a process with a sequence number less than or equal to M as a process to be rate-limited, where N is a positive integer.
[0129] In one implementation:
[0130] For any process, the electronic device can obtain the process identifier (such as UID) of the process.
[0131] The electronic device may determine whether the process identifier of the process satisfies at least one of a plurality of conditions;
[0132] Based on the process identifier of the process, at least one of the multiple conditions is satisfied, determining that the process is not a process to be rate-limited; or
[0133] Based on the process ID of the process, if each of the multiple conditions is not satisfied, the process is determined to be a process to be rate-limited.
[0134] Among them, multiple conditions include:
[0135] The process ID of the process belongs to the list of processes that cannot be speed-limited;
[0136] The process ID of the process indicates that the process is a foreground process, and the process ID of the process does not belong to the list of processes that can be rate-limited;
[0137] The process ID of the process indicates that the process is a system process.
[0138] In one implementation:
[0139] For any process, the electronic device can obtain the process identifier of the process and the amount of data accessed by the process on the hard disk.
[0140] The electronic device can sort the multiple processes in descending order of the amount of data accessed to the hard disk, and obtain a sorting sequence number for each process.
[0141] The electronic device may determine a process with a sorting number less than or equal to N as a process to be selected, where N is a positive integer greater than 1. For example, N is 5, and for another example, N is 10.
[0142] The electronic device may determine whether the process to be selected meets the elimination condition based on the process identifier (such as UID) of the process to be selected;
[0143] The electronic device may determine that the process to be selected is a process to be speed-limited based on the fact that the process to be selected does not meet the elimination condition.
[0144] The electronic device may determine that the process to be selected is not a process to be speed-limited based on the process to be selected meeting the elimination condition.
[0145] The following describes a process in which the electronic device determines whether a process to be selected meets an elimination condition based on the process identifier of the process to be selected.
[0146] In one implementation:
[0147] The electronic device may determine whether the process identifier of the process to be selected satisfies at least one of a plurality of conditions.
[0148] The electronic device may determine that the process to be selected meets the elimination condition based on the process identifier of the process to be selected and the satisfaction of at least one condition among multiple conditions.
[0149] The electronic device may determine that the process to be selected does not meet the elimination condition based on the process identifier of the process to be selected not meeting each of the multiple conditions.
[0150] Among them, multiple conditions include:
[0151] The process ID of the process to be selected belongs to the list of processes that cannot be rate-limited.
[0152] The process ID of the process to be selected indicates that the process to be selected is a foreground process, and the process ID of the process to be selected does not belong to the list of speed-limitable processes.
[0153] The process identifier of the process to be selected indicates that the process to be selected is a system process. In one implementation, the electronic device can determine that the process identifier of the process to be selected indicates that the process to be selected is a system process when the process identifier (such as UID) of the process to be selected falls within a preset system process identifier range.
[0154] In addition, from the perspective of the framework module, the following describes how the electronic device can obtain the amount of data accessed by each process on the hard disk, as well as the process by which the electronic device obtains access information on the hard disk.
[0155] Figure 2b A schematic diagram of a scenario for obtaining information provided in an embodiment of the present application.
[0156] like Figure 2b As shown, the framework module runs in user space.
[0157] Access information statistics nodes (files) belong to kernel space, and the / proc / io_monitor interface (file) also belongs to kernel space.
[0158] Among them, the access information statistics node records the access information of the hard disk.
[0159] The electronic device can run the framework module to access the access information statistics node and obtain the hard disk access information. It can be understood that the electronic device can run the framework module to access the access information statistics node according to the storage path of the access information statistics node and obtain the hard disk access information. It should be noted that the hard disk access information recorded in the access information statistics node is obtained by the electronic device by calling the hard disk driver (running in the kernel space) ( Figure 2b The interface is obtained (not shown).
[0160] The electronic device can run the framework module to access the / proc / io_monitor interface (file) and obtain the amount of data accessed by each process on the hard disk.
[0161] In one implementation:
[0162] Figure 2c A schematic diagram of another scenario for obtaining information provided in an embodiment of the present application.
[0163] like Figure 2c As shown in Figure 1, the framework module runs in user space. The access information statistics node (file) belongs to kernel space, and the data volume monitoring node (file) also belongs to kernel space.
[0164] Among them, the access information statistics node records the access information of the hard disk.
[0165] The kernel can collect and obtain the amount of data accessed by each process to the hard disk, and record the amount of data accessed by each process to the data volume monitoring node (file).
[0166] The electronic device can run the framework module to perform access processing on the access information statistics node and obtain the access information of the hard disk.
[0167] The electronic device can run the framework module to perform access processing on the data volume monitoring node (file) and obtain the data volume accessed by each process on the hard disk.
[0168] S203: Determine a rate threshold of the process to be speed-limited according to the PSI value and the hard disk access information.
[0169] In this embodiment, the electronic device may determine a rate threshold of the process to be speed-limited according to the PSI value and hard disk access information.
[0170] In one implementation:
[0171] The electronic device may determine a speed limit coefficient corresponding to the process to be speed limited according to the PSI value, the number of read storage blocks, and the number of write storage blocks.
[0172] The speed limit coefficient is a first speed limit coefficient, a second speed limit coefficient, or a third speed limit coefficient. It should be noted that the first speed limit coefficient is greater than the second speed limit coefficient, and the second speed limit coefficient is greater than the third speed limit coefficient. For example, the first speed limit coefficient may be 60%, the second speed limit coefficient may be 40%, and the third speed limit coefficient may be 20%.
[0173] The electronic device may determine a rate threshold of the process to be speed-limited according to the speed-limit coefficient and the access rate of the hard disk.
[0174] S204: Limiting the access rate of the process to be speed-limited according to the rate threshold of the process to be speed-limited.
[0175] In this embodiment, the electronic device may limit the access rate of the process to be speed-limited according to the rate threshold of the process to be speed-limited.
[0176] In other words, the electronic device runs the process to be speed-limited, and the access rate of the hard disk is less than or equal to the rate threshold of the process to be speed-limited.
[0177] It should also be noted that when the electronic device runs the process to be speed-limited and writes to the hard disk, the electronic device runs the process to be speed-limited and writes the data to be written to at least one free memory page (page cache) of the memory. When the data in the memory reaches a preset data volume threshold, the data in the memory can be dumped to the hard disk.
[0178] Based on the above content, it can be seen that the electronic device limits the access rate of the process to be speed-limited according to the rate threshold of the process to be speed-limited, and can instruct the electronic device to run the process to be speed-limited and write to the memory at a rate less than or equal to the access rate of the process to be speed-limited.
[0179] It should also be noted that when the electronic device runs the process to be speed-limited and reads the hard disk, the data to be read from the hard disk can be copied from the hard disk to at least one free memory page in the memory. When the electronic device runs the process to be speed-limited, the data to be read from the memory can be read.
[0180] Based on the above content, it can be seen that the electronic device limits the access rate of the process to be speed-limited according to the rate threshold of the process to be speed-limited, and can instruct the electronic device to run the process to be speed-limited and read the memory at a reading rate less than or equal to the access rate of the process to be speed-limited.
[0181] Additionally, in one implementation:
[0182] When an electronic device triggers limiting the access rate of a process based on detecting that the PSI value is greater than the PSI threshold and the display state is in the bright screen state, the electronic device may stop limiting the access rate of the process to be speed-limited when detecting that the PSI value is less than or equal to the PSI threshold.
[0183] In one implementation:
[0184] When the electronic device triggers limiting the access rate of a process based on receiving a low-speed warning message corresponding to the hard disk and the display state is in a bright screen state, the electronic device may start timing and obtain a timing duration when limiting the access rate of the process to be limited based on the rate threshold of the process to be limited. The electronic device may stop limiting the access rate of the process to be limited if the timing duration reaches a preset duration, no new low-speed warning message corresponding to the hard disk is received, and the PSI value is less than or equal to the PSI threshold.
[0185] Beneficial effects of this embodiment: In this embodiment, the electronic device can obtain the access information of the hard disk when it is detected that the status information of the electronic device meets the speed limit conditions. The status information includes the PSI value. The electronic device can determine at least one process to be speed limited among multiple processes. The electronic device can determine the rate threshold of the process to be speed limited based on the PSI value and the access information of the hard disk, and limit the access rate of the process to be speed limited based on the rate threshold of the process to be speed limited. In the above manner, the access rate of some processes is reduced, the IO pressure of the hard disk is reduced, and the access speed of the hard disk is increased, thereby reducing the probability of the electronic device being stuck.
[0186] The following describes in detail a second method embodiment of a process in which an electronic device determines at least one process to be speed-limited among multiple processes based on process information when the process information includes a process identifier and the amount of data accessed by the process on a hard disk.
[0187] Figure 3 This is a flow chart of Example 2 of a process rate limiting method provided in this application. Figure 3 , the method may include:
[0188] S301: For any process, obtain the process ID of the process and the amount of data accessed by the process on the hard disk.
[0189] In this embodiment, for any process, the electronic device can obtain the process identifier of the process and the amount of data accessed by the process on the hard disk.
[0190] S302: Sort the multiple processes in descending order of the amount of data accessed to the hard disk to obtain a sorting sequence number for each process.
[0191] In this embodiment, the electronic device may sort the multiple processes in descending order of the amount of data accessed to the hard disk to obtain a sorting sequence number for each process.
[0192] S303: Determine the processes with sorting numbers less than or equal to N as the processes to be selected.
[0193] In this embodiment, the electronic device may determine the processes whose sorting numbers are less than or equal to N as the processes to be selected.
[0194] Wherein, N is a positive integer greater than 1.
[0195] S304: Determine whether the process to be selected meets the elimination condition according to the process ID of the process to be selected.
[0196] In this embodiment, the electronic device may determine whether the process to be selected meets the elimination condition according to the process identifier of the process to be selected.
[0197] If not, execute S305;
[0198] If so, execute S306.
[0199] The following describes a process in which the electronic device determines whether a process to be selected meets an elimination condition based on the process identifier of the process to be selected.
[0200] In one implementation:
[0201] The electronic device may obtain a process identifier of the process to be selected, wherein the process identifier may be a UID of the process.
[0202] The electronic device may determine whether the process identifier of the process to be selected satisfies at least one of a plurality of conditions.
[0203] The electronic device may determine that the process to be selected meets the elimination condition based on the process identifier of the process to be selected and the satisfaction of at least one condition among multiple conditions.
[0204] The electronic device may determine that the process to be selected does not meet the elimination condition based on the process identifier of the process to be selected not meeting each of the multiple conditions.
[0205] It should be noted that the multiple conditions include:
[0206] The process ID of the process to be selected belongs to the list of processes that cannot be speed-limited (also known as the whitelist);
[0207] The process ID of the process to be selected indicates that the process to be selected is a foreground process, and the process ID of the process to be selected does not belong to a list of processes that can be speed-limited (also referred to as a blacklist);
[0208] The process identifier of the process to be selected indicates that the process to be selected is a system process.
[0209] In one implementation:
[0210] The electronic device may determine, based on the process identifier of the process to be selected, whether the process to be selected indicates that the process to be selected is a foreground process or a system process.
[0211] The electronic device may indicate, based on the process identifier of the process to be selected, that the process to be selected is a foreground process or a system process, and determine that the process to be selected meets the elimination condition.
[0212] The electronic device may determine that the process to be selected does not meet the elimination condition based on the process identifier of the process to be selected, indicating that the process to be selected is not a foreground process and is not a system process.
[0213] In one implementation:
[0214] The electronic device may determine whether the process identifier of the to-be-selected process belongs to a list of processes that cannot be speed-limited.
[0215] The electronic device may determine that the process to be selected meets the elimination condition based on the process identifier of the process to be selected belonging to the list of processes that cannot be speed-limited.
[0216] The electronic device may determine that the process to be selected does not meet the elimination condition based on the process identifier of the process to be selected not belonging to the list of processes that cannot be speed-limited.
[0217] Through the above method, the access speed of the process to be speed-limited can be reduced, thereby increasing the probability of system processes and foreground processes competing for IO resources to access the hard disk, thereby reducing the probability of electronic equipment freezing.
[0218] S305: Based on the fact that the process to be selected does not meet the elimination condition, determine that the process to be selected is a process to be speed-limited.
[0219] In this embodiment, the electronic device may determine that the process to be selected is a process to be speed-limited based on the fact that the process to be selected does not meet the elimination condition.
[0220] S306: Based on the process to be selected satisfying the elimination condition, it is determined that the process to be selected is not a process to be speed-limited.
[0221] In this embodiment, the electronic device may determine that the process to be selected is not a process to be speed-limited based on whether the process to be selected meets the elimination condition.
[0222] Beneficial effects of this embodiment: In this embodiment, the electronic device can filter out a process to be selected from multiple processes based on the amount of data accessed by the process to the hard disk. The electronic device can determine whether the process to be selected meets the elimination conditions based on the process identifier of the process to be selected. The electronic device can determine that the process to be selected is a process to be speed-limited based on the fact that the process to be selected does not meet the elimination conditions. The electronic device can determine that the process to be selected is not a process to be speed-limited based on the fact that the process to be selected meets the elimination conditions. In the embodiment of the present application, based on the Iolimit mechanism and the blk-throttle mechanism, the process that needs to be speed-limited can be quickly determined from multiple processes, reducing the access rate of the process with a relatively large amount of data accessing the hard disk. On the one hand, it increases the probability of key processes (processes that do not meet the elimination conditions) obtaining IO resources, that is, it increases the probability of key processes accessing the hard disk. On the other hand, it reduces the IO pressure of the hard disk, thereby increasing the access speed of the hard disk. In other words, through the method of the embodiment of the present application, the probability of electronic equipment freezing is reduced, and the user experience is improved.
[0223] The following describes a process in which an electronic device determines a rate threshold of a process to be speed-limited based on a PSI value and hard disk access information through a third method embodiment.
[0224] Figure 4 This is a flow chart of Example 3 of a process rate limiting method provided in this application. Figure 4 , the method may include:
[0225] S401: Determine a speed limit coefficient corresponding to the process to be speed limited according to the PSI value, the number of read storage blocks, and the number of write storage blocks.
[0226] In this embodiment, the status information of the electronic device includes a pressure stall information (PSI) value.
[0227] The hard disk access information includes the hard disk access rate, the number of read storage blocks, and the number of write storage blocks.
[0228] The electronic device may determine a speed limit coefficient corresponding to the process to be speed limited according to the PSI value, the number of read storage blocks, and the number of write storage blocks.
[0229] It should be noted that the speed limit coefficient is the first speed limit coefficient (Low), the second speed limit coefficient (High) or the third speed limit coefficient (Critical).
[0230] It should also be noted that the first speed limit coefficient is greater than the second speed limit coefficient, and the second speed limit coefficient is greater than the third speed limit coefficient.
[0231] For example, the first speed limit coefficient may be 60%, the second speed limit coefficient may be 40%, and the first speed limit coefficient may be 20%.
[0232] The following describes a process in which the electronic device determines a speed limit coefficient corresponding to a process to be speed limited based on a PSI value, the number of read storage blocks, and the number of write storage blocks.
[0233] The PSI value includes a first PSI value and a second PSI value.
[0234] The first PSI value indicates a proportion of a duration in which at least one of the multiple processes is blocked.
[0235] In one implementation, the first PSI value indicates a proportion of time that at least one of the multiple processes is blocked within a first preset duration. For example, the first preset duration may be 60 seconds.
[0236] The second PSI value indicates a proportion of time that each of the plurality of processes is blocked.
[0237] In one implementation, the first PSI value indicates a proportion of a time period during which each of the multiple processes is blocked within a first preset time period.
[0238] The electronic device may determine whether the first PSI value belongs to a first preset range and the second PSI value belongs to a second preset range. For example, the first preset range may be (8%, 100%) and the second preset range may be (6%, 100%).
[0239] The electronic device may determine a speed limit coefficient corresponding to the process to be speed limited according to the PSI values based on the fact that the first PSI value belongs to the first preset range and the second PSI value belongs to the second preset range.
[0240] The electronic device may determine a ratio between the number of read storage blocks and the number of write storage blocks based on the first PSI value not belonging to the first preset range and / or the second PSI value not belonging to the second preset range.
[0241] The electronic device can determine the speed limit coefficient corresponding to the process to be speed limited based on the number ratio and the number of read storage blocks. In one implementation, the electronic device can determine that the speed limit coefficient corresponding to the process to be speed limited is the third speed limit coefficient when the number ratio is greater than the first number ratio and the number of read storage blocks is greater than the first number. The electronic device can determine that the speed limit coefficient corresponding to the process to be speed limited is the second speed limit coefficient when the number ratio is greater than the second number ratio and less than or equal to the first number ratio, and the number of read storage blocks is greater than the first number. It should be noted that the second number ratio is less than the first number ratio. For example, the first number ratio is 4:1 and the second number ratio is 2:1.
[0242] The following describes a process in which the electronic device determines the speed limit coefficient corresponding to the process to be speed limited based on the PSI value.
[0243] In one implementation:
[0244] The first preset range includes a first preset range 1, a first preset range 2, and a first preset range 3. The first preset range 1 is a range greater than the first value and less than the second value; the first preset range 2 is a range greater than the second value and less than the third value; and the first preset range 3 is a range greater than the third value and less than the fourth value.
[0245] For example, the first value is 8%, the second value is 15%, the third value is 30%, and the fourth value is 100%.
[0246] The second preset range includes a second preset range 1, a second preset range 2, and a second preset range 3. The second preset range 1 is a range greater than the fifth value and less than the sixth value; the second preset range 2 is a range greater than the sixth value and less than the seventh value; and the second preset range 3 is a range greater than the seventh value and less than the eighth value.
[0247] For example, the fifth value is 6%, the sixth value is 12%, the seventh value is 25%, and the eighth value is 100%.
[0248] The electronic device may determine that the speed limit coefficient corresponding to the process to be speed limited is the first speed limit coefficient when the first PSI value belongs to the first preset range 1 and the second PSI value belongs to the second preset range 1.
[0249] The electronic device may determine that the speed limit coefficient corresponding to the process to be speed limited is the second speed limit coefficient when the first PSI value belongs to the first preset range 2 and the second PSI value belongs to the second preset range 2.
[0250] The electronic device may determine that the speed limit coefficient corresponding to the process to be speed limited is the third speed limit coefficient when the first PSI value belongs to the first preset range 3 and the second PSI value belongs to the second preset range 3.
[0251] S402: Determine a rate threshold of the process to be speed-limited according to the speed-limit coefficient and the access rate of the hard disk.
[0252] In this embodiment, the electronic device may determine a rate threshold of the process to be speed-limited according to the speed-limit coefficient and the access rate of the hard disk.
[0253] It can be understood that the electronic device can determine the product of the hard disk access rate and the speed limit coefficient as the rate threshold of the process to be speed limited.
[0254] Beneficial effects of this embodiment: In this embodiment, the speed limit is divided into three gears, the first speed limit coefficient represents the lowest speed limit strength (the maximum speed after speed limit), and the third speed limit coefficient represents the highest speed limit strength (the minimum speed after speed limit). By first determining the speed limit coefficient of the process to be speed limited based on the PSI value, the number of read storage blocks, and the number of write storage blocks, and then determining the rate threshold (bandwidth upper limit) of the process to be speed limited based on the speed limit coefficient and the hard disk access rate, the rate threshold of the process to be speed limited can be accurately determined, thereby achieving a reasonable limit on the rate of the process to be speed limited, maintaining a balance in the access of each process to the hard disk, and increasing the probability of each process competing for IO resources.
[0255] Next, the actual use effect of the method for limiting the speed of a process to be speed-limited in an embodiment of the present application is described.
[0256] Experiment 1:
[0257] In this embodiment, the electronic device can run DataFiller.apk to simulate a high IO scenario so that the electronic device's status information meets the speed limit condition. The cold start time of each application (the time it takes for each process to compete for IO resources) is tested to obtain a first test result, which shows that the cold start time is reduced. Table 1 shows the first test result.
[0258] Table 1 First test results
[0259]
[0260] Experiment 2:
[0261] In this embodiment, the electronic device can continuously run the dd command to ensure that the status information of the electronic device meets the speed limit conditions. Compared with the scenario where the access rate of the process to be speed-limited is not restricted, the operation of each application (such as starting, exiting, and sliding) is smoother and there is no serious lag.
[0262] Experiment 3:
[0263] In this embodiment, when the electronic device limits the access rate of the process to be speed-limited, the electronic device runs a benchmark tool (such as Androidbench) to obtain a second test result. Table 2 shows the second test result. Based on the second test result, it can be seen that, compared to the scenario where the access rate of the process to be speed-limited is not limited, in this embodiment of the present application, limiting the access rate of the process to be speed-limited has no effect on IO operations.
[0264] Table 2 Second test results
[0265]
[0266] Based on the above three experiments, it can be seen that the method of speed limiting the speed-limited process in the embodiment of the present application increases the probability of other processes obtaining IO resources, reduces the probability of electronic devices being stuck, and improves the user experience.
[0267] Figure 5 This is a schematic diagram of a process speed limiting device provided by an exemplary embodiment of the present application. Figure 5 The speed limiting device 50 of the process includes a monitoring module 51, a screening module 52, a processing module 53 and a control module 54, wherein,
[0268] The monitoring module 51 is configured to obtain hard disk access information when it detects that the status information of the electronic device meets the speed limit condition; the status information includes a pressure blocking information (PSI) value;
[0269] A screening module 52 is configured to determine at least one process to be speed-limited among the plurality of processes;
[0270] The processing module 53 is used to determine the rate threshold of the process to be speed-limited according to the PSI value and the hard disk access information;
[0271] The control module 54 is configured to limit the access rate of the process to be speed-limited according to the rate threshold of the process to be speed-limited.
[0272] The process speed limiting device provided in the embodiment of the present application can implement the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar and will not be repeated here.
[0273] In a possible implementation, the process information includes a process identifier and the amount of data accessed by the process on the hard disk; the screening module 52 is specifically configured to:
[0274] For any process, obtain the process ID and the amount of data accessed by the process on the hard disk;
[0275] Sort multiple processes in descending order of the amount of data accessing the hard disk, and obtain the sorting sequence number of each process;
[0276] The processes with sorting numbers less than or equal to N are determined as the processes to be selected; N is a positive integer greater than 1;
[0277] Determine whether the process to be selected meets the elimination condition according to the process ID of the process to be selected;
[0278] Based on the process to be selected not satisfying the elimination condition, it is determined that the process to be selected is the process to be speed-limited; or based on the process to be selected satisfying the elimination condition, it is determined that the process to be selected is not the process to be speed-limited.
[0279] The process speed limiting device provided in the embodiment of the present application can implement the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar and will not be repeated here.
[0280] In a possible implementation, the screening module 52 is specifically configured to:
[0281] Determining whether the process ID of the process to be selected satisfies at least one of a plurality of conditions;
[0282] Based on the process identifier of the process to be selected, at least one of the multiple conditions is satisfied, determining that the process to be selected meets the elimination condition; or
[0283] Based on the process identifier of the process to be selected, each of the multiple conditions is not satisfied, determining that the process to be selected does not meet the elimination condition;
[0284] Several conditions include:
[0285] The process ID of the process to be selected belongs to the list of processes that cannot be speed-limited;
[0286] The process ID of the process to be selected indicates that the process to be selected is a foreground process, and the process ID of the process to be selected does not belong to the list of processes that can be rate-limited;
[0287] The process identifier of the process to be selected indicates that the process to be selected is a system process.
[0288] The process speed limiting device provided in the embodiment of the present application can implement the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar and will not be repeated here.
[0289] In a possible implementation, the status information includes a pressure blockage information PSI value, whether a low-speed warning message corresponding to the hard disk is received, and a display status of the electronic device; the display status is a screen-on state or a screen-off state;
[0290] The monitoring module 51 is specifically configured to:
[0291] When the PSI value is detected to be greater than the PSI threshold and the display state is bright, obtain the hard disk access information; or,
[0292] When the low-speed warning information corresponding to the hard disk is received and the display state is the bright screen state, the access information of the hard disk is obtained.
[0293] The process speed limiting device provided in the embodiment of the present application can implement the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar and will not be repeated here.
[0294] In a possible implementation, the hard disk access information includes the hard disk access rate, the number of read storage blocks, and the number of write storage blocks; the processing module 51 is specifically configured to:
[0295] Determine a speed limit coefficient corresponding to the process to be speed limited according to the PSI value, the number of read storage blocks, and the number of write storage blocks; the speed limit coefficient is the first speed limit coefficient, the second speed limit coefficient, or the third speed limit coefficient; the first speed limit coefficient is greater than the second speed limit coefficient, and the second speed limit coefficient is greater than the third speed limit coefficient;
[0296] Determine the rate threshold of the process to be speed-limited based on the speed limit coefficient and the hard disk access rate.
[0297] The process speed limiting device provided in the embodiment of the present application can implement the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar and will not be repeated here.
[0298] In one possible implementation, the PSI value includes a first PSI value and a second PSI value; the first PSI value indicates a proportion of time that at least one of the multiple processes is blocked, and the second PSI value indicates a proportion of time that each of the multiple processes is blocked; the processing module 51 is specifically configured to:
[0299] determining whether the first PSI value falls within a first preset range and the second PSI value falls within a second preset range;
[0300] Based on the first PSI value being within a first preset range and the second PSI value being within a second preset range, determining a speed limit coefficient corresponding to the process to be speed limited according to the PSI value; or
[0301] Based on the fact that the first PSI value does not belong to the first preset range and / or the second PSI value does not belong to the second preset range, the ratio of the number of read storage blocks to the number of write storage blocks is determined, and based on the number ratio and the number of read storage blocks, the speed limit coefficient corresponding to the process to be speed limited is determined.
[0302] The process speed limiting device provided in the embodiment of the present application can implement the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar and will not be repeated here.
[0303] An embodiment of the present application further provides a chip, which includes at least one processor, and the processor is used to execute program instructions to perform the method of the aforementioned method embodiment.
[0304] The embodiment of the present application further provides a chip module. It is understandable that in one implementation, the chip module can be a 5G chip module.
[0305] The chip module stores a computer program, and when the computer program is executed by the chip module, the method of the above method embodiment is implemented.
[0306] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. It can be understood that the electronic device can be a 5G chip module.
[0307] See Figure 6 The electronic device 60 may include a processor 61 and a memory 62. Exemplarily, the processor 61 and the memory 62 are interconnected via a bus 63.
[0308] Memory 62 stores computer-executable instructions;
[0309] The processor 61 executes the computer-executable instructions stored in the memory 62 , so that the processor 61 performs the method shown in the above method embodiment.
[0310] All or part of the steps of the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a readable memory. When the program is executed, it performs the steps of the above-mentioned method embodiments; and the aforementioned memory (storage medium) includes: read-only memory (ROM), RAM, flash memory, hard disk, solid-state drive, magnetic tape, floppy disk, optical disc, and any combination thereof.
[0311] Accordingly, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, the method of the above-mentioned method embodiment is implemented.
[0312] Accordingly, an embodiment of the present application may also provide a computer program product, including computer-executable instructions. When the computer-executable instructions are executed by a processor, the method shown in the above method embodiment is executed.
[0313] These computer-executable instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0314] These computer-executable instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are performed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0315] Obviously, those skilled in the art may make various changes and modifications to the embodiments of the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations.
[0316] In this application, the term "include" and its variations may refer to non-restrictive inclusion; the term "or" and its variations may refer to "and / or". In this application, the terms "first", "second", etc. are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. In this application, "plurality" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and subsequent associated objects are in an "or" relationship.
Claims
1. A process speed limiting method, characterized in that: include: When it is detected that the status information of the electronic device meets the speed limit condition, access information of the hard disk is obtained; the status information includes a pressure blocking information (PSI) value; the electronic device includes the hard disk; Determining at least one process to be rate-limited among the plurality of processes; Determining a rate threshold of the process to be speed-limited according to the PSI value and the access information of the hard disk; According to the rate threshold of the process to be speed-limited, the access rate of the process to be speed-limited is limited.
2. The method according to claim 1, characterized in that Determining at least one process to be rate-limited among the multiple processes includes: For any process, obtaining the process ID of the process and the amount of data accessed by the process on the hard disk; Sorting the plurality of processes in descending order of the amount of data accessed to the hard disk to obtain a sorting sequence number for each process; Determine the processes with sorting numbers less than or equal to N as the processes to be selected; N is a positive integer greater than 1; Determining whether the process to be selected meets a removal condition according to the process identifier of the process to be selected; Determining that the process to be selected is the process to be speed-limited based on the process to be selected not satisfying the elimination condition; or Based on the process to be selected satisfying the elimination condition, it is determined that the process to be selected is not the process to be speed-limited.
3. The method according to claim 2, characterized in that The determining, based on the process identifier of the process to be selected, whether the process to be selected meets the elimination condition includes: Determining whether the process identifier of the process to be selected satisfies at least one of a plurality of conditions; Based on the process identifier of the process to be selected, at least one of multiple conditions is satisfied, determining that the process to be selected meets the elimination condition; or Based on the process identifier of the process to be selected, each of the multiple conditions is not satisfied, determining that the process to be selected does not satisfy the elimination condition; The multiple conditions include: The process ID of the process to be selected belongs to the list of processes that cannot be speed-limited; The process ID of the process to be selected indicates that the process to be selected is a foreground process, and the process ID of the process to be selected does not belong to a list of speed-limitable processes; The process identifier of the process to be selected indicates that the process to be selected is a system process.
4. The method according to claim 1, wherein The status information includes the pressure blockage information PSI value, whether the low speed warning information corresponding to the hard disk is received, and the display status of the electronic device; the display status is the screen-on state or the screen-off state; The acquiring the access information of the hard disk when it is detected that the status information of the electronic device meets the speed limit condition includes: When it is detected that the PSI value is greater than a PSI threshold and the display state is the screen-on state, obtaining access information of the hard disk; or, When the low-speed warning information corresponding to the hard disk is received and the display state is the bright screen state, access information of the hard disk is acquired.
5. The method according to claim 1, characterized in that The hard disk access information includes the hard disk access rate, the number of read storage blocks, and the number of write storage blocks; and determining the rate threshold of the process to be speed-limited based on the PSI value and the hard disk access information includes: Determining, according to the PSI value, the number of the read storage blocks, and the number of the write storage blocks, a speed limit coefficient corresponding to the process to be speed limited; the speed limit coefficient is a first speed limit coefficient, a second speed limit coefficient, or a third speed limit coefficient; the first speed limit coefficient is greater than the second speed limit coefficient, and the second speed limit coefficient is greater than the third speed limit coefficient; A rate threshold of the process to be speed-limited is determined according to the speed-limit coefficient and the access rate of the hard disk.
6. The method according to claim 5, characterized in that The PSI value includes a first PSI value and a second PSI value; the first PSI value indicates a proportion of time that at least one of the multiple processes is blocked, and the second PSI value indicates a proportion of time that each of the multiple processes is blocked; determining the speed limit coefficient corresponding to the process to be speed limited based on the PSI value, the number of the read storage blocks, and the number of the write storage blocks, includes: determining whether the first PSI value falls within a first preset range and the second PSI value falls within a second preset range; Based on the first PSI value belonging to the first preset range and the second PSI value belonging to the second preset range, determining a speed limit coefficient corresponding to the process to be speed limited according to the PSI values; or Based on the fact that the first PSI value does not belong to the first preset range, and / or the second PSI value does not belong to the second preset range, determine the ratio of the number of the read storage blocks to the number of the write storage blocks, and determine the speed limit coefficient corresponding to the process to be speed limited based on the number ratio and the number of the read storage blocks.
7. A process speed limiting device, characterized in that: include: A monitoring module, configured to obtain hard disk access information when status information of the electronic device is detected to meet a speed limit condition; the status information includes a pressure blocking information (PSI) value; the electronic device includes the hard disk; A screening module, configured to determine at least one process to be rate-limited among a plurality of processes; a processing module, configured to determine a rate threshold of the process to be speed-limited according to the PSI value and the access information of the hard disk; The control module is used to limit the access rate of the process to be speed-limited according to the rate threshold of the process to be speed-limited.
8. A chip, characterized in that: The chip includes at least one processor, and the processor is configured to execute program instructions to perform the method according to any one of claims 1 to 6.
9. An electronic device, characterized in that: include: memory and processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 6 when executed by a processor.
11. A computer program product, characterized in that The method comprises computer-executable instructions, which, when executed by a processor, enable the method according to any one of claims 1 to 6 to be performed.
Citation Information
Patent Citations
Competition blocking real-time monitoring method and device and computer readable storage medium
CN115904743A
Internal memory optimization method of kernel layer and terminal equipment
CN118606045A
Memory Management Method and Apparatus, Electronic Device, and Computer-Readable Storage Medium
US20240054079A1