System resource regulation and control method and device, medium and equipment

By detecting the system load and prioritizing the allocation of resources to threads in high-frequency usage scenarios, the performance problems caused by insufficient system resources are solved, the system stability and user experience are improved, and the user intervention needs are reduced.

CN119166341APending Publication Date: 2024-12-20SHENZHEN TCL NEW-TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411218655.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-30
Publication Date
2024-12-20

AI Technical Summary

Technical Problem

When the system resources are insufficient, the system load increases, causing the application to stutter or abnormal exit, affecting the user experience. The existing solutions require users to actively close uncommon processes, but may also affect the operation of important processes in this process.

Method used

By detecting that the system load exceeds the preset threshold, determine all usage scenarios, view the target scenarios used frequently and obtain the priority of their threads, prioritize system resources to the threads with the highest priority, and optimize the message queue status if necessary Recover exceptions to reduce resource usage or destruction of non-target scenario threads.

Benefits of technology

It effectively solves the problem of performance impact caused by insufficient system resources, ensures the normal operation of high-frequency usage scenarios, reduces the need for active users to intervene, and improves system stability and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119166341A_ABST
    Figure CN119166341A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a system resource regulation and control method and device, a medium and equipment, and the method comprises the steps: determining all current use scenes of a system when detecting that the current load of the system exceeds a preset threshold value; checking whether a target scene defined as high-frequency use exists in the use scene or not; if the target scenes exist, target threads corresponding to the target scenes are checked, and pre-labeled priorities of the target threads are obtained; and preferentially allocating the system resources to the target thread with the highest priority according to the priority corresponding to each target thread. By utilizing the system resource regulation and control method provided by the embodiment of the invention, when the problem of overlarge load of the current system is detected, the system resource is preferentially allocated to the thread with the highest priority according to the priority by judging the priority corresponding to the thread of each current use scene of the system; the problem that the performance of main functions in a current use scene of a system is affected due to insufficient system resources is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data transmission technology, and in particular to the field of system resource regulation technology, and in particular to a system resource regulation method, device, medium and equipment. Background Art

[0002] Since system resources are limited, when system resources such as CPU, memory, and disk I / O are insufficient to meet the needs of system operation, the system load will increase. When the system load exceeds the preset threshold, if no intervention is made, it will affect the normal use of applications running on the system. The most common problem is that the application freezes or exits abnormally during operation, which directly affects the user's current usage scenario (such as using a Bluetooth speaker to play audio).

[0003] In order to solve the above problems, most current practices are that the system will issue a prompt when the load is too large, and the user will take the initiative to close some infrequently used processes. Or wait until the user finds that the system is stuck, and then take the initiative to close some infrequently used processes. However, no matter which method is adopted, it is basically necessary for the user to take the initiative to handle infrequently used processes, and before the infrequently used processes are closed, some important processes currently used by the user may also be stuck or abnormally exit due to excessive system load, thus affecting the user experience. Summary of the invention

[0004] The embodiments of the present application provide a system resource control method, device, medium and equipment. The system resource control method provided by the embodiments of the present application can solve the problem that the performance of the main functions in the current use scenario of the system is affected due to insufficient system resources.

[0005] The present application provides a method for controlling system resources, including:

[0006] When it is detected that the current load of the system exceeds a preset threshold, all current usage scenarios of the system are determined;

[0007] Check whether there is a target scenario defined as a high-frequency usage in the usage scenarios;

[0008] If the target scenario exists, checking the target threads corresponding to each target scenario and obtaining the priority pre-marked by each target thread;

[0009] According to the priorities corresponding to the target threads, system resources are preferentially allocated to the target threads with the highest priorities.

[0010] In the system resource control method described in the embodiment of the present application, after checking whether there is a target scenario defined as a high-frequency usage in the usage scenario, the method further includes:

[0011] If the target scenario does not exist in the usage scenarios, obtaining the usage frequency of each usage scenario within a preset time period;

[0012] Determining the priority of the thread corresponding to each usage scenario according to the frequency of use;

[0013] Add the corresponding usage scenario and priority to the head of the thread;

[0014] According to the priorities corresponding to the threads, system resources are preferentially allocated to the threads with the highest priorities.

[0015] In the system resource control method described in the embodiment of the present application, after obtaining the priority pre-marked by each target thread, the method further includes:

[0016] Check the storage status of the message queue of each target thread, whether the storage status is normal or abnormal;

[0017] According to the priorities corresponding to the target threads, the message queues whose storage status is abnormal and whose corresponding target threads have the highest priority are preferentially optimized, so that the message queues whose storage status is abnormal can be restored to normal.

[0018] In the system resource control method described in the embodiment of the present application, the checking the storage status of the message queue of each target thread includes:

[0019] Retrieve the log information used to record the running status of the message queue;

[0020] According to the log information, determine whether there is an event overflow in the message queue of each target thread, and if so, mark the storage state of the message queue with event overflow as a congestion type exception; or

