Time-sharing starting method and device of process, equipment and product

By creating a parent process in the embedded Linux system to receive signals of interest and control the startup of child processes, the problem of uncontrollable process startup time is solved, orderly process startup is achieved, and system stability is improved.

CN119512700APending Publication Date: 2025-02-25BEIJING TIANDIHEXING TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411321210.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-23
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

In embedded Linux systems, the startup time of processes cannot be controlled, which can cause some processes to take too long to start or become abnormal, affecting the normal operation of the system. In particular, when critical processes become abnormal, it may cause the entire system to malfunction.

Method used

By creating a parent process to receive preset signals of interest and creating a child process when the service startup requirements are met, the parent process sends a startup signal to control the startup order of the service processes. Inter-process communication is carried out using a D-bus data bus and a FIFO data buffer to ensure orderly startup.

Benefits of technology

This ensures orderly process startup, avoiding system anomalies caused by improper process startup and improving system stability and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119512700A_ABST
    Figure CN119512700A_ABST
Patent Text Reader

Abstract

The invention discloses a time-sharing starting method, device, equipment and product of a process, and relates to the field of computers.The method comprises the steps that when a system is started, a parent process is created, and the parent process is used for receiving a preset interested signal in the system; when the preset interested signal received by the process does not meet a service starting requirement, setting the parent process to be in a blocked state; when the parent process receives that the preset interested signal meets a service starting requirement, creating a child process; and after it is confirmed that the child process is started, sending a starting signal to a service process depending on the child process by utilizing the parent process, so that the service process is started.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the computer field, and in particular to a method, device, equipment and product for starting a process in time-sharing manner. Background Art

[0002] In embedded Linux systems, although the startup scripts of processes are sequential, the startup time of each process cannot be controlled.

[0003] Some processes take a long time to start and reach the ready state, or in abnormal situations, some processes take longer to start than normal, which will cause the work that depends on these processes to be in the ready state to malfunction. If a key process has such a problem, it may cause the entire system to malfunction. However, since the order in which business processes are started cannot be controlled, this problem often occurs, seriously affecting the normal operation of the system. Summary of the invention

[0004] The purpose of this application is to provide a method, device, equipment and product for starting a process in time-sharing manner.

[0005] In a first aspect, the present application provides a method for starting a process in time-sharing manner, comprising:

[0006] When the system starts, a parent process is created, and the parent process is used to receive a preset signal of interest in the system;

[0007] When the preset signal of interest received by the process does not meet the service startup requirement, setting the parent process to a blocked state;

[0008] When the parent process has received the preset interest signal and the service startup requirement is met, a child process is created;

[0009] After confirming that the startup of the child process is complete, the parent process is used to send a startup signal to the service process that depends on the child process, so that the service process is started.

[0010] Optionally, after the step of using the parent process to send a start signal to a service process that depends on the child process so as to start the service process, the method further includes:

[0011] After the service process is started, the parent process is used to send a signal describing the successful start of the service process to other parent processes in the system.

[0012] Optionally, when the system is a Linux system, the parent process is communicatively connected with other parent processes via a Dbus data bus.

[0013] Optionally, the step of confirming that the subprocess startup is completed includes:

[0014] When the child process creates a communication connection with the parent process and the child process sends a startup success message to the parent process through the communication connection, it is confirmed that the startup of the child process is completed.

[0015] Optionally, when the system is a Linux system, the child process and the parent process are communicated with each other via a fifo data buffer.

[0016] Optionally, the time-sharing startup method of the process further includes:

[0017] When the amount of used data in the log file reaches a data amount threshold, the earliest data stored in the log file is deleted.

[0018] In a second aspect, the present application provides a time-sharing startup device for a process, comprising:

[0019] A creation module, used for creating a parent process when the system is started, wherein the parent process is used for receiving a preset signal of interest in the system;

[0020] A receiving module, configured to set the parent process to a blocked state when the preset signal of interest received by the process does not meet the service startup requirement;

[0021] When the parent process has received the preset interest signal and the service startup requirement is met, a child process is created;

[0022] The startup module is used to use the parent process to send a startup signal to the service process that depends on the child process after confirming that the child process has been started, so that the service process is started.

