Multi-process starting control method and device
By determining the startup dependency and target startup path of the application process and dividing it into groups for startup, the problem of low startup efficiency in the existing technology is solved, and more efficient process startup is achieved.
Patent Information
- Application Number
- CN202510320575.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-18
- Publication Date
- 2025-06-13
AI Technical Summary
In the prior art, the startup efficiency of ECU application processes is low, especially due to the interdependence between application processes, the startup sequence is unreasonable, which in turn affects the overall startup efficiency.
By traversing each application process to be started, determine its startup dependencies, and determine the target startup path for each application process based on these dependencies. Then, the application processes with the same startup sequence are divided into one group, and the corresponding thread is called to start the target application processes in each group in turn according to the startup sequence of the groups and the dependencies of the application processes.
Improve the startup efficiency of the application process, avoid startup delays due to dependencies, and improve the startup speed of the overall ECU.
Smart Images

Figure CN120144211A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of ECU process startup, and particularly to a control method and device for multi-process startup. Background Art
[0002] In the AUTOSAR AP platform, the EM (Execution Management) module is a process management module, and the EM is responsible for starting all application processes in an ECU.
[0003] The inventor has found through research that currently, the EM starts application processes by using a thread inside the EM to sequentially start each application process in order. And because there are often dependencies between some application processes, before a certain process 1 starts, it is necessary to sequentially start each application process that has a dependency relationship with process 1. However, process 2 that needs to be started after process 1 has nothing to do with the application processes that have a dependency relationship with process 1, but needs to wait for them to start before it can start; the startup efficiency of this process startup method is relatively low. Summary of the Invention
[0004] In view of this, the purpose of the present invention is to provide a control method and device for multi-process startup to alleviate the technical problem of relatively low startup efficiency of ECU application processes in the prior art.
[0005] In a first aspect, the present invention provides a control method for multi-process startup, including:
[0006] Traverse each application process to be started, and determine the startup dependency relationship of each said application process; wherein, the startup dependency relationship is used to represent each application process that needs to be sequentially started before each said application process starts;
[0007] Based on the startup dependency relationship, determine the target startup path corresponding to each said application process;
[0008] According to the startup order of each said application process in the target startup path where it is located, divide at least one said application process with the same startup order into a group;
[0009] Call the corresponding thread to sequentially start the target application processes in each said group according to the startup order corresponding to each said group and the startup dependency relationship of each said application process.
[0010] In an optional implementation manner, the step of traversing each application process to be started and determining the startup dependency relationship of each said application process includes:
[0011] Find each application process that needs to be started before the current application process starts and the start order of each of the application processes; use each of the application processes and the start order of each of the application processes as the start dependency of the current application process;
[0012] Use the next application process of the current application process as the new current application process;
[0013] Repeat the above steps until each application process to be started has been traversed and then terminate.
[0014] In an optional embodiment, the step of determining the target start path corresponding to each of the application processes based on the start dependency includes:
[0015] Determine at least one start path for each of the application processes according to the start dependency corresponding to each of the application processes;
[0016] Based on the start path with the largest number of application processes to be started corresponding to each of the application processes, determine the target start path corresponding to each of the application processes.
[0017] In an optional embodiment, the step of determining the start order of each of the application processes in the corresponding target start path includes:
[0018] Determine the start order of each application process in the target start path according to the target start path corresponding to the current application process;
[0019] From the start order of each of the application processes, find the start order of the current application process in the target start path;
[0020] Use the next application process of the current application process as the new current application process;
[0021] Repeat the above steps until each application process to be started has been traversed and then terminate.
[0022] In an optional embodiment, the step of calling the corresponding thread to start the target application process in each of the groups in sequence according to the start order corresponding to each of the groups includes:
[0023] Call the first thread corresponding to the group to be started in the first order to start the target application process in the group to be started in the first order;
[0024] Repeat the following steps until each of the groups has been traversed and then terminate:
[0025] In response to the startup of the target application process in the group to be started in the previous order, call the current thread corresponding to the group to be started in the current order, and start the target application process in the group to be started in the current order that has a startup dependency relationship with the target application process in the group to be started in the previous order.
[0026] In an alternative embodiment, the step of calling the corresponding thread to sequentially start the target application process in each group according to the startup order corresponding to each group further includes:
[0027] If there are multiple target application processes in any group, repeat the following steps until each target application process in the group is started and then terminate:
[0028] In response to the startup of the current target application process in the group, call the thread corresponding to the group again to start the next target application process in the group, and use the next target application process as the new current target application process.
[0029] In an alternative embodiment, the method further includes:
[0030] Randomly determine the target application process corresponding to the current startup order based on each application process in each group;
[0031] Or,
[0032] Determine the target application process corresponding to the current startup order based on the service priority of the startup path where each application process in each group is located.
[0033] In a second aspect, the present invention provides a control device for multi-process startup, including:
[0034] A first determination module that traverses each application process to be started and determines the startup dependency relationship of each application process; wherein, the startup dependency relationship is used to represent each application process that needs to be sequentially started before each application process starts;
[0035] A second determination module that determines the target startup path corresponding to each application process based on the startup dependency relationship;
[0036] A partitioning module that divides at least one application process with the same startup order into a group according to the startup order of each application process in the target startup path where it is located;
[0037] A startup module that calls the corresponding thread to sequentially start the target application process in each group according to the startup order corresponding to each group and the startup dependency relationship of each application process.
[0038] In a third aspect, the present invention provides an electronic device, including a memory and a processor. A computer program that can run on the processor is stored in the memory. When the processor executes the computer program, the steps of the method according to any one of the foregoing embodiments are implemented.
[0039] In a fourth aspect, the present invention provides a machine-readable storage medium. The machine-readable storage medium stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions cause the processor to implement the steps of the method according to any one of the foregoing embodiments.
[0040] A control method and device for multi-process startup provided by an embodiment of the present invention traverse each application process to be started, determine the longest target startup path, and then know the startup order of each application process in the target startup path; group according to the startup order, and group the application processes with the same startup order into one group; the threads corresponding to each group start the target processes to be started in each group in sequence according to the startup order of each group, so as to improve the thread startup efficiency.
[0041] Other features and advantages of the present disclosure will be described in the following description, or some features and advantages can be inferred from the description without doubt, or can be known by implementing the above technologies of the present disclosure.
[0042] To make the above objects, features, and advantages of the present disclosure more obvious and understandable, the following specifically enumerates preferred embodiments and, in conjunction with the accompanying drawings, makes the following detailed description. Description of the Drawings
[0043] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following will briefly introduce the drawings required for the description of the specific embodiments or the prior art. Obviously, the following drawings are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0044] Figure 1 It is a flowchart of a control method for multi-process startup provided by an embodiment of the present invention;
[0045] Figure 2 It is a schematic diagram of a multi-process startup scenario with a dependency relationship provided by an embodiment of the present invention;
[0046] Figure 3 It is a functional module diagram of a control device for multi-process startup provided by an embodiment of the present invention;
[0047] Figure 4 It is a schematic diagram of the hardware architecture of an electronic device provided by an embodiment of the present invention. Specific Embodiments
[0048] To make the objectives, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Apparently, the described embodiments are some but not all of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the scope of protection of the present invention.
[0049] The current EM module needs to start all the processes that the target application process requires before its startup sequence and the processes that have a dependency relationship with this process in order to start the target application process.
[0050] For example, process A depends on process B, and process B depends on process C, forming a process dependency relationship of A->B->C; process D depends on process E; if process E starts after process A, then if it is desired to start process D at this time, only the process sequence of CBAED can be followed. However, process E, process D, and processes ABC have no relationship, and still need to wait for processes ABC to start up. It can be known that the startup times of processes D and E are delayed. If starting in the order of process EDABC, then at this time, to start process D, process E still needs to be started first, and processes ABC that have no relationship with processes ED are also delayed. Therefore, in this way of starting, on the one hand, the startup time of a thread is very slow, and on the other hand, there may be dependency relationships between processes, and the startup of processes without dependency relationships will also be delayed. Overall, the startup efficiency is extremely slow.
[0051] Based on this, a control method and device for multi-process startup provided by the embodiments of the present invention traverse each application process to be started, determine the longest target startup path, and then know the startup sequence of each application process in this target startup path; group according to this startup sequence, and divide the application processes with the same startup sequence into one group; the threads corresponding to each group start the target processes to be started in each group in the startup sequence of each group in turn to improve the startup efficiency of the threads.
[0052] To facilitate the understanding of this embodiment, first, a control method for multi-process startup disclosed in the embodiments of the present invention will be introduced in detail. This method is applied to the process management module of an adaptive platform. There may be multiple such process management modules, and each process management module is correspondingly responsible for the startup control of all application processes in an ECU module.
[0053] Figure 1 It is a flowchart of a control method for multi-process startup provided by the embodiments of the present invention.
[0054] As Figure 1 shown, the method includes the following steps:
[0055] Step S102: Traverse each application process to be started, and determine the startup dependency relationship of each application process.
[0056] It can be understood that the process management module / EM module can obtain all the application processes to be started within a preset time period or all the application processes to be started based on corresponding control instructions.
[0057] Among them, the startup dependency relationship is used to represent each application process that needs to be started in sequence before each application process starts;
[0058] In some embodiments, the process management module can deeply traverse each application process to be started, and then determine the startup dependency relationship of each application process, specifically including:
[0059] Step 1.1): Find each application process that needs to be started before the current application process starts and the startup order of each application process.
[0060] Here, Figure 2 shows application processes ABCDEFGH, where process A depends on process B, process B depends on process C, process C depends on process D, process E depends on process B and process F, and process F depends on process D. Process G depends on process H.
[0061] For the current application process being process A, based on the function of the process management module, it can be known that all processes BCD that need to be started before process A starts, and the startup order of B→C→D (D starts first, then C, and then D).
[0062] Step 1.2): Take each application process and the startup order of each application process as the startup dependency relationship of the current application process.
[0063] According to the application processes and their corresponding startup orders determined in Step 1.1), the current application process can start only after the application processes on which it depends start. That is, process A must wait until process B starts to start. The application processes required before each application process starts and the startup order corresponding to each application process can be understood as the startup dependency relationship required for each application process to start.
[0064] Step 1.3): Take the next application process of the current application process as the new current application process.
[0065] Here, if the startup dependency relationship of the current application process has been determined, the application processes whose startup dependency relationships have not been determined can be used as the next application process; if there are multiple application processes whose startup dependency relationships have not been determined, one is randomly selected as the next application process; then this next application process is used as the new current application process to perform the subsequent operation of step 1.4).
[0066] Step 1.4), repeat the above steps 1.1)-1.3) until each application process to be started has been traversed and then terminate.
[0067] The new current application process repeats steps 1.1)-1.3) to determine the startup dependency relationship of the new current application process; until the startup dependency relationships of each application process to be started have been determined, that is, when there is no next application process at this time, the loop terminates.
[0068] Step S104, based on the startup dependency relationship, determine the target startup path corresponding to each application process.
[0069] In practical applications, this step S104 can be implemented through the following steps, specifically including:
[0070] Step 2.1), according to the startup dependency relationship corresponding to each application process, determine at least one startup path for each application process.
[0071] Here, as Figure 2 shown, if the current application process is A, according to the startup dependency relationship obtained in the previous steps, it can be known that there is only one startup path for application process A: AB C D; if the current application process is E, according to the startup dependency relationship obtained in the previous steps, it can be known that there are two startup paths for application process E: E B C D and E F D. This startup path can be understood as the current application process and the composition of each application process arranged in the startup order required before the startup of this current application process determined based on the startup dependency relationship.
[0072] Step 2.2), based on the startup path of the application process with the largest number of application processes to be started corresponding to each application process, determine the target startup path corresponding to each application process.
[0073] As an alternative implementation, the longest startup path can be used as the target startup path; the longest startup path can be understood as, for each application process, the number of application processes to be started required to achieve startup is more than that of other startup paths; here, taking the current application process as E as an example, the startup path 1 is E B C D, and three application processes B, C, and D need to be started before the current application process, and the startup path 2 is E F D, and two application processes F and D need to be started before the current application process; at this time, for the current application process E, its target startup path is startup path 1: E B C D. Therefore, it can be seen that when there are multiple startup paths for a certain application process, the path with a larger number of application processes to be started before the startup of this application process is selected as the target startup path. Since this target startup path requires the most application processes to be started, this target startup path is the longest.
[0074] Step S106, according to the startup order of each application process in the target startup path where it is located, at least one application process with the same startup order is divided into a group.
[0075] In some embodiments, step S106 may include the following specific steps to implement:
[0076] Step 3.1), according to the target startup path corresponding to the current application process, determine the startup order of each application process in the target startup path.
[0077] Reference Figure 2 , based on the target startup path in the foregoing embodiments, it can be known the startup order of each application process in the path; it can be seen that the application process D H does not depend on any other application process, that is, the application process D H can be started first, and the startup order of the application process D H in the target startup path is (1), while the application processes C and F depend on D, and the startup order of the application processes C and F in the target startup path is (2), and the application process G depends on H, and the startup order of the application process G in the target startup path is (2); and so on, the startup order of each application process on the target startup path can be known, which will not be elaborated here.
[0078] Step 3.2), from the startup order of each application process, find the startup order of the current application process in the target startup path.
[0079] From the startup order of each application process in the foregoing steps, perform a traversal search operation to obtain the startup order of each application process in its target startup path. For example, based on the foregoing embodiments, it can be known that the target startup path of the current application process E is E(4)B(3)C(2)D(1), and the startup order of the current application process E can be obtained as (4).
[0080] Step 3.3), taking the next application process of the current application process as the new current application process.
[0081] Here, if the startup order of the current application process has been determined, the application process whose startup order has not yet been determined can be used as the next application process; if there are multiple application processes whose startup order has not yet been determined, one is randomly selected as the next application process; and the next application process is used as the new current application process to execute the subsequent step 3.4) operation.
[0082] Step 3.4), repeat the above steps 3.1) to 3.3) until each application process to be started is traversed and terminated.
[0083] The new current application process repeats step 3.1) to step 3.3) to determine the startup order of the new current application process; until the startup order of each application process to be started has been determined, that is, the loop is terminated when there is no next application process.
[0084] On this basis, each application process is grouped, and those with the same startup order are divided into the same group, and the groups are sorted according to the startup order; Figure 2 As shown, the application processes are grouped into four groups, group (1) application process DH, group (2) application process CF G, group (3) application process B, and group (4) application process AE.
[0085] Step S108 , calling corresponding threads to sequentially start the target application process in each group according to the start sequence corresponding to each group and the start dependency relationship of each application process.
[0086] In some embodiments, a multithreading mechanism is used to accelerate the speed of starting each application process by the process management module, thereby improving the startup efficiency. For example, each group may be set to correspond to a thread, that is, the number of threads is determined according to the number of divided groups. According to the startup sequence corresponding to each group, the threads corresponding to each group sequentially select and start the target application process in step S108, which specifically includes:
[0087] Step 4.1), calling the first thread corresponding to the first sequence of the to-be-started group, and starting the target application process in the first sequence of the to-be-started group.
[0088] by Figure 2 For example, at this time, the group (1) is the first order group to be started, and its corresponding first thread starts the target application process DH in the group to be started.
[0089] Step 4.2), repeat the following step 4.3) until each group has been traversed:
[0090] Step 4.3), in response to the startup of the target application process in the to-be-started group of the previous sequence, call the current thread corresponding to the to-be-started group of the current sequence, and start the target application process in the to-be-started group of the current sequence that has a startup dependency on the target application process in the to-be-started group of the previous sequence.
[0091] Here, when the thread corresponding to the to-be-started group of the previous sequence starts the target application process in that previous sequence group, the thread corresponding to the to-be-started group of the current sequence triggers its working state and starts the target application process in the to-be-started group of the current sequence;
[0092] For example, if the to-be-started group of the current sequence is (3), then the to-be-started group of the previous sequence is (2); when the thread corresponding to group (2) starts the target application process in group (2), the thread corresponding to group (3) then starts the target application process in group (3).
[0093] In the embodiments of the present invention, after grouping each application process according to the startup order in the target startup path, the process management module starts threads according to the startup order corresponding to the groups. For example, Figure 2 if there are four corresponding groups, four threads need to be started. There is a certain interaction and dependency relationship among these four threads. First, thread 1 starts the target application process in group (1). Suppose the target application process H in group (1) starts first, then it sends a signal to thread 2 corresponding to group (2), and thread 2 can directly start the target application process G in group (2). At this time, process G does not need to wait for other application processes in group (1) to start before starting, thereby improving the startup efficiency of each application process. And so on. The application processes within each group wait for the information sent by the previous group and then start.
[0094] Based on the foregoing embodiments, when there is more than one target application process in each group, step S108 further includes:
[0095] Step 5.1), if there are multiple target application processes in any group, repeatedly execute the following step 5.2) until it terminates when each target application process in the group has been started:
[0096] Step 5.2), in response to the startup of the current target application process in the group, call the thread corresponding to the group again, start the next target application process in the group, and use the next target application process as the new current target application process.
[0097] Also with Figure 2For example, suppose the target application process G in group (1) has been started under thread control. Since there are other target application processes in group (1), the thread corresponding to group (1) will then control the start of the other target application processes in group (1).
[0098] In a preferred embodiment of the actual application, the embodiment of the present invention traverses each application process to be started, determines the longest target start path, and then knows the start order of each application process in this target start path; groups according to this start order, and assigns the application processes with the same start order to one group; the threads corresponding to each group start the target processes to be started in each group in sequence according to the start order of each group to improve the thread start efficiency.
[0099] As an alternative embodiment, if two or more processes in a group have met the start conditions, the embodiment of the present invention further includes:
[0100] Step 6.1), based on each application process in each group, randomly determine the target application process corresponding to the current start order.
[0101] At this time, if two or more processes in a group have met the start conditions, one can be randomly selected from this group as the target application process to start.
[0102] Or,
[0103] Step 6.1), based on the service priority of the start path where each application process in each group is located, determine the target application process corresponding to the current start order.
[0104] It should be noted that through the process management module or the service data reading module, it is possible to know the service scenarios corresponding to the start paths where each application process is located in the actual application; in this way, additional service scenarios can be assigned to each application process on each start path; if there are multiple application processes in a certain group, based on the service scenario information carried by each application process, determine the service priority of each application process in each group; the thread of this group starts each application process according to the sorting of the service priorities.
[0105] In some embodiments, as Figure 3 shown, the embodiment of the present invention further provides a control device 200 for process start, including:
[0106] The first determination module 201 traverses each application process to be started and determines the start dependency relationship of each said application process; wherein, the start dependency relationship is used to represent each application process that needs to be started in sequence before each said application process starts;
[0107] The second determination module 202 determines the target startup path corresponding to each of the application processes based on the startup dependency relationship.
[0108] The partitioning module 203 partitions at least one of the application processes having the same startup sequence into a group according to the startup sequence of each of the application processes in the target startup path where it is located.
[0109] The startup module 204 calls corresponding threads to sequentially start the target application processes in each of the groups according to the startup sequence corresponding to each of the groups and the startup dependency relationship of each of the application processes.
[0110] In the embodiment of the present invention, depth traversal is used to determine the target startup path, the application processes are grouped according to the startup sequence in the target startup path, and then the multi-thread technology is used to sequentially start the target application processes in each group according to the startup sequence of each group, which greatly improves the efficiency of the EM module in starting application processes in the AUTOSAR AP platform and significantly improves the startup speed of the entire ECU.
[0111] Further, the first determination module 201 is specifically configured to find each of the application processes that need to be started before the current application process starts and the startup sequence of each of the application processes; use the each of the application processes and the startup sequence of each of the application processes as the startup dependency relationship of the current application process; use the next application process of the current application process as the new current application process; repeat the above steps until each of the application processes to be started has been traversed and then terminate.
[0112] Further, the second determination module 202 is specifically configured to determine at least one startup path for each of the application processes according to the startup dependency relationship corresponding to each of the application processes; determine the target startup path corresponding to each of the application processes based on the startup path having the largest number of application processes to be started corresponding to each of the application processes.
[0113] Further, the partitioning module 203 is specifically configured to determine the startup order of each application process in the target startup path according to the target startup path corresponding to the current application process; find the startup sequence of the current application process in the target startup path from the startup orders of each of the application processes; use the next application process of the current application process as the new current application process; repeat the above steps until each of the application processes to be started has been traversed and then terminate.
[0114] Further, the startup module 204 is specifically configured to call the first thread corresponding to the startup group of the first order to start the target application process in the startup group of the first order; repeat the following steps until each group is traversed and terminated: in response to the startup of the target application process in the startup group of the previous order, call the current thread corresponding to the startup group of the current order to start the target application process in the startup group of the current order that has a startup dependency on the target application process in the startup group of the previous order.
[0115] Further, the startup module 204 is specifically configured to, if there are multiple target application processes in any group, repeat the following steps until each target application process in the group is started and terminated: in response to the startup of the current target application process in the group, call the thread corresponding to the group again to start the next target application process in the group, and use the next target application process as the new current target application process.
[0116] Further, the device is also specifically configured to randomly determine the target application process corresponding to the current startup order based on each application process in each group; or determine the target application process corresponding to the current startup order based on the service priority of the startup path where each application process in each group is located.
[0117] Figure 4 This is a schematic diagram of the hardware architecture of the electronic device 300 provided in the embodiment of the present invention. Refer to Figure 4 As shown, the electronic device 300 includes: a machine-readable storage medium 301 and a processor 302, and may also include a non-volatile storage medium 303, a communication interface 304, and a bus 305; wherein, the machine-readable storage medium 301, the processor 302, the non-volatile storage medium 303, and the communication interface 304 communicate with each other through the bus 305. The processor 302 can execute the control method for multi-process startup described in the above embodiment by reading and executing the machine-executable instructions for multi-process startup control in the machine-readable storage medium 301.
[0118] The machine-readable storage medium mentioned in this article can be any electronic, magnetic, optical or other physical storage device that can contain or store information, such as executable instructions, data, etc. For example, the machine-readable storage medium can be: RAM (Random Access Memory), volatile memory, non-volatile memory, flash memory, storage drives (such as hard disk drives), any type of storage disk (such as optical discs, DVDs, etc.), or similar storage media, or a combination thereof.
[0119] The non-volatile medium can be a non-volatile memory, a flash memory, a storage drive (such as a hard disk drive), any type of storage disk (such as an optical disk, a DVD, etc.), or a similar non-volatile storage medium, or a combination thereof.
[0120] It can be understood that the specific operation methods of the functional modules in this embodiment can refer to the detailed descriptions of the corresponding steps in the above method embodiments, and will not be repeated here.
[0121] The computer-readable storage medium provided by the embodiment of the present invention stores a computer program, and when the computer program code is executed, it can implement the multi-process startup control method described in any of the above embodiments. For the specific implementation, refer to the method embodiments and will not be elaborated here.
[0122] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems and devices described above can refer to the corresponding processes in the foregoing method embodiments and will not be repeated here.
[0123] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installation", "connection", and "connection" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, and it can be the communication inside two components. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific situations.
[0124] In the description of the present invention, it should be noted that the orientation or positional relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. is based on the orientation or positional relationship shown in the drawings, and is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus cannot be understood as a limitation to the present invention. In addition, the terms "first", "second", and "third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.
[0125] Finally, it should be noted that the above-described embodiments are only specific embodiments of the present invention, used to illustrate the technical solutions of the present invention, rather than limiting it. The protection scope of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that any technician familiar with the technical field of the present invention can still modify the technical solutions described in the foregoing embodiments or can easily think of changes, or perform equivalent replacements on some of the technical features; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the protection scope of the present invention.
Claims
1. A control method for starting multiple processes, characterized in that: include: Traversing each application process to be started, and determining the startup dependency relationship of each application process; wherein the startup dependency relationship is used to characterize each application process that needs to be started in sequence before each application process is started; Based on the startup dependency, determining a target startup path corresponding to each of the application processes; According to the startup sequence of each of the application processes in the target startup path, at least one of the application processes having the same startup sequence is divided into a group; According to the startup sequence corresponding to each group and the startup dependency relationship of each application process, the corresponding thread is called to start the target application process in each group in sequence.
2. The method according to claim 1, characterized in that The step of traversing each application process to be started and determining the startup dependency of each application process includes: Finding each application process that needs to be started before the current application process is started and the startup sequence of the application processes; using the application processes and the startup sequence of the application processes as the startup dependency relationship of the current application process; Using the next application process of the current application process as a new current application process; Repeat the above steps until each application process to be started is traversed and terminated.
3. The method according to claim 1, characterized in that The step of determining a target startup path corresponding to each of the application processes based on the startup dependency relationship includes: Determining at least one startup path for each of the application processes according to the startup dependency relationship corresponding to each of the application processes; Based on the startup path corresponding to each of the application processes and having the largest number of application processes to be started, the target startup path corresponding to each of the application processes is determined.
4. The method according to claim 1, characterized in that: The steps of starting each application process in the target startup path include: According to the target startup path corresponding to the current application process, determining the startup order of each application process in the target startup path; From the startup sequence of each application process, searching for the startup sequence of the current application process in the target startup path; Using the next application process of the current application process as a new current application process; Repeat the above steps until each application process to be started is traversed and terminated.
5. The method according to claim 1, characterized in that The step of calling corresponding threads to sequentially start the target application processes in each of the groups according to the start sequence corresponding to each of the groups comprises: Calling a first thread corresponding to a first-order group to be started, and starting a target application process in the first-order group to be started; Repeat the following steps until each of the groups has been traversed: In response to the start of the target application process in the previous order to be started group, the current thread corresponding to the current order to be started group is called to start the target application process in the current order to be started group that has a start dependency relationship with the target application process in the previous order to be started group.
6. The method according to claim 5, characterized in that The step of calling the corresponding thread to sequentially start the target application process in each group according to the start sequence corresponding to each group also includes: If there are multiple target application processes in any group, the following steps are repeatedly performed until each of the target application processes in the group is started and terminated: In response to the start of the current target application process in the group, the thread corresponding to the group is called again to start the next target application process in the group, and the next target application process is used as a new current target application process.
7. The method according to claim 1 or 6, characterized in that: The method further comprises: Based on each application process in each of the groups, randomly determine a target application process corresponding to a current startup order; or, Based on the business priority of the startup path where each application process in each of the groups is located, the target application process corresponding to the current startup sequence is determined.
8. A control device for starting multiple processes, characterized in that: include: A first determination module traverses each application process to be started and determines a startup dependency relationship of each application process; wherein the startup dependency relationship is used to characterize each application process that needs to be started in sequence before each application process is started; A second determination module determines a target startup path corresponding to each of the application processes based on the startup dependency relationship; a division module, which divides at least one of the application processes having the same startup sequence into a group according to the startup sequence of each of the application processes in the target startup path; The startup module calls the corresponding thread to start the target application process in each group in sequence according to the startup sequence corresponding to each group and the startup dependency relationship of each application process.
9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A machine-readable storage medium, characterized in that: The machine-readable storage medium stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the steps of the method described in any one of claims 1 to 7.