[0021] According to the log information, it is determined whether there is an event timeout and no response in the message queue of each target thread. If yes, the storage state of the message queue with the event timeout and no response is marked as a blocking exception.

[0022] In the system resource control method described in the embodiment of the present application, when the storage state of the message queue is abnormally congested, the optimization process includes:

[0023] The queue depth of the message queue is increased to improve the event storage capacity of the message queue.

[0024] In the system resource control method described in the embodiment of the present application, when the storage state of the message queue is a blocking exception, the optimization process includes:

[0025] The wireless bandwidth of the target thread is increased to improve the speed at which the target thread transmits data.

[0026] In the system resource control method described in the embodiment of the present application, after obtaining the priority pre-marked by each target thread, the method further includes:

[0027] The system resources occupied by the non-target threads corresponding to the non-target scenarios are reduced, or the non-target threads corresponding to the non-target scenarios are destroyed.

[0028] Accordingly, another aspect of the embodiment of the present application further provides a system resource control device, the system resource control device comprising:

[0029] A detection module, used to determine all current usage scenarios of the system when it is detected that the current load of the system exceeds a preset threshold;

[0030] A checking module is used to check whether there is a target scenario defined as a high-frequency usage in the usage scenarios;

[0031] An acquisition module, configured to check the target threads corresponding to the target scenarios if the target scenarios exist, and acquire the priority pre-marked by the target threads;

[0032] The allocation module is used to allocate system resources to the target thread with the highest priority according to the priorities corresponding to the target threads.

[0033] Correspondingly, another aspect of the embodiment of the present application further provides a storage medium, wherein the storage medium stores a plurality of instructions, wherein the instructions are suitable for loading by a processor to execute the system resource regulation method as described above.

[0034] Correspondingly, another aspect of the embodiment of the present application further provides an electronic device, including a processor and a memory, wherein the memory stores a plurality of instructions, and the processor loads the instructions to execute the system resource regulation method as described above.

[0035] The embodiments of the present application provide a method, apparatus, medium and equipment for regulating system resources. The method determines all current usage scenarios of the system when it is detected that the current load of the system exceeds a preset threshold; checks whether there is a target scenario defined as high-frequency use in the usage scenario; if there is a target scenario, checks the target thread corresponding to each target scenario, and obtains the priority pre-marked by each target thread; and allocates system resources to the target thread with the highest priority first according to the priority corresponding to each target thread. The system resource regulation method provided by the embodiments of the present application can, when it is detected that the current system has an overload problem, determine the priority corresponding to the thread of each current usage scenario of the system, and allocate system resources to the thread with the highest priority first according to the priority, so as to solve the problem that the performance of the main functions in the current usage scenario of the system is affected due to insufficient system resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application, and those skilled in the art can obtain other drawings based on these drawings without creative work.

[0037] Figure 1 A flowchart of a system resource control method provided in an embodiment of the present application.

[0038] Figure 2 Another flowchart of the system resource control method provided in an embodiment of the present application.

[0039] Figure 3 A schematic diagram of the structure of a system resource control device provided in an embodiment of the present application.

[0040] Figure 4 Another structural schematic diagram of the system resource control device provided in an embodiment of the present application.

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

[0042] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.

[0043] The embodiment of the present application provides a system resource control method, which can be used to determine the priorities of threads in various current usage scenarios of the system and allocate system resources to threads with the highest priority according to the priority level when the current system is overloaded, so as to solve the problem that the performance of the main functions in the current usage scenario of the system is affected due to insufficient system resources. The following are detailed descriptions.

[0044] The term "and / or" in this application can be a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this application generally indicates that the associated objects before and after are in an "or" relationship.

[0045] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described here can be implemented in an order other than that illustrated or described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or modules is not necessarily limited to the steps or modules clearly listed, but may include other steps or modules that are not clearly listed or inherent to these processes, methods, products or devices. The naming or numbering of steps in this application does not mean that the steps in the method flow must be executed in the time / logical sequence indicated by the naming or numbering. The process steps that have been named or numbered can change the execution order according to the technical purpose to be achieved, as long as the same or similar technical effects can be achieved. The division of modules in this application is a logical division. There may be other division methods when it is implemented in actual applications. For example, multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection between modules can be electrical or other similar forms, which are not limited in this application. In addition, the modules or submodules described as separate components may or may not be physically separated, may or may not be physical modules, or may be distributed in multiple circuit modules, and some or all of the modules may be selected according to actual needs to achieve the purpose of the present application.

[0046] The system resource control method involved in the embodiment of the present application is mainly applied to electronic devices, which may be televisions, smart phones, tablet computers, laptops, desktop computers, smart speakers, smart watches, smart voice interaction devices, smart home appliances, vehicle terminals and servers, etc., which are not limited here. Optionally, the server may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or an IoT cloud (Internet of Things cloud) that provides the ability to store, process and manage data generated by IoT devices, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and basic cloud computing services such as big data and artificial intelligence platforms, which are not limited here.

[0047] For ease of understanding, the specific process in the embodiments of the present application is described below. Figure 1 , Figure 1 A flowchart of an embodiment of a system resource control method provided in an embodiment of the present application.

