Method, apparatus and electronic device for resource scheduling
Patent Information
- Application Number
- CN202510237757.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-28
- Publication Date
- 2026-08-28
Smart Images

Figure CN122653804A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and more specifically, to methods, apparatus and electronic devices for resource scheduling. Background Technology
[0002] In a computer system, the operating system and various applications run simultaneously, competing for limited system resources, such as central processing unit (CPU) resources, memory resources, and disk input / output (I / O) resources. When system resource utilization is too high, it can lead to slow system response or even system crashes. To avoid this, it is usually necessary to schedule system resources in a timely manner when system resource utilization is high. Therefore, how to schedule system resources while ensuring a good user experience is an urgent problem to be solved. Summary of the Invention
[0003] This application provides a method, apparatus, and electronic device for resource scheduling, which can timely schedule the system resources of electronic devices while ensuring a good user experience, so as to reduce the system resource occupancy rate to a safe level and avoid slow system response or even crashes.
[0004] In a first aspect, a resource scheduling method is provided, the method comprising: in response to a system resource occupancy rate exceeding a first threshold, performing a resource scheduling operation, the resource scheduling operation comprising: dynamically adjusting the shutdown priority of multiple programs based on monitoring data of multiple programs, the monitoring data being used to represent the user's operation history on the programs; and shutting down at least one of the multiple programs based on the shutdown priority of the multiple programs.
[0005] In conjunction with the first aspect, in some implementations of the first aspect, the aforementioned monitoring data includes: the program's resource utilization rate, the program's runtime, the duration of the program's task execution, and whether the program was previously manually closed by the user; the closing priority of multiple programs is based on user configuration.
[0006] In conjunction with the first aspect, in some implementations of the first aspect, a first program set is determined, wherein the shutdown priority of N programs included in the first program set is greater than or equal to a first priority threshold, and N is greater than or equal to 0; the programs in the first program set are shut down.
[0007] In conjunction with the first aspect, in some implementations of the first aspect, if the system resource utilization rate is greater than the second threshold after closing the programs in the first program set, and the second threshold is less than or equal to the first threshold, a second program set is determined. The closing priority of the M programs included in the second program set is greater than or equal to the second priority threshold and less than the first priority threshold. At least one of the M programs is closed according to the order of their closing priorities.
[0008] In conjunction with the first aspect, in some implementations of the first aspect, the first program among the M programs includes L subroutines, where L is greater than 1. Based on the monitoring data of the L subroutines, the shutdown priority of the L subroutines is determined; and at least one of the L subroutines is shut down according to the order of their shutdown priorities.
[0009] In conjunction with the first aspect, in some implementations of the first aspect, if the system resource utilization rate is still greater than the second threshold after closing programs in the first and second program sets, a third program set is determined, wherein the closing priority of K programs in the third program set is less than the second priority threshold; the time period of the current day is determined, and J programs in the third program set that were closed in the time period of the current day in historical dates are determined; and first recommendation information is sent to recommend that the user close at least one of the J programs.
[0010] In conjunction with the first aspect, in some implementations of the first aspect, the aforementioned first recommendation information is determined based on a large model.
[0011] In conjunction with the first aspect, in some implementations of the first aspect, at least one program includes temporary data that is edited by the user but not saved, and the temporary data is saved before at least one of the multiple programs is closed.
[0012] In conjunction with the first aspect, in some implementations of the first aspect, receiving first instruction information, which is used to instruct the user to manually close the program, the resource scheduling operation further includes: sorting multiple programs according to their respective resource occupancy rates, and determining the sorting result; sending second recommendation information according to the sorting result, which is used to indicate H candidate programs, where H is greater than 1, and the resource occupancy rate of each of the H candidate programs is greater than or equal to the resource occupancy rate of the remaining programs among the multiple programs; receiving second instruction information, which is used to indicate at least one target program among the H candidate programs; and closing at least one target program according to the second instruction information.
[0013] Secondly, a resource scheduling apparatus is provided, including a module or unit for performing a method in any possible implementation of the method design in the first aspect.
[0014] Thirdly, a resource scheduling apparatus is provided, comprising a processor and a memory, wherein the processor and the memory are connected, wherein the memory is used to store program code, and the processor is used to call the program code to execute the method in any possible implementation of the method design of the first aspect above.
[0015] Fourthly, an electronic device is provided, including any of the resource scheduling apparatuses described in the second or third aspect above.
[0016] Fifthly, a computer-readable storage medium is provided storing a computer program that is executed by a processor to implement the method in any possible implementation of the method design of the first aspect.
[0017] In a sixth aspect, a computer program product is provided, including instructions that, when executed by a processor, cause a computer to perform any possible implementation of the method design of the first aspect described above. Attached Figure Description
[0018] Figure 1 This is a flowchart illustrating a resource scheduling method 100 proposed in an embodiment of this application;
[0019] Figure 2 This is a schematic diagram of a first operation interface proposed in an embodiment of this application;
[0020] Figure 3 This is a flowchart illustrating another resource scheduling method 300 proposed in an embodiment of this application;
[0021] Figure 4 This is a flowchart illustrating another resource scheduling method 400 proposed in an embodiment of this application;
[0022] Figure 5 This is a schematic block diagram of a resource scheduling device 500 provided in an embodiment of this application. Detailed Implementation
[0023] The technical solutions in this application will now be described with reference to the accompanying drawings.
[0024] This application will present various aspects, embodiments, or features relating to a system comprising multiple devices, components, modules, etc. It should be understood and appreciated that individual systems may include additional devices, components, modules, etc., and / or may not include all the devices, components, modules, etc. discussed in conjunction with the accompanying drawings. Furthermore, combinations of these approaches are also possible.
[0025] Furthermore, in the embodiments of this application, the words "exemplary," "for example," etc., are used to indicate that they are examples, illustrations, or descriptions. Any embodiment or design scheme described as "exemplary" in the embodiments of this application should not be construed as being better or more advantageous than other embodiments or design schemes. Specifically, the use of the term "exemplary" is intended to present the concept in a concrete manner.
[0026] The business scenarios described in the embodiments of this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided in the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new business scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0027] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0028] In this application embodiment, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.
[0029] In the daily operation of computer systems, the rational allocation and management of system resources are crucial to ensuring system stability and responsiveness. However, when system resource utilization is too high, it often leads to a series of performance problems, including but not limited to slow system response, operational lag, and even potentially system crashes. These problems not only severely impact the user experience but may also pose threats to business operations and data security.
[0030] To avoid the aforementioned adverse consequences caused by high system resource utilization, a series of resource scheduling strategies are typically employed at present. These strategies reduce resource contention through isolated resource allocation and adjustment, ensuring the normal operation of multiple processes running on the system while minimizing the total system resources consumed by these processes. For example, the system may use algorithms such as First Come First Served (FCFS), Shortest Job First (SJB), and Round Robin to schedule resources for multiple processes.
[0031] However, the aforementioned system resource scheduling algorithms all operate at the system level. The system will try its best to ensure that multiple processes can run normally, and under this premise, minimize the system resources consumed by multiple processes. However, for ordinary computer users, excessive system resource usage may be caused by the user opening too many applications without closing them.
[0032] The processes mentioned above are essentially the carriers of program execution. When a user opens an application, the operating system also opens corresponding processes for that application to run. Considering that users typically don't use a large number of applications simultaneously during normal computer use, some of the applications opened may be unnecessary. However, when considering high system resource usage from a system-level perspective, these factors are obviously not taken into account. Instead, resource scheduling methods are used to ensure that too many processes run normally, minimizing the risk of application crashes. In this scenario, the system-level resource scheduling method is less effective and may even conflict with user logic. For example, the system might reduce resource allocation to some processes, even though the applications these processes host might be important to the user's logic. This could lead to slow application response times and a poor user experience.
[0033] In view of this, embodiments of this application propose a method, apparatus, and electronic device for resource scheduling, which schedules system resources from the user level, thereby enabling timely scheduling of system resources of electronic devices while ensuring a good user experience, and avoiding slow system response or even system crashes.
[0034] Figure 1 This is a flowchart illustrating a resource scheduling method 100 proposed in an embodiment of this application.
[0035] This method 100 can be applied to electronic devices including operating systems, and this method 100 can be executed by the operating system, see reference. Figure 1 As shown, the method 100 includes the following steps:
[0036] S110: In response to the system resource utilization rate exceeding the first threshold, perform resource scheduling operation.
[0037] The system resources mentioned in this application embodiment may include: CPU resources, disk resources (including disk I / O resources), memory resources, etc.
[0038] In some possible embodiments, the first threshold may be a preset parameter, such as 80%; the first threshold may also be adaptively adjusted based on the hardware performance of the electronic device.
[0039] In some possible embodiments, the purpose of the above resource scheduling operation is to reduce the system resource utilization rate to a second threshold, which is less than or equal to the first threshold. The second threshold can also be a preset parameter, such as 70%, and the second threshold can also be adaptively adjusted based on the hardware performance of the electronic device.
[0040] In some possible embodiments, when the system resource utilization rate exceeds a first threshold, the system can proactively issue an alarm message to the user (e.g., presented in the form of a pop-up window or information bar in the user's graphical interface) to remind the user that the current system resource utilization rate exceeds the first threshold and that some programs need to be closed to release system resources.
[0041] When multiple programs are running in the system, the operating system can obtain the system resource utilization rate in real time. If the obtained resource utilization rate exceeds a first threshold, a resource scheduling operation can be automatically triggered as a response to the system resource utilization rate exceeding the first threshold. Therefore, this application embodiment proposes a detailed process for the resource scheduling operation, which may include the following operations:
[0042] S120: Based on monitoring data from multiple programs, dynamically adjust the shutdown priority of multiple programs. This monitoring data represents the user's operation history for the programs.
[0043] The aforementioned programs refer to the programs currently running on the system.
[0044] In some possible embodiments, the user's operation history for the program can reflect the user's usage of the program, which may include the program's resource usage, runtime, usage frequency, etc. Based on this, the monitoring data may include: the program's resource usage, runtime, duration of task execution, and whether the program was last manually closed by the user.
[0045] In some possible implementations, users can configure the system's built-in performance monitoring tool (e.g., perfmon) to control the collection of monitoring data for each program. These settings allow the system to collect specific monitoring data for each program, such as the aforementioned program resource utilization, runtime, task execution duration, and whether the program was manually closed by the user. Users can also set the data collection interval. These settings can be written to the corresponding logs of the performance monitoring tool, enabling the system to collect monitoring data for each program based on this performance monitoring data.
[0046] In some possible embodiments, user behavior in using programs can be analyzed and recorded, and this information can be used as part of the aforementioned monitoring data. For example, recording programs that the user manually closes when the system resource usage rate exceeds a first threshold, or the patterns of user program usage within a specific time period.
[0047] In some possible embodiments, the shutdown priority of the above-mentioned multiple programs refers to the fact that each program is defined with a shutdown priority. The higher the shutdown priority of a program, the more likely the program will be shut down when the system performs resource scheduling operations.
[0048] In some possible embodiments, the shutdown priority of the above-mentioned multiple programs can be configured during the system initialization phase. In order to realize that the shutdown priority of the multiple programs is defined from the user's perspective, the shutdown priority of the multiple programs can be based on user configuration.
[0049] In some possible embodiments, during the initial system initialization phase, the system categorizes its various programs into system programs and application programs. System programs are foundational programs used to manage, control, and support the operation of other programs. These include operating system programs, database management system programs, various service programs (such as diagnostic and debugging programs), and language programs (such as assemblers, compilers, and interpreters). Their main function is to provide system-level services, such as resource management, process scheduling, memory management, and device management, as well as support the development and operation of application programs. Application programs are programs designed to complete a specific task or type of task to meet user needs. Application programs typically have a visual user interface and can interact with the user.
[0050] After determining the categories to which multiple programs belong, the initial priority for closing them can be set, as system programs generally have a higher priority than applications. Therefore, based on their categories, the programs can be initially divided into two or more tiers, with system programs in the lowest tier and applications in the highest. Then, programs within each category can be sorted according to their system resource usage. For programs within the same tier, those with higher system resource usage have a higher priority for closing within that tier. Based on this, a preliminary list indicating the closing priority tiers for multiple programs can be output.
[0051] After determining the list of shutdown priority levels for the aforementioned programs, this list can be provided to the user. Based on the user's permission to modify the shutdown priority levels for the programs, and based on the user's final settings, the shutdown priority levels for the multiple programs can be determined.
[0052] In some possible embodiments, during the system initialization phase, the user can be directly instructed to set the shutdown priority level for multiple programs, without the system needing to perform preliminary settings for the shutdown priority level of multiple programs.
[0053] In some possible embodiments, the system can present a first operation interface to the user through a user graphical interface, and obtain the user's configuration of the closing priority of multiple programs by obtaining the operation information of some controls in the first operation interface.
[0054] Figure 2 This is a schematic diagram of a first operation interface proposed in an embodiment of this application.
[0055] refer to Figure 2 As shown, the first user interface may include an information list, which lists multiple programs on the system. This information list may include program names. Figure 2 Program 1 through Program 10 are used to refer to the names of the programs.
[0056] In some possible embodiments, the information list may also include other information about each program, such as the installation time, version information, function description, and category of each program, so that users can obtain more information about the program and thus assist users in setting a more reasonable priority level for closing.
[0057] Furthermore, the aforementioned first operation interface may also include a settings interface, which has selection control groups arranged at positions corresponding to each program name. These selection control groups include multiple virtual buttons for disabling priority levels, such as... Figure 2The diagram shows three priority levels for closing programs: A, B, and C. Each level corresponds to a virtual button. Level A has a lower priority than level B, and level B has a lower priority than level C. Therefore, programs in level C are less important to the user than those in level B, and programs in level B are less important than those in level A. The user's chosen priority level for a program can be determined by responding to the virtual button pressed in the selection control group.
[0058] For example, programs in category A may include system programs. These programs determine whether the system can function properly, so they are important for users to use the system normally. Therefore, the closing priority of these system programs should be the lowest. Of course, users can also be given permission to set system programs to category B or C.
[0059] For example, programs belonging to categories B and C can include applications that are only used to provide services to the user. Closing these programs will not cause the system to malfunction, so the closing priority for these applications should be relatively high. Then, applications belonging to category B and category C can be determined based on the user's specific settings; of course, users can also be granted permission to set applications to category A.
[0060] In some possible embodiments, the first operation interface described above may also include explanatory text, such as explaining the function of the selection control group, explaining the relationship between the closing priority levels A, B, and C, etc.
[0061] After determining the final shutdown priority levels for multiple programs as selected by the user, detailed shutdown priority settings can be configured for each program within each priority level based on the program's monitoring data. During this process, since the program's monitoring data is dynamically changing, the shutdown priority of each program within its respective priority level is dynamically adjusted, and there is a possibility that the program's shutdown priority level may increase or decrease.
[0062] Typically, users may open some programs but not actively close them, allowing them to run continuously in the background and consume system resources. These situations can be identified by analyzing program monitoring data. Therefore, when a program is identified as being in this situation, its closing priority can be dynamically set to be higher so that it can be closed first. In addition, since the aforementioned monitoring data may also include information such as the program's system resource usage, this information can also be used as a basis for dynamically adjusting the program's closing priority.
[0063] S130: Close at least one of the multiple programs according to their respective closing priorities.
[0064] The shutdown priority of the above-mentioned programs is the shutdown priority after dynamic adjustment based on the operation of S120.
[0065] In some possible embodiments, the system can close and / or recommend that users close the corresponding programs according to the closing priority order of the multiple programs and / or according to the closing priority level to which the multiple programs belong, so as to release system resources and make the system resource utilization rate lower than the second threshold.
[0066] Unlike existing technologies that schedule resources based on processes, Method 100 selects programs that are not important to users or are completely unimportant from the user's perspective and closes or recommends their closure. This can reduce system resource usage more simply and efficiently while ensuring the normal operation of the system and providing necessary services to users.
[0067] Based on the above technical solution, the closing priority of each program is dynamically adjusted according to the monitoring data of multiple programs in the system, and then the corresponding program is closed according to the closing priority of multiple programs. Since the monitoring data of the program is used to represent the user's operation history for the program, the operation of closing the program to release system resources is based on the user level. This allows for timely scheduling of the system resources of the electronic device while ensuring a good user experience, thus avoiding slow system response or even system crashes.
[0068] In some possible embodiments, the operational logic proposed in this application, based on the closing priorities of multiple programs, differs depending on whether the system has the permission to automatically close programs and whether the system does not. Whether the system has the permission to automatically close programs can be configured by the user.
[0069] The following is a detailed explanation of the process for closing programs on systems with automatic program shutdown permissions.
[0070] Figure 3 This is a flowchart illustrating another resource scheduling method 300 proposed in this application embodiment.
[0071] Method 300 can be understood as a detailed operation procedure of S130 in method 100, see reference. Figure 3 As shown, the method 300 includes the following operations:
[0072] S310: Determine a first program set, wherein the shutdown priority of the N programs included in the first program set is greater than or equal to a first priority threshold, and N is greater than or equal to 0.
[0073] For example, the first program set mentioned above may be a set of programs belonging to the highest priority level among multiple shutdown priority levels, such as level C in the aforementioned embodiment; thus, it can be seen that the programs included in the first program set are those that the user accesses through the user graphical interface (see reference). Figure 2 (As shown in the image) The configuration is based on the aforementioned basic mechanism of dynamically adjusting the closing priority of multiple programs. It can be seen that the programs in the first program set are relatively unimportant to the user.
[0074] S320: Close the program in the first program set.
[0075] Since the first set of programs is relatively unimportant to the user, the system can automatically close all programs in the first set, which can release the corresponding system resources without affecting the user's normal experience.
[0076] Based on the above program closing mechanism, since the programs in the first program set can be closed directly, after the user sets the program composition of the first program set, there is no need to configure the closing priority of the programs in the first program set in detail.
[0077] After closing the programs in the first program set, it can be determined whether the current system resource utilization rate is less than or equal to the second threshold. The second threshold is less than or equal to the first threshold. When the system resource utilization rate is less than or equal to the second threshold, the smooth operation of the system can be guaranteed. If it is determined that the current system resource utilization rate is less than or equal to the second threshold, it can be transferred to S330.
[0078] S330: Stop the automatic shutdown of the program.
[0079] When the system resource utilization rate is less than or equal to the second threshold, at least the smooth operation of the system can be guaranteed. When the system resource utilization rate is greater than the second threshold, the following operations can also be performed:
[0080] S340: Determine a second program set, which includes M programs whose shutdown priority is greater than or equal to a second priority threshold and less than a first priority threshold.
[0081] For example, the second program set mentioned above may correspond to the set of programs belonging to document B in the aforementioned embodiments; thus, it can be understood that the programs included in the second program set may also be programs that the user accesses through a user graphical interface (see reference). Figure 2 (As shown) the configuration.
[0082] S350: Close at least one of the M programs according to their respective shutdown priorities.
[0083] Based on the aforementioned basic mechanism for dynamically adjusting the closing priority of multiple programs, it can be seen that the programs in the second program set are relatively important to the user. If the programs in the second program set are closed randomly, the programs that the user is currently using may be closed, reducing the user experience. However, the closing priority of a program can represent the importance of that program to the user. Therefore, at least one of the M programs can be closed according to the order of their closing priorities.
[0084] The shutdown priority of each of the M programs can be determined by a scoring system.
[0085] In some possible embodiments, the M programs can be scored based on the monitoring data corresponding to the M programs, and the shutdown priority of the M programs can be determined according to the score. The higher the score of a program, the higher its shutdown priority.
[0086] For example, based on the foregoing embodiments, the monitoring data may include the program's resource utilization rate to allocate a score to the program; the higher the resource utilization rate, the higher the score. The monitoring data may also include the program's runtime and the duration of its task execution; based on these two pieces of information, the duration the program has been running but not used can be determined; the longer this duration, the higher the score. Furthermore, the monitoring data may include whether the program was previously manually closed by the user; if the program was previously manually closed by the user, additional points can be awarded to that program. Based on one or more of the aforementioned scoring criteria, the score of each program in the second program set can be determined, and based on the score of each program, the corresponding closing priority can be determined.
[0087] In some possible embodiments, programs or subroutines in the second program set can be closed sequentially according to the closing priority of the M programs. After closing the programs or subroutines, the system resource utilization rate can be obtained again. If it is determined that the system resource utilization rate is less than or equal to the second threshold, the process can proceed to S350.
[0088] However, if the system resource utilization rate is still greater than the second threshold after closing programs in the first and second program sets, the following operation can still be performed:
[0089] S360: Determine a third program set, which includes K programs whose shutdown priority is less than the second priority threshold.
[0090] For example, the aforementioned third program set may correspond to the set of programs belonging to section A in the foregoing embodiments; thus, it can be understood that the programs included in the third program set may also be programs that the user accesses through a user graphical interface (see reference). Figure 2 (As shown) the configuration.
[0091] S370: Determine the time period of the current day to which the current time belongs, and determine the J programs that are closed in the third program set within the time period of the current day in the historical dates.
[0092] The time period within a given day can include multiple time periods. For example, the first time period is 7:00-12:00, the second time period is 12:00-18:00, the third time period is 18:00-0:00, and the fourth time period is 0:00-7:00. Of course, other time period divisions are also possible; these four time periods are just examples.
[0093] Taking the above four time periods as an example, assuming the current time is 18:45 on XXXX year Y month Z day, then the time period mentioned at the current time is the third time period. Then, it can be determined that the programs in the third program set that are in a closed state within the third time period of at least one date (i.e., a historical date) before XXXX year Y month Z day can be identified.
[0094] S380: Send a first recommendation message, which recommends that the user close at least one of the J programs.
[0095] In some possible embodiments, the aforementioned first recommendation information can be determined based on a large model, whose inputs are user preferences, historical behavior, and other information, to trigger the large model's recommendation action, so that the system can provide personalized recommendations based on the user's interests and needs.
[0096] In some possible embodiments, monitoring data from various programs in the third program set over multiple days can be aggregated to calculate the user's daily usage duration, maximum usage duration, program interruption time, program startup time, and program shutdown time for each program. This information, along with the aforementioned daily time-segmentation results, is provided to the large model. The large model is then controlled to analyze this information to determine the user's program usage preferences. Consequently, the large model can determine which programs from the third program set the user should close at different times of the day when system resource utilization exceeds a first threshold. This serves as the output of the large model. Based on the output of the large model, the aforementioned first recommendation information can be determined.
[0097] Based on the above technical solution, multiple programs are divided into multiple program sets according to their respective priority ranges for closing. Each program set is assigned a different level of importance to the user. Then, different program closing strategies are applied to different program sets. While ensuring a good user experience on the electronic device, system resources are released to maintain the desired system resource utilization level, ensuring smooth system operation and preventing slow system response or even crashes.
[0098] In some possible embodiments, considering that some programs typically include multiple parallel subroutines, when closing such a program, at least one of the multiple parallel subroutines can be closed according to a certain closing priority order (this operation applies to the aforementioned second program set). The following describes the operation of closing subroutines in detail using the first program in the aforementioned second program set as an example. The first program includes L subroutines, where L is greater than 1. Based on this, the above S340 may also include the following operation:
[0099] S341: Determine the shutdown priority of each of the L subroutines based on the monitoring data of the L subroutines.
[0100] S342: Close at least one of the L subroutines according to their closing priorities.
[0101] To facilitate understanding, the following explanation uses a browser program as an example to illustrate the above operations in detail. When a browser program is running, multiple browser windows can be opened simultaneously, with each browser window acting as a subroutine of the browser program.
[0102] As can be seen from the foregoing embodiments, during browser program execution, monitoring data of the browser program can be obtained, and when multiple windows are opened in the browser program, monitoring data of multiple window subroutines can be obtained. Furthermore, since multiple windows in a browser program are used to browse multiple URLs of the same origin domain, these subroutines browsing the same origin domain will also establish associations. The closing priority of these subroutines can affect each other; for example, if the closing priority of one subroutine is increased, then the closing priority of the subroutines browsing the same origin domain will also be increased.
[0103] In some possible embodiments, for a browser program, the aforementioned time-related information about the browser program and its subroutines can be obtained through a performance timing interface as at least part of the monitoring data. This performance timing interface is a network performance application programming interface (API).
[0104] In some possible implementations, the performance time interface described above can record the time a user spends browsing the URLs corresponding to various domains based on the domain name. The domain name statistics rule is a combined statistics method, which uses regular expressions to match the corresponding domain names, dividing a complete domain name into a source part and an extension part. The source part, also called the main part or main domain, is, for example, in "http: / / www.example.com / search?q", "http: / / www.example.com" is the source part (although "www" is often considered a standard subdomain prefix for web services, it is not always necessary). The extension part, also called the top-level domain or domain suffix, is the last part of the domain name; for example, in "http: / / www.example.com / search?q", " / search?q" is the extension part. Based on this performance time interface, websites that match the source part can be combined for statistics, allowing for better analysis of user behavior and usage habits regarding browser programs and their subprograms.
[0105] Based on the above scenario, the information to be statistically analyzed based on the monitoring data may include: the runtime of the same-origin domain in the browser (including the runtime in the background), the duration of the user's browsing of the domain, the number of times the same-origin domain was accessed, and the number of times the domain was accessed. This information can be used to indicate the user's operation history of the browser program and its subprograms.
[0106] In some possible implementations, the runtime (time elapsed from the start of rendering to the end of closing the page) of web pages corresponding to multiple domains with the same origin can be summed to determine the runtime of the domains with the same origin in the browser. Similarly, the number of times multiple domains with the same origin are accessed can be summed to determine the number of times the domains with the same origin are accessed.
[0107] In some possible embodiments, when a user opens a sub-window of the browser to browse webpage A, the time when the user enters webpage A can be recorded in the background of the browser program. When the user jumps to webpage B, the time when the user enters webpage B can be recorded in the background of the browser program. By subtracting these two times, the time the user stayed on webpage A can be determined, that is, the duration of the user's browsing of the domain name corresponding to webpage A can be determined.
[0108] Alternatively, routing tools can be used to obtain the time a user spends on a particular webpage. Taking Vue components as an example, the time a user spends on a particular webpage can be obtained through global before hooks (such as `router.beforeEach`) and component destruction hooks (such as `destroyed`).
[0109] In some possible implementations, it can be deduced whether the user has finished browsing the website content by obtaining the number of pixels the current webpage has scrolled vertically and the page height of the browser window.
[0110] In some possible implementations, for a browser application, the closing priority of multiple subroutines under the browser application can be determined by classifying them as follows:
[0111] Determine the first set of subroutines, which includes multiple subroutines (i.e. web pages or windows) corresponding to the same-origin partial domains that have not been browsed for more than the first time period;
[0112] Determine a second set of subroutines, which includes multiple subroutines corresponding to the same domain name;
[0113] A third set of subroutines is determined, which includes multiple subroutines corresponding to domains that have not been browsed for more than the second time period, wherein the second time period is shorter than the first time period.
[0114] Among them, the shutdown priority of multiple subroutines belonging to the first subroutine set is greater than the shutdown priority of multiple subroutines belonging to the second subroutine set, and the shutdown priority of multiple subroutines belonging to the second subroutine set is greater than the shutdown priority of multiple subroutines belonging to the third subroutine set.
[0115] Based on the shutdown priorities of the above subroutines, the following subroutines shutdown strategy can be determined: First, shut down the subroutines in the first subroutines set. If the system resource utilization rate is still greater than the second threshold, then shut down the subroutines in the second subroutines set. If the system resource utilization rate is still greater than the second threshold, then shut down the subroutines in the third subroutines set.
[0116] After closing the entire set of subroutines, it means that the programs described by these multiple subroutines have completed the closing operation. If the system resource utilization rate is still greater than the second threshold, it is necessary to continue to close other programs.
[0117] Based on the above technical solution, when a program includes multiple subroutines, the priority of closing multiple subroutines can be determined based on monitoring data, and the closing operation can be performed on the subroutines. This achieves a more micro-level program closing mechanism, minimizing the impact on users' use of the program, and making the resource scheduling method more reasonable.
[0118] Considering that some programs generate unsaved temporary data based on user actions during runtime, to prevent the loss of this temporary data due to automatic program closure, if at least one program to be closed contains user-edited but unsaved temporary data, the following operation can be performed: save the aforementioned temporary data before closing at least one of the programs. Based on this, when the user reopens the program after it automatically closes, the program will retain the temporary data generated before the last closure.
[0119] Based on the above technical solution, the loss of temporary data generated by the user after the program is automatically closed can be effectively avoided, thereby improving the user experience.
[0120] If the user has not granted the system permission to automatically close programs, the system needs to recommend that the user close the specified programs in order to free up system resources and complete resource scheduling.
[0121] The following is a detailed explanation of the process for closing programs on systems that do not have automatic program shutdown permissions.
[0122] Figure 4 This is a flowchart illustrating another resource scheduling method 400 proposed in this application embodiment.
[0123] In some possible embodiments, before performing the above method 400, the following operation is also performed: receiving first instruction information, which is used to instruct the user to manually close the program, and the first instruction information may be the user's configuration information for the system's permission to automatically close the program.
[0124] Upon receiving the aforementioned first instruction, and if the system resource occupancy rate exceeds the first threshold, the system can execute method 400 to perform resource scheduling. (Reference) Figure 4 As shown, the method 400 includes the following steps:
[0125] S410: Sort multiple programs according to their respective resource utilization rates and determine the sorting result.
[0126] S420: Based on the ranking results, send the second recommendation information. The second recommendation information is used to indicate H candidate programs, where H is greater than 1, and the resource utilization rate of each of the H candidate programs is greater than or equal to the resource utilization rate of the remaining programs among the multiple programs.
[0127] For example, the value of H above can be a pre-configured parameter, such as 20. Assuming there are currently 50 programs running, after sorting the multiple programs according to their respective resource utilization rates, and determining the sorting results, it is possible to further identify the top 20 programs with the highest resource utilization rates among these 50 programs, thereby identifying these 20 programs as candidate programs, and determining and sending the aforementioned second recommendation information.
[0128] S430: Receive second instruction information, which is used to indicate at least one target program among H candidate programs.
[0129] S440: Based on the second instruction information, shut down at least one target program.
[0130] Based on the above technical solution, users are given the option to manually close programs to free up system resources, making the entire process of closing programs more in line with user needs and thus improving the user experience.
[0131] Furthermore, embodiments of this application also provide an apparatus for implementing any of the above methods. For example, an apparatus for resource scheduling is provided, which includes units (or means) for implementing any of the above resource scheduling methods.
[0132] Figure 5 This is a schematic block diagram of a resource scheduling apparatus 500 provided in an embodiment of this application. The resource scheduling apparatus 500 includes:
[0133] The execution unit 510 is used to perform resource scheduling operations in response to the system resource utilization rate exceeding a first threshold.
[0134] The execution unit 510 includes a processing unit 511, which is used to dynamically adjust the closing priority of multiple programs based on monitoring data of multiple programs. The monitoring data is used to represent the user's operation history for the programs.
[0135] The execution unit 510 further includes an operation unit 512, which is used to close at least one of the multiple programs according to the closing priority of the multiple programs.
[0136] In some possible embodiments, the monitoring data mentioned above includes: the program's resource utilization rate, the program's runtime, the duration of the program's task execution, and whether the program was last manually closed by the user; the closing priority of multiple programs is based on user configuration.
[0137] In some possible embodiments, the above-described operation unit 512 is specifically used to: determine a first program set, wherein the closing priority of N programs included in the first program set is greater than or equal to a first priority threshold, and N is greater than or equal to 0; and close the programs in the first program set.
[0138] In some possible embodiments, if the system resource utilization rate is greater than a second threshold after closing programs in the first program set, and the second threshold is less than or equal to the first threshold, the operation unit 512 is specifically used to: determine the second program set, wherein the closing priority of the M programs included in the second program set is greater than or equal to the second priority threshold and less than the first priority threshold; and close at least one of the M programs according to the order of their closing priorities.
[0139] In some possible embodiments, the first program among the M programs includes L subroutines, where L is greater than 1. The processing unit 511 is further configured to: determine the shutdown priority of the L subroutines based on the monitoring data of the L subroutines; the operation unit 512 is further configured to: shut down at least one of the L subroutines according to the order of the shutdown priorities of the L subroutines.
[0140] In some possible embodiments, if the system resource utilization rate is still greater than the second threshold after closing programs in the first program set and the second program set, the above-mentioned operation unit 512 is specifically used to: determine a third program set, wherein the closing priority of K programs included in the third program set is less than the second priority threshold; determine the time period of the current day to which the current time belongs, and determine J programs in the third program set that have been closed in the time period of the current day in historical dates; and send first recommendation information, which is used to recommend that the user close at least one of the J programs.
[0141] In some possible implementations, the first recommendation information is determined based on a large model.
[0142] In some possible embodiments, if the above-mentioned at least one program includes temporary data that is edited by the user and not saved, the above-mentioned operation unit 512 is further configured to: save the temporary data before closing at least one of the multiple programs.
[0143] In some possible embodiments, the operation unit 512 is further configured to: receive first instruction information, which instructs the user to manually close the program; the processing unit 511 is specifically configured to: sort the multiple programs according to their respective resource occupancy rates and determine the sorting result; the operation unit 512 is specifically configured to: send second recommendation information according to the sorting result, which instructs H candidate programs, where H is greater than 1, and the resource occupancy rates of the H candidate programs are greater than or equal to the resource occupancy rates of the remaining programs among the multiple programs; receive second instruction information, which instructs at least one target program among the H candidate programs; and close at least one target program according to the second instruction information.
[0144] Furthermore, this application also proposes another resource scheduling apparatus, which includes a processor and a memory connected together. The memory is used to store program code, and the processor is used to call the program code to execute any of the resource scheduling methods proposed in this application.
[0145] This application also proposes an electronic device, which includes any of the resource scheduling devices proposed in this application.
[0146] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0147] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0148] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0149] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0150] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0151] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0152] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A resource scheduling method, characterized in that, The method includes: In response to the system resource utilization rate exceeding a first threshold, a resource scheduling operation is performed, the resource scheduling operation including: Based on monitoring data from multiple programs, the closing priority of the multiple programs is dynamically adjusted, and the monitoring data is used to represent the user's operation history for the programs; Based on the shutdown priority of the plurality of programs, at least one of the plurality of programs is shut down.
2. The method according to claim 1, characterized in that, The monitoring data includes: the program's resource utilization rate, the program's runtime, the duration of the program's task execution, and whether the program was manually closed by the user last time; the closing priority of the multiple programs is based on user configuration.
3. The method according to claim 1 or 2, characterized in that, The step of closing at least one of the plurality of programs according to their respective closing priorities includes: A first program set is determined, wherein the shutdown priority of N programs included in the first program set is greater than or equal to a first priority threshold, and N is greater than or equal to 0; Close the programs in the first set of programs.
4. The method according to claim 3, characterized in that, After closing programs in the first program set, if the system resource utilization rate is greater than a second threshold, and the second threshold is less than or equal to the first threshold, closing at least one program among the multiple programs according to their respective closing priorities further includes: Determine a second program set, wherein the shutdown priority of the M programs included in the second program set is greater than or equal to a second priority threshold and less than a first priority threshold; Close at least one of the M programs according to their respective shutdown priorities.
5. The method according to claim 4, characterized in that, The first program of the M programs includes L subroutines, where L is greater than 1, and the method further includes: Based on the monitoring data of the L subroutines, determine the shutdown priority of the L subroutines; Close at least one of the L subroutines according to their respective shutdown priorities.
6. The method according to claim 4 or 5, characterized in that, If, after closing programs in the first program set and the second program set, the system resource utilization rate is still greater than the second threshold, closing at least one program among the multiple programs according to their closing priorities further includes: A third program set is determined, wherein the shutdown priority of the K programs included in the third program set is less than the second priority threshold; Determine the time period of the current day to which the current moment belongs, and determine the J programs that are closed in the third program set within the time period of the current day in the historical dates; Send a first recommendation message, which is used to recommend that the user close at least one of the J programs.
7. The method according to claim 6, characterized in that, The first recommendation information is determined based on a large model.
8. The method according to any one of claims 1 to 7, characterized in that, The at least one program includes temporary data that has been edited by the user but not saved. Before closing at least one of the multiple programs, the method further includes: Save the temporary data.
9. The method according to any one of claims 1 to 8, characterized in that, The method further includes: Receive a first instruction message, which instructs the user to manually close the program. The resource scheduling operation further includes: The programs are sorted according to their respective resource utilization rates to determine the sorting result; Based on the sorting result, a second recommendation information is sent. The second recommendation information is used to indicate H candidate programs, where H is greater than 1, and the resource utilization rate of each of the H candidate programs is greater than or equal to the resource utilization rate of the remaining programs among the plurality of programs. Receive second indication information, the second indication information being used to indicate at least one target program among the H candidate programs; According to the second instruction information, shut down the at least one target program.
10. A resource scheduling apparatus, characterized in that, Includes modules or units for performing the method as described in any one of claims 1 to 9.
11. A resource scheduling apparatus, characterized in that, It includes a processor and a memory, wherein the processor and the memory are connected, wherein the memory is used to store program code, and the processor is used to call the program code to perform the method as described in any one of claims 1 to 9.
12. An electronic device, characterized in that, Includes the apparatus as described in claim 10 or 11.
13. A computer-readable storage medium, characterized in that, It stores instructions that, when executed by a processor, cause the processor to implement the method as described in any one of claims 1 to 9.