[0023] Optionally, the receiving module is further used to:

[0024] After the service process is started, the parent process is used to send a signal describing the successful start of the service process to other parent processes in the system.

[0025] Optionally, when the system is a Linux system, the parent process is communicatively connected with other parent processes via a Dbus data bus.

[0026] Optionally, the receiving module is further used to:

[0027] When the child process creates a communication connection with the parent process and the child process sends a startup success message to the parent process through the communication connection, it is confirmed that the startup of the child process is completed.

[0028] Optionally, when the system is a Linux system, the child process and the parent process are communicated with each other via a fifo data buffer.

[0029] Optionally, the time-sharing starting device for a process further includes: a monitoring module, configured to:

[0030] When the amount of used data in the log file reaches a data amount threshold, the earliest data stored in the log file is deleted.

[0031] In a third aspect, the present application provides a computer device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the time-sharing startup method of any one of the processes described above.

[0032] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the time-sharing startup method of any one of the processes described above.

[0033] In a fifth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the time-sharing startup method of any one of the processes described above.

[0034] According to the specific embodiments provided in this application, this application discloses the following technical effects:

[0035] The present application provides a method, apparatus, device and product for starting a process in a time-sharing manner, which utilizes a parent process in a blocked state to receive a signal of interest in the system. After the parent process receives the signal of interest required for starting a business process, it creates a child process to start the business process, thereby controlling the start order of the business process based on the generation order of different signals, thereby achieving orderly start of the business process. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0037] Figure 1 A flowchart of a method for starting a process in time-sharing manner provided in one embodiment of the present application;

[0038] Figure 2 A schematic diagram of the principle of a time-sharing startup method of a process provided in an embodiment of the present application;

[0039] Figure 3 A schematic diagram of functional modules of a time-sharing startup device for a process provided in one embodiment of the present application;

[0040] Figure 4 A schematic diagram of the structure of a computer device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0041] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0042] like Figure 1 As shown, some embodiments of the present application provide a time-sharing startup method for a process, which includes the following steps 101 to 104. Among them:

[0043] Step 101: Create a parent process when the system starts, and the parent process is used to receive a preset signal of interest in the system.

[0044] Step 102: When the preset signal of interest received by the process does not meet the service startup requirement, the parent process is set to a blocking state.

[0045] Step 103: When the parent process has received the preset interest signal that meets the service startup requirement, a child process is created.

[0046] Step 104: After confirming that the child process has been started, use the parent process to send a start signal to the service process that depends on the child process, so that the service process starts.

[0047] In an embodiment of the present application, after the system is started, the system does not start the business process, but creates a dedicated parent process for different business processes. According to the startup needs of different business processes, interest signals can be set for the business processes. The interest signals can be various signals generated by the system after startup, such as: system synchronization success signal, mysqd startup completion signal, a business program startup success signal, etc. The specific settings can be based on actual needs and are not limited here.

[0048] Furthermore, the parent process is in a blocked state right after it is started, that is, the parent process will not send any signals to the outside when it is started. Then the parent process will receive the signals of interest from the system. For the signals of no interest in the system, the parent process may not receive them. There may be one or more signals of interest, that is, the number of signals of interest is fixed, and the number mainly depends on the number of signals required for the business process to start. Specifically, when the parent process obtains all the signals of interest required for the business process to start, that is, when the number of signals of interest received by the parent process meets the business start-up requirements, the parent process will create a child process to start the business process. After receiving the message sent to the parent process by the child process after it is started, the parent process will send a start signal to the business process that depends on the child process, so that the business process starts, so that the business process can be started at the right time.

[0049] The embodiment of the present application utilizes a parent process in a blocked state to receive a signal of interest in the system. After receiving the signal of interest process required for starting the business process, the parent process creates a child process to start the business process, thereby controlling the start order of the business process based on the order in which different signals are generated, thereby achieving an orderly start of the business process.

[0050] Optionally, after step 104, the method further includes: after the business process is started, using the parent process to send a signal describing the successful start of the business process to other parent processes in the system.