[0048] exist Figure 1 In the illustrated embodiment, the method may include the following steps:

[0049] Step 101, when it is detected that the current load of the system exceeds a preset threshold, all current usage scenarios of the system are determined.

[0050] It should be noted that, since system resources are limited, when system resources such as CPU, memory, and disk I / O are insufficient to meet the needs of system operation, the system load will increase. When the system load exceeds the preset threshold, for example, when the preset threshold is 80%, if no intervention is made at this time, it will affect the normal use of applications running on the system. The most common problem is that the application freezes or exits abnormally during operation, which directly affects the user's current usage scenario (such as using a Bluetooth speaker to play audio, using a Bluetooth controller to play games, or using a Bluetooth microphone to sing, etc.).

[0051] In this embodiment, the monitoring of the current load of the system can be achieved through tools provided by the system (such as top, htop, iostat, etc. in Linux) or third-party monitoring tools. The monitoring targets specifically refer to indicators such as CPU usage, memory usage, and disk I / O usage.

[0052] When it is detected that the current system load exceeds the preset threshold, it is necessary to first determine all current usage scenarios of the system, so as to analyze the user's attention to each usage scenario in the future, and then reasonably adjust the system resources to achieve that when the system resources are tight, the system resources can be allocated to the usage scenarios with higher user attention first. That is, the performance of the usage scenarios with lower user attention is sacrificed, and the usage scenarios with higher user attention are mainly supported, so as to ensure that the current important usage scenarios of users can operate normally when the system is overloaded as much as possible.

[0053] Step 102 , checking whether there is a target scenario defined as a high-frequency usage scenario in the usage scenarios.

[0054] In this embodiment, the user can mark the frequently used usage scenarios in advance in the configuration interface provided by the system and define them as high-frequency target scenarios. After setting this, when it is detected that the current load of the system exceeds the preset threshold, the system resource allocation to the target scenario will be given priority to support the normal operation of the target scenario to the maximum extent.

[0055] Compared with the conventional thread priority setting mechanism, this solution allows users to customize the thread priority according to their own needs.

[0056] Step 103: If the target scenario exists, then check the target threads corresponding to each target scenario, and obtain the priority pre-marked by each target thread.

[0057] In this embodiment, the target scenario can actually be understood as one or more application processes running on the system that have a data interaction relationship. For example, in the usage scenario of using a Bluetooth speaker to play audio, at least the audio playback process and the Bluetooth audio transmission process need to be run simultaneously. When the above viewing results show that the system currently has a target scenario, under normal circumstances, it is only necessary to allocate system resources to the target scenario. However, the focus of this solution is not on how to regulate system resources between different applications, but on regulating system resources between different threads in the usage scenario to maximize the concentration of system resources in threads with smaller granularity to ensure that the main functions in the target scenario are not affected. For example, in the usage scenario where the system uses a Bluetooth speaker to play audio, the following threads may be involved:

[0058] Audio playback thread: This thread is responsible for sending audio data to the Bluetooth speaker and playing it. It handles decoding the audio stream, format conversion (if necessary), and sending data via the Bluetooth protocol.

[0059] Bluetooth communication thread: responsible for handling Bluetooth communications, including discovery, connection, data transmission, etc. of Bluetooth devices.

[0060] User interface thread: responsible for updating the user interface, displaying the currently playing audio information, controlling playback (such as the play / pause button), updating the progress bar, etc.

[0061] Background management thread: responsible for managing background tasks of audio playback, such as processing playlists, switching audio sources, adjusting volume, etc.

[0062] Error handling thread: responsible for detecting errors and performing corresponding processing, such as reconnecting to the Bluetooth device, resuming playback, etc.

[0063] Power management thread: responsible for monitoring battery usage and adjusting the power of audio playback as needed to optimize battery life.

[0064] Among the above-mentioned threads, users can set corresponding priorities according to their own needs. For example, the user is more concerned about the audio playback performance in the current usage scenario, so the priority of the audio playback thread can be set to the highest, and the priority of the Bluetooth communication thread responsible for data transmission can be set to the priority second only to the audio playback thread.

[0065] After this setting, when it is detected that the current system load exceeds the preset threshold, system resource allocation to the target thread of the target scene will be prioritized to maximize support for the normal operation of the main functions of the target scene.

[0066] Step 104 , according to the priorities corresponding to the target threads, the system resources are preferentially allocated to the target threads with the highest priorities.

[0067] In this embodiment, the system will preferentially allocate system resources to the target thread with the highest priority according to the priority of each target thread, so as to avoid abnormal performance of the target thread due to insufficient system resources in the target scenario.

[0068] In some embodiments, after checking whether there is a target scenario defined as a high-frequency usage in the usage scenarios, the method further includes:

[0069] If the target scenario does not exist in the usage scenarios, obtaining the usage frequency of each usage scenario within a preset time period;

[0070] Determining the priority of the thread corresponding to each usage scenario according to the frequency of use;

