Method and device for deciding execution sequence of starting task, computer device and medium
By constructing a decision forest and determining the optimal execution order based on weights, the problem of cumbersome and inconvenient maintenance of task startup optimization in existing technologies is solved, thereby improving terminal startup speed and efficient utilization of system resources.
Patent Information
- Application Number
- CN202011286335.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-17
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2040-11-17
AI Technical Summary
Optimizing startup tasks in existing technologies is cumbersome and difficult to maintain, especially when new tasks are added, requiring re-analysis and optimization, which affects the terminal startup speed.
By acquiring the permutation and combination order of all startup tasks, collecting startup data, constructing a decision forest, calculating the runtime ratio, and determining the optimal execution order based on the weights, the optimal task execution order is automatically analyzed using the node weights in the decision forest.
It reduced maintenance workload, improved startup speed, and increased the utilization rate of system resources.
Smart Images

Figure CN112328381B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of base station operation and maintenance, and particularly relates to a decision method and device for starting task execution sequence, computer equipment and a medium. BACKGROUND
[0002] At present, the use of terminals is more and more extensive, the types of programs are increasingly rich, and the number of tasks that need to be run during startup is gradually increasing, which will affect the startup speed of the application program on the terminal. The startup speed is an important factor affecting user experience, so the execution of this part of the task is monitored and scheduled to improve the startup speed.
[0003] The existing startup task scheduling framework generally only monitors the execution time of the task. To reduce the time consumed by startup, the developer needs to analyze the startup task one by one, disassembles, delays, and parallelizes each startup task, optimizes the startup task execution sequence to reduce the execution time, and the work is very tedious. When a new startup task is added, it needs to be reanalyzed and optimized, which is not convenient for maintenance. SUMMARY
[0004] The purpose of the embodiments of the present application is to provide a decision method and device for starting task execution sequence, computer equipment and a medium to solve the problem of tedious optimization of startup tasks and inconvenient maintenance in related technologies.
[0005] In order to solve the above technical problems, the embodiments of the present application provide a decision method for starting task execution sequence, which adopts the following technical solutions:
[0006] All startup tasks are obtained, and all execution sequences of the startup tasks are obtained in a permutation and combination manner;
[0007] The startup tasks are executed multiple times according to the execution sequence within a preset time, and corresponding startup data is collected;
[0008] A decision forest is constructed according to the execution sequence, and a runtime length ratio of the startup tasks corresponding to all nodes in the decision forest is calculated based on the startup data;
[0009] The runtime length ratio of the startup tasks corresponding to each layer of nodes in the decision forest is compared, and a value is assigned to the nodes according to a preset rule; and
[0010] The optimal execution sequence of the startup tasks is determined according to the value assigned to the nodes.
[0011] Further, the step of calculating the runtime length ratio of the startup tasks corresponding to all nodes in the decision forest based on the startup data comprises:
[0012] randomly taking out a preset number of start-up data;
[0013] calculating a running time ratio of each start-up task in a corresponding execution sequence according to the start-up data and saving the running time ratio;
[0014] after traversing the preset number of start-up data, statistically analyzing the running time ratio of each start-up task;
[0015] if there are multiple running time ratios of start-up tasks in the same node in the decision forest, calculating an average value of the multiple running time ratios of the start-up tasks and taking the average value as a final running time ratio of the start-up task corresponding to the node.
[0016] Further, the step of calculating a running time ratio of each start-up task in a corresponding execution sequence according to the start-up data comprises:
[0017] obtaining a total time length of each execution sequence and an execution time length of each start-up task in a corresponding execution sequence from the start-up data;
[0018] dividing the total time length by the execution time length to obtain the running time ratio of the start-up task.
[0019] Further, the step of comparing the running time ratio of the start-up task corresponding to each node in each layer in the decision forest and assigning a value to the node according to a preset rule comprises:
[0020] comparing the running time ratios of all start-up tasks in the top node, and assigning a preset value to the top node corresponding to the start-up task with the maximum running time ratio;
[0021] comparing the running time ratios of the start-up tasks of each node under the top node in turn until the last layer of leaf nodes, and assigning the preset value to the node with the maximum running time ratio in each layer.
[0022] Further, the step of assigning a preset value to the top node corresponding to the start-up task with the maximum running time ratio comprises:
[0023] obtaining an initial value of the top node with the maximum running time ratio;
[0024] adding one to the value of the top node with the maximum running time ratio.
[0025] Further, the step of assigning the preset value to the node with the maximum running time ratio in each layer is followed by:
[0026] extracting a next batch of preset number of start-up data;
[0027] comparing the running time ratios of the start-up tasks of each node in turn according to the next batch of preset number of start-up data.
[0028] The weight of the node corresponding to the start task with the maximum running time ratio is added by one until all start data collected within the preset time is processed.
[0029] Further, the step of determining the optimal execution order of the start task according to the weight given to the node comprises:
[0030] determining the vertex node with the maximum weight;
[0031] starting from the vertex node with the maximum weight, traversing the node with the maximum weight in each layer to the last layer leaf node to obtain the optimal execution order.
[0032] To solve the above technical problems, the embodiment of the application further provides a start task execution order decision device, which adopts the following technical scheme:
[0033] an acquisition module configured to acquire all start tasks and obtain all execution orders of the start tasks in a permutation and combination manner;
[0034] an execution module configured to execute the start tasks according to the execution orders multiple times within a preset time and collect corresponding start data;
[0035] a calculation module configured to construct a decision forest according to the execution orders and calculate running time ratios of start tasks corresponding to all nodes in the decision forest based on the start data;
[0036] a comparison module configured to compare the running time ratios of start tasks corresponding to each layer of nodes in the decision forest and give weights to the nodes according to a preset rule; and
[0037] a determination module configured to determine an optimal execution order of the start tasks according to the weights given to the nodes.
[0038] To solve the above technical problems, the embodiment of the application further provides a computer device, which adopts the following technical scheme:
[0039] The computer device comprises a memory and a processor, the memory stores computer readable instructions, and the processor implements the steps of the start task execution order decision method as described above when executing the computer readable instructions.
[0040] To solve the above technical problems, the embodiment of the application further provides a computer readable storage medium, which adopts the following technical scheme:
[0041] The computer readable storage medium stores computer readable instructions, which are executed by the processor to implement the steps of the decision method for starting task execution sequence.
[0042] Compared with the prior art, the embodiments of the application have the following beneficial effects:
[0043] The application obtains all starting tasks, and obtains all execution sequences of the starting tasks in a permutation and combination manner. The starting tasks are executed according to the execution sequences for multiple times within a preset time, and corresponding starting data is collected. A decision forest is constructed according to the execution sequences, and a runtime ratio of the starting tasks corresponding to all nodes in the decision forest is calculated based on the starting data. The runtime ratio of the starting tasks corresponding to each layer node in the decision forest is compared, and a weight value is assigned to the node according to a preset rule. The optimal execution sequence of the starting tasks is determined according to the weight value assigned to the node. The application can reduce workload and facilitate maintenance by collecting starting data of all execution sequences of the starting tasks and determining the optimal execution sequence based on the starting data. In addition, the starting speed can be further improved based on automatic analysis, thereby improving the utilization rate of system resources. BRIEF DESCRIPTION OF DRAWINGS
[0044] In order to more clearly illustrate the schemes in the application, the drawings needed in the description of the embodiments of the application will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative labor.
[0045] Figure 1 is an exemplary system architecture diagram in which the application can be applied;
[0046] Figure 2 Flow chart of an embodiment of the decision method for starting task execution sequence according to the application;
[0047] Figure 3 is a decision forest structure diagram of an embodiment of the decision method for starting task execution sequence according to the application;
[0048] Figure 4 is Figure 2 is a flow chart of a specific implementation of step S203 in
[0049] Figure 5 is a structure diagram of an embodiment of the decision device for starting task execution sequence according to the application;
[0050] Figure 6 is a structure diagram of an embodiment of the computer device according to the application. DETAILED DESCRIPTION
[0051] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description herein is for describing particular embodiments only and is not intended to be limiting of the application; the use herein of terms such as "comprise" and "have" and any variations such as "comprises" and "has" is intended to cover the presence of successively additional features, integers, steps, operations, objects, components, activities, or functions to those which have been described in the specification and drawings, but does not preclude the presence or addition of one or more other features, integers, steps, operations, objects, components, activities, functions, or groups thereof. The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application.
[0052] Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase "in an embodiment" in various places in the specification are not necessarily all referring to the same embodiment, nor are they necessarily all referring to a common set of embodiments.
[0053] In order to better understand the technical solutions of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0054] In order to solve the problems of complicated and inconvenient maintenance of the optimization of starting tasks in the related art, the present application provides a decision method for the execution sequence of starting tasks, which can be applied to, for example Figure 1 As shown in the system architecture 100, the system architecture 100 can include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used to provide a communication link medium between the terminal devices 101, 102, 103 and the server 105. The network 104 can include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0055] The user can use the terminal devices 101, 102, 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications can be installed on the terminal devices 101, 102, 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0056] The terminal devices 101, 102, and 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 (Moving Picture Experts Group Audio Layer III) players, MP4 (Moving Picture Experts Group Audio Layer IV) players, laptop computers, desktop computers, and the like.
[0057] The server 105 can be a server providing various services, such as a background server providing support for a page displayed on the terminal devices 101, 102, and 103.
[0058] It should be noted that the method for deciding the execution sequence of the startup tasks provided in the embodiments of the present application is generally executed by the terminal device, and accordingly, the device for deciding the execution sequence of the startup tasks is generally arranged in the terminal device.
[0059] It should be understood that Figure 1 The number of terminal devices, networks, and servers in
[0060] With reference to Figure 2 , a flow chart of one embodiment of the method for deciding the execution sequence of the startup tasks according to the present application is shown, including the following steps:
[0061] In step S201, all startup tasks are obtained, and the execution sequences of the startup tasks are obtained in a permutation and combination manner.
[0062] In the terminal startup process, initialization codes of various functional modules need to be executed, which are referred to as initialization tasks. The execution of the initialization tasks will affect the startup speed of the terminal, and the initialization tasks are the startup tasks. In order to improve the startup speed, the startup tasks need to be monitored and scheduled.
[0063] In the present embodiment, all startup tasks are obtained, and the execution sequences of the startup tasks are obtained in a combination manner; for example, assuming that there are three startup tasks A, B, and C, six combination forms are obtained in a permutation and combination manner, namely, ABC, ACB, BAC, BCA, CAB, and CBA, which are the execution sequences of the startup tasks.
[0064] In step S202, the startup tasks are executed multiple times in the execution sequences within a preset time, and corresponding startup data is collected.
[0065] In the embodiment, the collection of the startup data is performed online, and the preset time can be a gray scale stage of the product or a certain period after the product is online.
[0066] The gray scale stage is a period from the beginning to the end of the gray scale release. The gray scale release refers to a release mode capable of smooth transition between black and white. For an Internet product, online and offline are black and white, and a mode for realizing smooth transition of offline functions is called gray scale release.
[0067] The startup data includes, but is not limited to, an execution order, an execution duration, and a total startup duration. The execution duration is a duration required for completing execution of each startup task, and the total startup duration is a duration required for completing execution of all startup tasks according to a certain execution order. In the preset time, the execution order of each combination is executed many times to obtain many pieces of corresponding startup data. The data is collected and reported to a background server.
[0068] It should be emphasized that, in order to further ensure the privacy and security of the startup data, the startup data can also be stored in a node of a block chain.
[0069] The block chain referred to in the application is a new application mode of distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, and other computer technologies. The block chain is essentially a decentralized database, which is a series of data blocks associated using cryptographic methods. Each data block contains information of a batch of network transactions, and is used to verify the validity (anti-fake) of the information and generate the next block. The block chain can include a block chain underlying platform, a platform product service layer, and an application service layer.
[0070] In step S203, a decision forest is constructed according to the execution order, and a runtime duration ratio of a startup task corresponding to each node in the decision forest is calculated based on the startup data.
[0071] For example, assuming that there are three startup tasks A, B, and C, six execution orders ABC, ACB, BAC, BCA, CAB, and CBA are obtained in a permutation and combination manner, and a decision forest is constructed according to the execution order as shown in Figure 3 .
[0072] The decision forest is composed of decision trees, and the decision trees include three nodes, a top node, an internal node, and a leaf node. The top node is the topmost node of the decision tree. The internal node is a node in the middle of the decision tree. The leaf node is the bottommost node of the decision tree. See Figure 3As shown, the decision forest is composed of three decision trees with top nodes respectively representing task A, task B and task C, each node in the decision forest represents a start task, and the branches of the decision tree represent the start tasks to be executed subsequently, and each execution sequence is a path from a top node to a leaf node.
[0073] In some optional implementations of the embodiment, referring to Figure 4 As shown, the step of calculating the runtime length ratio of the start task corresponding to each node in the decision forest based on the start data specifically includes:
[0074] Step S401, randomly take out a preset number of start data.
[0075] It should be understood that in the preset time, there will be multiple start data for each execution sequence, assuming that there are n paths for all tasks, in order to cover as many execution sequences as possible, 3*n start data can be randomly taken out.
[0076] It should be noted that the taking out is without replacement, and in the preset time, many start data of all execution sequences of the start task will be collected, and each time a part of the start data is taken out without replacement until the processing of all start data is completed, so that the optimal execution sequence can be obtained as much as possible.
[0077] Step S402, calculate the runtime length ratio of each start task in the corresponding execution sequence according to the start data and save it.
[0078] Specifically, the total start time of each execution sequence and the execution time of each start task in the corresponding execution sequence are obtained from the collected start data, and the runtime length ratio of the corresponding start task is obtained by dividing the total start time by the execution time.
[0079] In this way, all execution sequences can be covered to the greatest extent, and the length of time for executing the start task can be determined more accurately. The longer the runtime length ratio, the shorter the time for executing the start task, and vice versa. The shorter the runtime length ratio, the longer the time for executing the start task.
[0080] Step S403, after traversing the preset number of start data, statistically analyze the runtime length ratio of each start task.
[0081] It should be understood that among the 3*n start data randomly taken out, there will be start data with the same execution sequence, i.e. multiple start data of the same path, and the runtime length ratio of each start task in each start data is calculated.
[0082] For example, assuming that there are two starting tasks A and B, there are two execution sequences, i.e., path 1: A→B and path 2: B→A, n is 2, and six starting data are randomly taken out, the six starting data can include four starting data of path 1 and two starting data of path 2, or three starting data of path 1 and three starting data of path 2.
[0083] In step S404, if there are multiple runtime length ratios of starting tasks in the same node in the decision forest, an average value of the multiple runtime length ratios of the starting tasks is calculated, and the average value is taken as a final runtime length ratio of the starting task corresponding to the node.
[0084] For example, there are four starting data of path 1: A→B, and there are four runtime length ratios corresponding to node A, and an average value of the four runtime length ratios is taken as a final runtime length ratio of the starting task corresponding to node A.
[0085] In step S204, the runtime length ratios of the starting tasks corresponding to each node in each layer in the decision forest are compared, and a preset weight value is assigned to the node according to a preset rule.
[0086] In this embodiment, the preset rule is to compare the runtime length ratios of the nodes in each layer in the decision forest, and a preset weight value is assigned to the node with the maximum runtime length ratio in each layer.
[0087] Specifically, first, the runtime length ratios of all starting tasks in the top node in the decision forest are compared, and a preset weight value is assigned to the top node corresponding to the starting task with the maximum runtime length ratio; the runtime length ratios of the starting tasks of each node in the next layer are compared in turn until the last layer, i.e., the leaf node, and a preset weight value is assigned to the node with the maximum runtime length ratio in each layer, i.e., the runtime length ratios of all starting tasks in the internal node in the second layer are compared, and a preset weight value is assigned to the internal node corresponding to the starting task with the maximum runtime length ratio in the internal node in the second layer, and the above steps are repeatedly performed until the last layer, i.e., the leaf node.
[0088] In this embodiment, the execution sequence of each starting task can be determined simply and intuitively through the assigned weight value.
[0089] The factors affecting the total start-up time mainly include CPU (Central Processing Unit), terminal storage settings, and the current running environment. The CPU mainly affects the tasks with high computation intensity. The terminal storage settings mainly affect the tasks of reading and saving data to the device, i.e., the tasks with high IO intensity. The current running environment of the terminal also has an impact, for example, many application programs are installed, and many background tasks are running, which can all prolong the total start-up time. Different models of terminals have different CPUs and terminal storage settings. Therefore, for the same model of terminal, the running time ratios of the start-up tasks corresponding to each node in the decision forest are compared, and the nodes are assigned preset weights according to preset rules, and then the above steps can be repeated for different models of terminals.
[0090] In some optional implementations, the node with the largest running time ratio in each layer of nodes is assigned a weight, specifically, the initial weight of the node with the largest running time ratio is obtained, and the weight of the node with the largest running time ratio is incremented by one, and the weights of the nodes with the largest running time ratio in each layer of nodes below the node are incremented by one. This way is simple and convenient to operate.
[0091] It should be noted that the initial weight of each node is set to 0, and the actual weight of each node is obtained by subsequent calculation.
[0092] The Monte Carlo algorithm is mainly used in the present application. The Monte Carlo algorithm is a statistical simulation method based on probability and statistics theory, that is, the more times a start-up task appears in an execution sequence with a shorter total start-up time, the higher the probability that the execution time of the start-up task in the execution sequence is the shortest. In the present embodiment, the weight of a node represents the probability, that is, the greater the weight of a node, the more likely the execution time of the start-up task corresponding to the node in the execution sequence is the shortest.
[0093] In order to find the optimal execution sequence of the start-up tasks, as many start-up data as possible should be taken. Therefore, in some optional implementations, after processing all the start-up data of the preset number randomly taken, the next batch of start-up data of the preset number is randomly taken without replacement, and the steps S402 to S403 are repeated, and the running time ratios of the start-up tasks of each layer of nodes from the root node to the leaf nodes are compared, and the weight of the node corresponding to the start-up task with the largest running time ratio in each layer of nodes is incremented by one.
[0094] The above steps are repeated until the start-up data collected within the preset time is processed. In this way, the execution sequence in which the start-up task with the shortest execution time is located can be obtained as much as possible, which is beneficial to improving the start-up speed.
[0095] In step S205, the optimal execution sequence of the start-up tasks is determined according to the weights assigned to the nodes.
[0096] Specifically, the node with the largest weight value is determined, and starting from the node with the largest weight value, the node with the largest weight value in each layer is traversed to the last layer of leaf nodes to obtain an optimal execution order.
[0097] In the embodiment, the larger the weight value is, the more statistically represents that the total start-up duration of the start-up task tends to be the least when the execution order is executed, and thus as long as starting from the top node and traversing the node with a large weight value to the leaf node, a statistically optimal task execution order can be obtained.
[0098] The application can reduce the workload, facilitate maintenance, and further improve the start-up speed based on automatic analysis, thereby improving the use rate of system resources.
[0099] The application can be used in many general or specific computer system environments or configurations. For example: personal computers, server computers, handheld devices or portable devices, tablet devices, multi-processor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The application can also be practiced in a distributed computing environment in which tasks are performed by remote processing devices connected by a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media, including storage devices.
[0100] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by computer-readable instructions instructing related hardware, and the computer-readable instructions can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the above-mentioned embodiments. The storage medium can be a non-volatile storage medium such as a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0101] It should be understood that, although each step in the flowchart of the accompanying drawings is shown in sequence according to the direction of the arrow, these steps are not necessarily executed in sequence according to the direction of the arrow. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and they can be executed in other sequences. Moreover, at least part of the steps in the flowchart of the accompanying drawings can include multiple sub-steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence is not necessarily sequential, but can be alternately executed with at least part of other steps or sub-steps or stages of other steps.
[0102] Further referring to Figure 5 , as an implementation of the method shown in the above Figure 2 , the present application provides an embodiment of a decision device for starting task execution sequence, which corresponds to the method embodiment shown in Figure 2 , and the device can be applied to various electronic devices.
[0103] As shown in Figure 5 , the decision device for starting task execution sequence 500 comprises an acquisition module 501, an execution module 502, a calculation module 503, a comparison module 504 and a determination module 505. Wherein:
[0104] The acquisition module 501 is configured to acquire all starting tasks and obtain all execution sequences of the starting tasks in a permutation and combination manner;
[0105] The execution module 502 is configured to execute the starting tasks according to the execution sequences multiple times within a preset time, and collect corresponding starting data;
[0106] The calculation module 503 is configured to construct a decision forest according to the execution sequences, and calculate a runtime ratio of the starting tasks corresponding to all nodes in the decision forest based on the starting data;
[0107] The comparison module 504 is configured to compare the runtime ratio of the starting tasks corresponding to each layer of nodes in the decision forest, and assign a weight value to the nodes according to a preset rule;
[0108] The determination module 505 is configured to determine an optimal execution sequence of the starting tasks according to the weight value assigned to the nodes.
[0109] It should be emphasized that, in order to further ensure the privacy and security of the above-mentioned starting data, the above-mentioned starting data can also be stored in a node of a block chain.
[0110] In the embodiment, by collecting all start data of all start task execution sequences, the optimal execution sequence is determined based on the start data, workload is reduced, maintenance is facilitated, and the system resource usage is improved by further improving the start speed based on automatic analysis.
[0111] In some optional implementations of the embodiment, the execution module 502 includes a taking sub-module and a calculating sub-module. The taking sub-module is configured to randomly take out a preset number of start data. The calculating sub-module is configured to calculate and save a running time ratio of each start task in a corresponding execution sequence according to the start data, and after the preset number of start data is traversed, the running time ratio of each start task is statistically analyzed. If there are multiple running time ratios of start tasks in a same node of the decision forest, an average value of the multiple running time ratios of the start tasks is calculated, and the average value is taken as a final running time ratio of the start task corresponding to the node.
[0112] In this way, all execution sequences can be covered to the greatest extent, and the time length of executing the start task can be determined more accurately.
[0113] In the embodiment, the calculating sub-module is further configured to obtain a total time length of each execution sequence and an execution time length of each start task in a corresponding execution sequence from the start data, and divide the total time length by the execution time length to obtain the running time ratio of the start task.
[0114] In this way, the calculation manner of the running time ratio can be determined.
[0115] In some optional implementations of the embodiment, the comparing module 504 is further configured to compare the running time ratios of all start tasks in the vertex node, assign a preset weight value to a vertex node corresponding to a start task with the largest running time ratio, compare the running time ratios of start tasks of each layer node under the vertex node in sequence, and assign the preset weight value to a node with the largest running time ratio in each layer until a leaf node in the last layer.
[0116] The weight value assigned to the node can be used to simply and intuitively determine the execution sequence of each start task.
[0117] In some optional implementations, the comparing module 504 is further configured to obtain an initial weight value of the vertex node with the largest running time ratio, and add one to the weight value of the vertex node with the largest running time ratio.
[0118] In some optional implementations, after assigning the preset weight to the node with the largest runtime ratio in each layer, the comparison module 504 is further configured to compare the runtime ratio of the startup tasks of each layer node in turn according to the next batch of preset number of startup data; increment the weight of the node corresponding to the startup task with the largest runtime ratio by one, until all startup data collected within the preset time period is processed.
[0119] This method maximizes the chances of obtaining the execution order of startup tasks with the shortest execution time, which helps improve startup speed.
[0120] In some optional implementations of this embodiment, the determining module 505 is further configured to: determine the vertex node with the largest weight; starting from the vertex node with the largest weight, traverse along each layer of nodes with the largest weight to the last layer of leaf nodes to obtain the optimal execution order.
[0121] The larger the weight, statistically speaking, the less the total startup time will be when the task is executed in this execution order. Therefore, as long as we start from the top node and traverse along the nodes with large weights to the leaf nodes, we can obtain a statistically optimal task execution order.
[0122] To address the aforementioned technical problems, embodiments of this application also provide a computer device. Please refer to [link / reference needed]. Figure 6 , Figure 6 This is a basic structural block diagram of the computer device in this embodiment.
[0123] The computer device 6 includes a memory 61, a processor 62, and a network interface 63 that are interconnected via a system bus. It should be noted that only the computer device 6 with components 61-63 is shown in the figure; however, it should be understood that it is not required to implement all the shown components, and more or fewer components can be implemented alternatively. Those skilled in the art will understand that the computer device described here is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0124] The computer device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device can interact with the user via a keyboard, mouse, remote control, touchpad, or voice control.
[0125] The memory 61 includes at least one type of readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 61 can be an internal storage unit of the computer device 6, such as a hard disk or a memory of the computer device 6. In other embodiments, the memory 61 can also be an external storage device of the computer device 6, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device 6. Of course, the memory 61 can also include both the internal storage unit and the external storage device of the computer device 6. In this embodiment, the memory 61 is generally used to store an operating system and various application software installed on the computer device 6, such as computer readable instructions of the decision method for starting task execution sequence, etc. In addition, the memory 61 can also be used to temporarily store various data that have been output or will be output.
[0126] The processor 62 can be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip in some embodiments. The processor 62 is generally used to control the overall operation of the computer device 6. In this embodiment, the processor 62 is used to run computer readable instructions or process data stored in the memory 61, such as computer readable instructions of the decision method for starting task execution sequence.
[0127] The network interface 63 can include a wireless network interface or a wired network interface, which is generally used to establish a communication connection between the computer device 6 and other electronic devices.
[0128] This embodiment implements the steps of the decision method for starting task execution sequence of the above-mentioned embodiments by the processor executing computer readable instructions stored in the memory. By collecting starting data of all starting task execution sequences and determining the optimal execution sequence based on the starting data, the workload can be reduced, the maintenance is facilitated, and the system resource utilization rate can be improved by further improving the starting speed based on automatic analysis.
[0129] The application also provides another implementation, that is, providing a computer readable storage medium, which stores computer readable instructions, the computer readable instructions can be executed by at least one processor to make the at least one processor execute the steps of the decision method of starting task execution sequence as described above, by collecting starting data of all starting task execution sequences, determining the optimal execution sequence based on the starting data, the workload can be reduced, the maintenance is facilitated, at the same time, the starting speed can be further improved based on automatic analysis, so as to improve the utilization rate of system resources.
[0130] Through the above description of the embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment method can be realized by means of software and necessary general hardware platform, of course, it can also be realized by hardware, but in many cases, the former is a better implementation. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a plurality of instructions for making a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) execute the method described in each embodiment of the present application.
[0131] Obviously, the above-described embodiments are only some of the embodiments of the present application, not all the embodiments, and the preferred embodiments of the present application are given in the drawings, but do not limit the patent scope of the present application. The present application can be realized in many different forms, and on the contrary, the purpose of providing these embodiments is to make the disclosure of the present application more thorough and comprehensive. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions recorded in the foregoing specific embodiments, or make equivalent replacements to some technical features. Any equivalent structure made by using the content of the specification and drawings, directly or indirectly applied to other related technical fields, is also within the scope of the patent protection of the present application.
Claims
1. A decision method for starting a task execution sequence, characterized by, The method comprises the following steps: obtaining all starting tasks and obtaining all execution sequences of the starting tasks in a permutation and combination manner; executing the starting tasks according to the execution sequences for multiple times within a preset time and collecting corresponding starting data; constructing a decision forest according to the execution sequences, calculating a running time ratio of the starting tasks corresponding to all nodes in the decision forest based on the starting data, wherein the running time ratio of the starting tasks refers to a ratio of a total time of the execution sequence corresponding to the starting task to an execution time of the starting task in the execution sequence; comparing the running time ratios of the starting tasks corresponding to each layer of nodes in the decision forest and assigning a weight value to the nodes according to a preset rule; and determining an optimal execution sequence of the starting tasks according to the weight values assigned to the nodes.
2. The decision method of starting task execution order according to claim 1, characterized in that, The step of calculating the running time ratio of the starting tasks corresponding to all nodes in the decision forest based on the starting data comprises: randomly taking out a preset number of starting data; calculating and saving the running time ratio of each starting task in the corresponding execution sequence according to the starting data; after traversing the preset number of starting data, statistically analyzing the running time ratio of each starting task; if there are multiple running time ratios of the starting tasks of the same node in the decision forest, calculating an average value of the multiple running time ratios of the starting tasks and taking the average value as the final running time ratio of the starting task corresponding to the node.
3. The decision method of starting task execution order according to claim 2, characterized in that, The step of calculating the running time ratio of each starting task in the corresponding execution sequence according to the starting data comprises: obtaining a total time of each execution sequence and an execution time of each starting task in the corresponding execution sequence from the starting data; dividing the total time by the execution time to obtain the running time ratio of the starting task.
4. The decision method of starting task execution order according to claim 2, characterized in that, The step of comparing the running time ratios of the starting tasks corresponding to each layer of nodes in the decision forest and assigning a weight value to the nodes according to a preset rule comprises: comparing the running time ratios of all starting tasks in the top node, and assigning a preset weight value to the top node corresponding to the starting task with the maximum running time ratio; sequentially comparing the running time ratios of the starting tasks of each layer of nodes under the top node until the last layer of leaf nodes, and assigning the preset weight value to the node with the maximum running time ratio in each layer.
5. The decision method of starting task execution order according to claim 4, characterized in that, The step of assigning a preset weight value to the top node corresponding to the starting task with the maximum running time ratio comprises: obtaining an initial weight value of the top node with the maximum running time ratio; adding one to the weight value of the top node with the maximum running time ratio.
6. The decision method of starting task execution order according to claim 5, characterized in that, After the step of assigning the preset weight value to the node with the maximum running time ratio in each layer, the method further comprises: extracting the next batch of preset number of starting data; sequentially comparing the running time ratios of the starting tasks of each layer of nodes according to the next batch of preset number of starting data; adding one to the weight value of the node corresponding to the starting task with the maximum running time ratio until all starting data collected within the preset time are processed.
7. The decision method of starting task execution order according to claim 1, characterized in that, The step of determining an optimal execution sequence of the starting tasks according to the weight values assigned to the nodes comprises: determining the top node with the maximum weight value; Starting from the vertex node with the largest weight, the optimal execution order is obtained by traversing the node with the largest weight in each layer to the last layer of leaf nodes.
8. A decision device for starting a task execution sequence, characterized by The method comprises the steps of: an acquisition module, configured to acquire all start tasks and obtain all execution orders of the start tasks in a permutation and combination manner; an execution module, configured to execute the start tasks according to the execution orders for multiple times within a preset time and collect corresponding start data; a calculation module, configured to construct a decision forest according to the execution orders, and calculate a running time ratio of the start tasks corresponding to all nodes in the decision forest based on the start data, wherein the running time ratio of the start tasks refers to a ratio of a total time of the execution order corresponding to the start tasks to an execution time of the start tasks in the execution order; a comparison module, configured to compare the running time ratio of the start tasks corresponding to each node in the decision forest, and assign a weight to the node according to a preset rule; and a determination module, configured to determine an optimal execution order of the start tasks according to the weight assigned to the node. 9.A computer device, comprising a memory and a processor, wherein the memory stores computer readable instructions, and the processor executes the computer readable instructions to implement the steps of the decision method for the execution order of the start tasks according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer readable instructions, and the computer readable instructions are executed by the processor to implement the steps of the decision method for the execution order of the start tasks according to any one of claims 1 to 7.
Citation Information
Patent Citations
Executing method and device for task
CN106844055A
Method, device and system for starting and optimizing application program and medium
CN107943576A