[0051] In an embodiment of the present application, the process of interest of the parent process can also be a signal of the successful start of the business process. Therefore, after the business process is started, it can send a start success signal to the child process in sequence, and then the child process sends a business start signal to the parent process to enable the parent process to send the start success signal of the business process to other parent processes, so that other parent processes can create child processes based on the signal to start the business programs associated with themselves, so that the business programs can be started in an orderly manner.

[0052] Optionally, when the system is a Linux system, the parent process is communicatively connected with other parent processes via a Dbus data bus.

[0053] In the embodiment of the present application, DbusD-Bus is a message bus system for communication between applications, used for communication between processes. It is a 3-layer IPC system, including: a function library libdbus, used for two applications to communicate with each other and exchange messages; a message bus daemon based on libdbus, which can be connected to multiple applications at the same time and can route messages from one application to 0 or more other programs; a wrapper library or bindings based on a specific application framework. For example, libdbus-glib and libdbus-qt, as well as bindings in other languages, such as Python. Most developers use the APIs of these wrapper libraries because they simplify D-Bus programming details. Libdbus is intentionally designed to be the low-level backend of higher-level bindings. Most of the libdbus APIs are only used to implement bindings.

[0054] Optionally, before step 104, the method further includes: when the child process creates a communication connection with the parent process and the child process sends a startup success message to the parent process through the communication connection, confirming that the startup of the child process is completed.

[0055] In an embodiment of the present application, in order to enable the child process and the parent process to communicate through different communication mechanisms, the child process can establish an independent communication connection with the parent process after it is created, so that the child process can inform the parent process by sending a startup success message to the parent process after it is created. After the parent process learns that the child process has started, it will send a startup signal to the child process to instruct the child process to start the business program.

[0056] Optionally, when the system is a Linux system, the child process and the parent process are communicated with each other via a fifo data buffer.

[0057] In the embodiment of the present application, fifo is a first-in-first-out data buffer. The difference between it and ordinary memory is that it has no external read and write address lines and is very simple to use. The disadvantage is that it can only be read and written sequentially, but not randomly.

[0058] The child process creates a fifo and communicates with the parent process through the fifo. When the child process is started, it sends a message to the parent process. After receiving the message, the parent process sends a signal to other processes through dbus, so that other processes know that the business process is ready.

[0059] Optionally, the method further includes: when the amount of used data in the log file reaches a data amount threshold, deleting the data first stored in the log file.

[0060] In an embodiment of the present application, in order to avoid exhaustion of system resources due to untimely processing of log files by system log recording, the amount of used data of the log file can be monitored. When the amount of used data exceeds a threshold, the amount of available data can be expanded by deleting the data first stored in the log file.

[0061] For example, refer to Figure 2 , where after the system is started, the Dbus service can be started first, and the Dbus service is responsible for signal transmission in the system. Then the system will create parent processes (Parent) corresponding to each business program (Child). Each parent process is connected through the Dbus message bus provided by the Dbus service. Each parent process Parent1~4 can receive the signal (sig) of interest from the Dbus message bus. The signals of interest to different parent processes can be the same or different. For example, the signals of interest to Parent1 are sig1 and sig2, while the signals of interest to Parent2 are sig3 and sig4. Here, Parent1 is taken as an example. After receiving the signals of interest sig1 and sig2, Parent1 will create a business child process Chlid1. Then, after the child process Chlid1 is successfully started, it will send a startup success message Ready to the parent process Parent1. Then, the parent process Parent1 will send a startup signal Start to the child process Chlid1. The operation of other parent processes is similar to that of Parent1, which will not be repeated here.

[0062] Based on the same inventive concept, the embodiment of the present application also provides a time-sharing startup device for a process for implementing the time-sharing startup method of the process involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in the embodiment of the time-sharing startup device for one or more processes provided below can refer to the limitations of the time-sharing startup method of the process above, and will not be repeated here.

[0063] In an exemplary embodiment, Figure 3 As shown, a time-sharing starting device 20 for a process is provided, comprising:

[0064] A creation module 201, used for creating a parent process when the system is started, wherein the parent process is used for receiving a preset signal of interest in the system;

[0065] A receiving module 202, configured to set the parent process to a blocked state when the preset signal of interest received by the process does not meet the service startup requirement;

[0066] When the parent process has received the preset interest signal and the service startup requirement is met, a child process is created;