[0071] Add the corresponding usage scenario and priority to the head of the thread;

[0072] According to the priorities corresponding to the threads, system resources are preferentially allocated to the threads with the highest priorities.

[0073] In this embodiment, it is mainly aimed at the situation that the user has not set the high-frequency target scene in advance. At this time, there is no clear priority distinction. However, this situation may occur only because the user has not used the priority configuration function provided by the system. Under normal circumstances, as long as the system currently has a usage scenario, in order to improve the user experience, it is also necessary to reasonably regulate the system resources so that the system resources are as inclined as possible to the usage scenario that the user may be concerned about, or even the performance corresponding to a key thread in the usage scenario. Therefore, when there is no target scenario in the usage scenario, the priority of the thread corresponding to each usage scenario can be automatically determined according to the size of the usage frequency by obtaining the usage frequency of each usage scenario within a preset time period, and the corresponding usage scenario and priority are added to the head of the thread, so that the system can allocate system resources to the thread with the highest priority according to the priority corresponding to each thread after determining all the current usage scenarios of the system.

[0074] In some embodiments, Figure 2 As shown, after obtaining the priority pre-marked by each target thread, the method further includes:

[0075] Check the storage status of the message queue of each target thread, whether the storage status is normal or abnormal;

[0076] According to the priorities corresponding to the target threads, the message queues whose storage status is abnormal and whose corresponding target threads have the highest priority are preferentially optimized, so that the message queues whose storage status is abnormal can be restored to normal.

[0077] In this embodiment, it is mainly for situations where multithreading or asynchronous processing requires the use of message queues for data transmission. It should be explained that a message queue is a communication mechanism that allows applications to exchange messages through queues. In this mechanism, messages are sent to a queue, and then read and processed by another or more applications from the queue. This mode helps to achieve decoupling, asynchronous communication and flow control between applications.

[0078] For example, different threads of the Android Bluetooth protocol stack are independent of each other, and Bluetooth audio data will be cached in the message queue corresponding to the audio thread first. When the CPU and other systems are heavily loaded, it is easy to cause audio jams in the audio thread of the protocol stack due to scheduling delays.

[0079] In order to solve the above problem, the storage status of the message queue of each target thread can be checked, and according to the priority corresponding to each target thread, the message queue with abnormal storage status and the corresponding target thread with the highest priority can be optimized first, so that the message queue with abnormal storage status can be restored to normal.

[0080] Specifically, the storage status of the message queue can be checked by calling the log information, which is used to record the running status of the message queue. According to the log information, it is determined whether there is an event overflow in the message queue of each target thread. If so, the storage status of the message queue with event overflow is marked as a congestion type exception; or according to the log information, it is determined whether there is an event timeout and no response in the message queue of each target thread. If so, the storage status of the message queue with event timeout and no response is marked as a blocking type exception.

[0081] When the storage state of the message queue is abnormally congested, the queue depth of the message queue can be increased to improve the event storage capacity of the message queue, so as to optimize the message queue and allow the message queue to cache more events, thereby avoiding queue overflow and data loss, Bluetooth audio freezes and other problems. At the same time, a scheduling request to increase system resources can be sent to the system so that the target thread can be executed more promptly. When the target thread becomes smooth due to scheduling, the optimized queue length and resource scheduling can be restored to form dynamic regulation.

[0082] When the storage state of the message queue is a blocking exception, providing more system resources may not necessarily solve the problem because it is usually caused by the design and scheduling mechanism within the system. Increasing system resources may bring some relief, but it cannot fundamentally solve the problem. On the contrary, providing more bandwidth can alleviate the blockage because bandwidth directly affects the transmission speed of messages. Therefore, by increasing the wireless bandwidth of the target thread, the speed of data transmission of the target thread can be increased, and the time that cache events stay in the message queue can be reduced, so as to achieve the purpose of optimizing the message queue.

[0083] In some embodiments, after obtaining the priority pre-marked by each target thread, the method further includes:

[0084] The system resources occupied by the non-target threads corresponding to the non-target scenarios are reduced, or the non-target threads corresponding to the non-target scenarios are destroyed.

[0085] In this embodiment, in order to allocate system resources to the target thread as much as possible, the system resources occupied by the non-target threads corresponding to the non-target scenarios can be reduced, or the non-target threads corresponding to the non-target scenarios can be destroyed to avoid excessive occupation of system resources by the threads corresponding to the non-target scenarios.

[0086] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.

[0087] In specific implementation, the present application is not limited by the execution order of the various steps described. If no conflict occurs, some steps can be performed in other orders or simultaneously.

[0088] As can be seen from the above, the system resource control method provided in the embodiment of the present application determines all current usage scenarios of the system when it is detected that the current load of the system exceeds a preset threshold; checks whether there is a target scenario defined as high-frequency use in the usage scenario; if the target scenario exists, checks the target thread corresponding to each of the target scenarios, and obtains the priority pre-marked by each of the target threads; and allocates system resources to the target thread with the highest priority first according to the priority corresponding to each of the target threads. Utilizing the system resource control method provided in the embodiment of the present application, when it is detected that the current system has an overload problem, by judging the priority corresponding to the threads of each current usage scenario of the system, according to the size of the priority, system resources are allocated to the thread with the highest priority first, so as to solve the problem that the performance of the main functions in the current usage scenario of the system is affected due to insufficient system resources.

[0089] An embodiment of the present application also provides a system resource control device, which can be integrated in an electronic device.

[0090] See also Figure 3 , Figure 3 A schematic diagram of the structure of a system resource control device provided in an embodiment of the present application. The system resource control device 30 may include:

[0091] The detection module 31 is used to determine all current usage scenarios of the system when it is detected that the current load of the system exceeds a preset threshold;

[0092] A checking module 32 is used to check whether there is a target scene defined as a high-frequency use in the usage scene;

[0093] The acquisition module 33 is used for checking the target threads corresponding to each target scene if the target scene exists, and acquiring the priority pre-marked by each target thread;

[0094] The allocation module 34 is used to allocate system resources to the target thread with the highest priority according to the priorities corresponding to the target threads.

[0095] In some embodiments, the device also includes a determination module for obtaining the usage frequency of each usage scenario within a preset time period if the target scenario does not exist in the usage scenarios; determining the priority of the thread corresponding to each usage scenario based on the size of the usage frequency; adding the corresponding usage scenario and priority to the head of the thread; and allocating system resources preferentially to the thread with the highest priority based on the priority corresponding to each thread.

[0096] In some embodiments, the device also includes an optimization module for checking the storage status of the message queue of each of the target threads, wherein the storage status is normal or abnormal; according to the priority corresponding to each of the target threads, the message queue whose storage status is abnormal and whose corresponding target thread is the highest priority is optimized first, so that the message queue whose storage status is abnormal can be restored to normal.

[0097] In some embodiments, the optimization module is used to retrieve log information used to record the running status of the message queue; based on the log information, determine whether there is an event overflow in the message queue of each target thread, and if so, mark the storage status of the message queue with event overflow as a congestion type exception; or based on the log information, determine whether there is an event timeout and no response in the message queue of each target thread, and if so, mark the storage status of the message queue with event timeout and no response as a blocking type exception.

[0098] In some embodiments, when the storage state of the message queue is a congestion-type exception, the optimization process includes: increasing the queue depth of the message queue to improve the event storage capacity of the message queue.

[0099] In some embodiments, when the storage state of the message queue is a blocking exception, the optimization process includes: increasing the wireless bandwidth of the target thread to increase the speed at which the target thread transmits data.

[0100] In some embodiments, the apparatus further includes a processing module, configured to reduce system resources occupied by non-target threads corresponding to non-target scenarios, or to destroy non-target threads corresponding to non-target scenarios.

[0101] In specific implementation, the above modules can be implemented as independent entities, or can be arbitrarily combined to be implemented as the same entity or several entities.

[0102] As can be seen from the above, the system resource regulation device 30 provided in the embodiment of the present application, wherein the detection module 31 is used to determine all current usage scenarios of the system when it is detected that the current load of the system exceeds a preset threshold; the viewing module 32 is used to check whether there is a target scenario defined as high-frequency use in the usage scenario; the acquisition module 33 is used to check the target threads corresponding to each of the target scenarios if the target scenario exists, and obtain the priority pre-marked for each of the target threads; the allocation module 34 is used to allocate system resources to the target thread with the highest priority according to the priority corresponding to each of the target threads.

[0103] See also Figure 4 , Figure 4Another structural diagram of the system resource control device provided in an embodiment of the present application, the system resource control device 30 includes a memory 120, one or more processors 180, and one or more applications, wherein the one or more applications are stored in the memory 120 and configured to be executed by the processor 180; the processor 180 may include a detection module 31, a viewing module 32, an acquisition module 33, and an allocation module 34. For example, the structure and connection relationship of the above components may be as follows:

[0104] The memory 120 can be used to store applications and data. The applications stored in the memory 120 include executable codes. The applications can be composed of various functional modules. The processor 180 executes various functional applications and data processing by running the applications stored in the memory 120. In addition, the memory 120 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 120 may also include a memory controller to provide the processor 180 with access to the memory 120.

[0105] The processor 180 is the control center of the device, and uses various interfaces and lines to connect various parts of the entire terminal, and executes various functions of the device and processes data by running or executing applications stored in the memory 120, and calling data stored in the memory 120, so as to monitor the device as a whole. Optionally, the processor 180 may include one or more processing cores; preferably, the processor 180 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs.

[0106] Specifically in this embodiment, the processor 180 will load the executable code corresponding to the process of one or more application programs into the memory 120 according to the following instructions, and the processor 180 will run the application programs stored in the memory 120 to implement various functions:

[0107] A detection instruction is used to determine all current usage scenarios of the system when it is detected that the current load of the system exceeds a preset threshold;

[0108] A check instruction is used to check whether there is a target scenario defined as a high-frequency usage in the usage scenarios;