[0067] The starting module 203 is used to use the parent process to send a starting signal to the service process that depends on the child process after confirming that the child process has been started, so that the service process is started.

[0068] Optionally, the receiving module 202 is further configured to:

[0069] After the service process is started, the parent process is used to send a signal describing the successful start of the service process to other parent processes in the system.

[0070] Optionally, when the system is a Linux system, the parent process is communicatively connected with other parent processes via a Dbus data bus.

[0071] Optionally, the receiving module 202 is further configured to:

[0072] When the child process creates a communication connection with the parent process and the child process sends a startup success message to the parent process through the communication connection, it is confirmed that the startup of the child process is completed.

[0073] Optionally, when the system is a Linux system, the child process and the parent process are communicated with each other via a fifo data buffer.

[0074] Optionally, the time-sharing starting device for a process further includes: a monitoring module, configured to:

[0075] When the amount of used data in the log file reaches a data amount threshold, the earliest data stored in the log file is deleted.

[0076] The embodiment of the present application utilizes a parent process in a blocked state to receive a signal of interest in the system. After receiving the signal of interest process required for starting the business process, the parent process creates a child process to start the business process, thereby controlling the start order of the business process based on the order in which different signals are generated, thereby achieving an orderly start of the business process.

[0077] In an exemplary embodiment, a computer device is provided. The computer device may be a server or a terminal. The internal structure diagram thereof may be as follows: Figure 4As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the time-sharing startup data of the process. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a time-sharing startup method of a process is implemented.

[0078] Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0079] In an exemplary embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.

[0080] In an exemplary embodiment, a computer-readable storage medium is provided, storing a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0081] In an exemplary embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0082] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0083] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM may be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0084] The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. The non-relational database may include a distributed database based on blockchain, etc., but is not limited thereto. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but is not limited thereto.

[0085] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0086] This article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and core ideas of this application. At the same time, for those skilled in the art, according to the ideas of this application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.

Claims

1. A time-sharing startup method for a process, characterized in that: The time-sharing starting method of the process includes: Creating a parent process when the system starts, the parent process is used to receive a preset signal of interest in the system; When the preset signal of interest received by the process does not meet the service startup requirement, setting the parent process to a blocked state; When the parent process has received the preset interest signal and the service startup requirement is met, a child process is created; After confirming that the startup of the child process is complete, the parent process is used to send a startup signal to the service process that depends on the child process, so that the service process is started.

2. The time-sharing startup method of a process according to claim 1, characterized in that: After the step of using the parent process to send a start signal to the service process that depends on the child process so as to start the service process, the method further includes: After the service process is started, the parent process is used to send a signal describing the successful start of the service process to other parent processes in the system.

3. The time-sharing startup method of a process according to claim 2, characterized in that: When the system is a Linux system, the parent process is connected to other parent processes through a Dbus data bus.

4. The time-sharing startup method of a process according to claim 1, characterized in that: The step of confirming that the subprocess is started successfully includes: When the child process creates a communication connection with the parent process and the child process sends a startup success message to the parent process through the communication connection, it is confirmed that the startup of the child process is completed.

5. The time-sharing startup method of a process according to claim 4, characterized in that: When the system is a Linux system, the child process is connected to the parent process through a fifo data buffer.

6. The time-sharing startup method of a process according to claim 1, characterized in that: The time-sharing startup method of the process also includes: When the amount of used data in the log file reaches a data amount threshold, the earliest data stored in the log file is deleted.

7. A time-sharing startup device for a process, characterized in that: The time-sharing starting device of the process includes: A creation module, used for creating a parent process when the system is started, wherein the parent process is used for receiving a preset signal of interest in the system; A receiving module, configured to set the parent process to a blocked state when the preset signal of interest received by the process does not meet the service startup requirement; When the parent process has received the preset interest signal and the service startup requirement is met, a child process is created; The startup module is used to use the parent process to send a startup signal to the service process that depends on the child process after confirming that the child process has been started, so that the service process is started.

8. A computer device comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the time-sharing startup method of a process described in any one of claims 1 to 7.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the time-sharing startup method of a process described in any one of claims 1 to 7 are implemented.

10. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the steps of the method for time-sharing startup of a process according to any one of claims 1 to 7 are implemented.