[0109] An acquisition instruction is used to check the target threads corresponding to each target scene if the target scene exists, and to acquire the priority pre-marked by each target thread;

[0110] The allocation instruction is used to allocate system resources to the target thread with the highest priority according to the priorities corresponding to the target threads.

[0111] In some embodiments, the program also includes a determination instruction for obtaining the usage frequency of each usage scenario within a preset time period if the target scenario does not exist in the usage scenario; determining the priority of the thread corresponding to each usage scenario based on the size of the usage frequency; adding the corresponding usage scenario and priority to the head of the thread; and allocating system resources to the thread with the highest priority based on the priority corresponding to each thread.

[0112] In some embodiments, the program also includes optimization instructions for checking the storage status of the message queue of each target thread, and the storage status is normal or abnormal; according to the priority corresponding to each target thread, the message queue whose storage status is abnormal and whose corresponding target thread is the highest priority is optimized first, so that the message queue whose storage status is abnormal can be restored to normal.

[0113] In some embodiments, the optimization instruction is used to retrieve log information used to record the running status of the message queue; based on the log information, determine whether there is an event overflow in the message queue of each target thread, and if so, mark the storage status of the message queue with event overflow as a congestion type exception; or based on the log information, determine whether there is an event timeout and no response in the message queue of each target thread, and if so, mark the storage status of the message queue with event timeout and no response as a blocking type exception.

[0114] In some embodiments, when the storage state of the message queue is a congestion-type exception, the optimization process includes: increasing the queue depth of the message queue to improve the event storage capacity of the message queue.

[0115] In some embodiments, when the storage state of the message queue is a blocking exception, the optimization process includes: increasing the wireless bandwidth of the target thread to increase the speed at which the target thread transmits data.

[0116] In some embodiments, the program further includes processing instructions for reducing system resources occupied by non-target threads corresponding to non-target scenarios, or destroying non-target threads corresponding to the non-target scenarios.

[0117] The embodiment of the present application also provides an electronic device, which may be a server, a smart phone, a television, a computer, a tablet computer, or other device.

[0118] See also Figure 5 , Figure 5The electronic device 1200 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application, and the electronic device can be used to implement the system resource control method provided in the above embodiment. The electronic device 1200 can be a television, a smart phone, or a tablet computer.

[0119] like Figure 5 As shown, the electronic device 1200 may include an RF (Radio Frequency) circuit 110, a memory 120 including one or more (only one is shown in the figure) computer-readable storage media, an input unit 130, a display unit 140, a sensor 150, an audio circuit 160, a transmission module 170, a processor 180 including one or more (only one is shown in the figure) processing cores, and a power supply 190. Those skilled in the art will understand that Figure 5 The structure of the electronic device 1200 shown in the figure does not constitute a limitation on the electronic device 1200, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0120] The RF circuit 110 is used to receive and send electromagnetic waves, realize the mutual conversion between electromagnetic waves and electrical signals, and thus communicate with a communication network or other devices. The RF circuit 110 may include various existing circuit elements for performing these functions, such as an antenna, a radio frequency transceiver, a digital signal processor, an encryption / decryption chip, a user identity module (SIM) card, a memory, etc. The RF circuit 110 can communicate with various networks such as the Internet, an intranet, a wireless network, or communicate with other devices through a wireless network.

[0121] The memory 120 can be used to store software programs and modules, such as the program instructions / modules corresponding to the system resource control method in the above embodiment. The processor 180 executes various functional applications and data processing by running the software programs and modules stored in the memory 120. The vibration reminder mode can be automatically selected according to the current scene of the electronic device to control the system resources, which can not only ensure that scenes such as meetings are not disturbed, but also ensure that users can perceive incoming calls, thereby improving the intelligence of the electronic device. The memory 120 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 120 may further include a memory remotely arranged relative to the processor 180, and these remote memories may be connected to the electronic device 1200 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0122] The input unit 130 can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control. Specifically, the input unit 130 may include a touch-sensitive surface 131 and other input devices 132. The touch-sensitive surface 131, also known as a touch display screen or a touch pad, can collect the user's touch operations on or near it (such as the user's operation on or near the touch-sensitive surface 131 using any suitable object or accessory such as a finger, stylus, etc.), and drive the corresponding connection device according to a pre-set program. Optionally, the touch-sensitive surface 131 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into touch point coordinates, and then sends it to the processor 180, and can receive and execute commands sent by the processor 180. In addition, the touch-sensitive surface 131 may be implemented in various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch-sensitive surface 131, the input unit 130 may further include other input devices 132. Specifically, the other input devices 132 may include, but are not limited to, one or more of a physical keyboard, a function key (such as a volume control key, a switch key, etc.), a trackball, a mouse, a joystick, and the like.

[0123] The display unit 140 can be used to display information input by the user or information provided to the user and various graphical user interfaces of the electronic device 1200, which can be composed of graphics, text, icons, videos and any combination thereof. The display unit 140 may include a display panel 141. Optionally, the display panel 141 may be configured in the form of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), etc. Further, the touch-sensitive surface 131 may cover the display panel 141. When the touch-sensitive surface 131 detects a touch operation on or near it, it is transmitted to the processor 180 to determine the type of touch event. Subsequently, the processor 180 provides corresponding visual output on the display panel 141 according to the type of touch event. Although in Figure 5 In the embodiment, the touch-sensitive surface 131 and the display panel 141 are implemented as two independent components to realize the input and output functions. However, in some embodiments, the touch-sensitive surface 131 and the display panel 141 can be integrated to realize the input and output functions.

[0124] The electronic device 1200 may also include at least one sensor 150, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 141 according to the brightness of the ambient light, and the proximity sensor may turn off the display panel 141 and / or the backlight when the electronic device 1200 is moved to the ear. As a type of motion sensor, the gravity acceleration sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc. that can also be configured in the electronic device 1200, they will not be repeated here.

[0125] The audio circuit 160, the speaker 161, and the microphone 162 can provide an audio interface between the user and the electronic device 1200. The audio circuit 160 can transmit the received audio data to the speaker 161 after converting the received audio data into an electrical signal, which is converted into a sound signal for output by the speaker 161; on the other hand, the microphone 162 converts the collected sound signal into an electrical signal, which is received by the audio circuit 160 and converted into audio data, and then the audio data is processed by the output processor 180, and then sent to another terminal through the RF circuit 110, or the audio data is output to the memory 120 for further processing. The audio circuit 160 may also include an earplug jack to provide communication between an external headset and the electronic device 1200.

[0126] The electronic device 1200 can help users send and receive emails, browse web pages, and access streaming media through the transmission module 170 (such as a Wi-Fi module), which provides users with wireless broadband Internet access. Figure 5 The transmission module 170 is shown, but it is understandable that it is not an essential component of the electronic device 1200 and can be omitted as needed without changing the essence of the invention.

[0127] The processor 180 is the control center of the electronic device 1200. It uses various interfaces and lines to connect various parts of the entire mobile phone. By running or executing software programs and / or modules stored in the memory 120, and calling data stored in the memory 120, it executes various functions of the electronic device 1200 and processes data, thereby monitoring the mobile phone as a whole. Optionally, the processor 180 may include one or more processing cores; in some embodiments, the processor 180 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, etc., and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 180.

[0128] The electronic device 1200 also includes a power supply 190 for supplying power to various components. In some embodiments, the power supply can be logically connected to the processor 180 through a power management system, so that the power management system can realize functions such as managing discharge and power consumption. The power supply 190 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.

[0129] Although not shown, the electronic device 1200 may also include a camera (such as a front camera, a rear camera), a Bluetooth module, etc., which will not be described in detail here. Specifically in this embodiment, the display unit 140 of the electronic device 1200 is a touch screen display, and the electronic device 1200 also includes a memory 120, and one or more programs, wherein one or more programs are stored in the memory 120, and are configured to be executed by one or more processors 180. One or more programs include instructions for performing the following operations:

[0130] A detection instruction is used to determine all current usage scenarios of the system when it is detected that the current load of the system exceeds a preset threshold;

[0131] A check instruction is used to check whether there is a target scenario defined as a high-frequency usage in the usage scenarios;

[0132] An acquisition instruction is used to check the target threads corresponding to each target scene if the target scene exists, and to acquire the priority pre-marked by each target thread;

[0133] The allocation instruction is used to allocate system resources to the target thread with the highest priority according to the priorities corresponding to the target threads.

[0134] In some embodiments, the program also includes a determination instruction for obtaining the usage frequency of each usage scenario within a preset time period if the target scenario does not exist in the usage scenario; determining the priority of the thread corresponding to each usage scenario based on the size of the usage frequency; adding the corresponding usage scenario and priority to the head of the thread; and allocating system resources to the thread with the highest priority based on the priority corresponding to each thread.

[0135] In some embodiments, the program also includes optimization instructions for checking the storage status of the message queue of each target thread, and the storage status is normal or abnormal; according to the priority corresponding to each target thread, the message queue whose storage status is abnormal and whose corresponding target thread is the highest priority is optimized first, so that the message queue whose storage status is abnormal can be restored to normal.

[0136] In some embodiments, the optimization instruction is used to retrieve log information used to record the running status of the message queue; based on the log information, determine whether there is an event overflow in the message queue of each target thread, and if so, mark the storage status of the message queue with event overflow as a congestion type exception; or based on the log information, determine whether there is an event timeout and no response in the message queue of each target thread, and if so, mark the storage status of the message queue with event timeout and no response as a blocking type exception.

[0137] In some embodiments, when the storage state of the message queue is a congestion-type exception, the optimization process includes: increasing the queue depth of the message queue to improve the event storage capacity of the message queue.

[0138] In some embodiments, when the storage state of the message queue is a blocking exception, the optimization process includes: increasing the wireless bandwidth of the target thread to increase the speed at which the target thread transmits data.

[0139] In some embodiments, the program further includes processing instructions for reducing system resources occupied by non-target threads corresponding to non-target scenarios, or destroying non-target threads corresponding to the non-target scenarios.

[0140] The embodiment of the present application also provides an electronic device, which may be a smart phone, a television, a computer, or other device.

[0141] As can be seen from the above, the embodiment of the present application provides an electronic device 1200, and the electronic device 1200 performs the following steps:

[0142] When it is detected that the current load of the system exceeds a preset threshold, all current usage scenarios of the system are determined;

[0143] Check whether there is a target scenario defined as a high-frequency usage in the usage scenarios;

[0144] If the target scenario exists, checking the target threads corresponding to each target scenario and obtaining the priority pre-marked by each target thread;

[0145] According to the priorities corresponding to the target threads, system resources are preferentially allocated to the target threads with the highest priorities.

[0146] An embodiment of the present application further provides a storage medium, in which a computer program is stored. When the computer program runs on a computer, the computer executes the system resource control method described in any of the above embodiments.

[0147] It should be noted that, for the system resource control method described in the present application, ordinary testers in the field can understand that the whole or part of the process of implementing the system resource control method described in the embodiment of the present application can be completed by controlling the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, such as a memory of an electronic device, and executed by at least one processor in the electronic device, and the execution process may include the process of the embodiment of the system resource control method. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), etc.

[0148] For the system resource control device of the embodiment of the present application, each functional module can be integrated into a processing chip, or each module can exist physically separately, or two or more modules can be integrated into one module. The above-mentioned integrated module can 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 can also be stored in a computer-readable storage medium, such as a read-only memory, a disk or an optical disk.

[0149] The above is a detailed introduction to the system resource control method, device, medium and equipment provided in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core ideas of the present application; at the same time, for those skilled in the art, according to the ideas of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A system resource control method, characterized in that: include: When it is detected that the current load of the system exceeds a preset threshold, all current usage scenarios of the system are determined; Check whether there is a target scenario defined as a high-frequency usage in the usage scenarios; If the target scenario exists, checking the target threads corresponding to each target scenario and obtaining the priority pre-marked by each target thread; According to the priorities corresponding to the target threads, system resources are preferentially allocated to the target threads with the highest priorities.

2. The system resource control method according to claim 1, characterized in that: After checking whether there is a target scenario defined as a high-frequency usage in the usage scenarios, the method further includes: If the target scenario does not exist in the usage scenarios, obtaining the usage frequency of each usage scenario within a preset time period; Determining the priority of the thread corresponding to each usage scenario according to the frequency of use; Add the corresponding usage scenario and priority to the head of the thread; According to the priorities corresponding to the threads, system resources are preferentially allocated to the threads with the highest priorities.

3. The system resource control method according to claim 1, characterized in that: After obtaining the priority pre-marked by each target thread, the method further includes: Check the storage status of the message queue of each target thread, whether the storage status is normal or abnormal; According to the priorities corresponding to the target threads, the message queues whose storage status is abnormal and whose corresponding target threads have the highest priority are preferentially optimized, so that the message queues whose storage status is abnormal can be restored to normal.

4. The system resource control method according to claim 3, characterized in that: The checking the storage status of the message queue of each target thread includes: Retrieve the log information used to record the running status of the message queue; According to the log information, determine whether there is an event overflow in the message queue of each target thread, and if so, mark the storage state of the message queue with event overflow as a congestion type exception; or According to the log information, it is determined whether there is an event timeout and no response in the message queue of each target thread. If yes, the storage state of the message queue with the event timeout and no response is marked as a blocking exception.

5. The system resource control method according to claim 4, characterized in that: When the storage state of the message queue is abnormally congested, the optimization process includes: The queue depth of the message queue is increased to improve the event storage capacity of the message queue.

6. The system resource control method according to claim 4, characterized in that: When the storage state of the message queue is a blocking exception, the optimization process includes: The wireless bandwidth of the target thread is increased to improve the speed at which the target thread transmits data.

7. The system resource control method according to claim 1, characterized in that: After obtaining the priority pre-marked by each target thread, the method further includes: The system resources occupied by the non-target threads corresponding to the non-target scenarios are reduced, or the non-target threads corresponding to the non-target scenarios are destroyed.

8. A system resource control device, characterized in that: The system resource control device comprises: A detection module, used to determine all current usage scenarios of the system when it is detected that the current load of the system exceeds a preset threshold; A checking module is used to check whether there is a target scenario defined as a high-frequency usage in the usage scenarios; An acquisition module, configured to check the target threads corresponding to the target scenarios if the target scenarios exist, and acquire the priority pre-marked by the target threads; The allocation module is used to allocate system resources to the target thread with the highest priority according to the priorities corresponding to the target threads.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the system resource control method according to any one of claims 1 to 7.

10. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores a plurality of instructions, and the processor loads the instructions to execute the system resource regulation method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Computer resource allocation control method and system

    CN120929270A

  • A computer resource allocation control method and system

    CN120929270B