A program startup method, device, equipment and medium
By optimizing message processing using priority queues and bidirectional pointers in application startup, the problem of long application startup times is solved, achieving faster startup speed and user interface refresh.
Patent Information
- Application Number
- CN202110181075.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-09
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2041-02-09
AI Technical Summary
The application takes a long time to start, mainly due to the first-in-first-out logic of message processing, which causes the user interface and interactive messages to be delayed, increasing the startup time.
Using the priority queue mechanism, by receiving the startup request of the target application, it obtains the startup message queue containing interactive messages and user interface messages, and executes the tasks corresponding to the priority queue based on the queue information of the priority queue. It uses bidirectional pointers to optimize message processing and avoid Traversal of the entire message queue.
Significantly improves the startup speed of applications, prioritizes interaction and user interface related messages, quickly refreshes and draws applications, and reduces startup time.
Smart Images

Figure CN112799822B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of terminal technology, and in particular to a program startup method, device, equipment and medium. Background Art
[0002] With the development of Internet technology and terminal technology, realizing various functions through application programs on smart terminals has become an important part of people's lives.
[0003] Currently, there are problems with the application taking a long time to start up and starting up slowly during the startup process. Summary of the invention
[0004] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a program startup method, apparatus, device and medium.
[0005] The present disclosure provides a method for starting a program, the method comprising:
[0006] Receive a start request of a target application, and obtain a start message queue of the target application, wherein the start message queue includes a priority queue, and the priority queue includes an interactive message and a user interface message;
[0007] Execute the task corresponding to the priority queue based on the queue information of the priority queue, wherein the queue information of the priority queue includes a priority queue head, a priority queue tail and a priority pointer of the priority queue;
[0008] After the execution of the task corresponding to the priority queue is completed, the tasks corresponding to the remaining queues in the startup message queue except the priority queue are executed to start the target application.
[0009] The present disclosure also provides a program startup device, the device comprising:
[0010] A message queue module, used to receive a start request of a target application and obtain a start message queue of the target application, wherein the start message queue includes a priority queue, and the priority queue includes an interactive message and a user interface message;
[0011] A priority queue module, configured to execute a task corresponding to the priority queue based on queue information of the priority queue, wherein the queue information of the priority queue includes a priority queue head, a priority queue tail and a priority pointer of the priority queue;
[0012] The program startup module is used to execute the tasks corresponding to the remaining queues in the startup message queue except the priority queue after the execution of the task corresponding to the priority queue is completed, so as to start the target application.
[0013] An embodiment of the present disclosure also provides an electronic device, which includes: a processor; a memory for storing executable instructions of the processor; the processor is used to read the executable instructions from the memory and execute the instructions to implement the program startup method provided by the embodiment of the present disclosure.
[0014] The embodiment of the present disclosure further provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute the program startup method provided by the embodiment of the present disclosure.
[0015] The technical solution provided by the disclosed embodiment has the following advantages over the prior art: the program startup solution provided by the disclosed embodiment receives the startup request of the target application and obtains the startup message queue of the target application, wherein the startup message queue includes a priority queue, and the priority queue includes interactive messages and user interface messages; the task corresponding to the priority queue is executed based on the queue information of the priority queue, wherein the queue information of the priority queue includes the priority queue head, the priority queue tail and the priority pointer of the priority queue; after the task corresponding to the priority queue is executed, the tasks corresponding to the remaining queues in the startup message queue except the priority queue are executed to start the target application. By adopting the above technical solution, the tasks corresponding to the messages related to the interaction and the user interface are executed preferentially in the process of starting the application, and the tasks of the messages are executed based on the queue head, the queue tail and the pointer of the priority queue, thereby avoiding the traversal of the entire message queue, saving the traversal time, and effectively improving the startup speed of the application. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0017] Figure 1 A flowchart of a program startup method provided by an embodiment of the present disclosure;
[0018] Figure 2 A schematic diagram of starting a message queue provided in an embodiment of the present disclosure;
[0019] Figure 3 A flowchart of another program startup method provided by an embodiment of the present disclosure;
[0020] Figure 4 A schematic diagram of another method for starting a message queue provided in an embodiment of the present disclosure;
[0021] Figure 5 A schematic diagram of another method of starting a message queue provided in an embodiment of the present disclosure;
[0022] Figure 6 A schematic diagram of the structure of a program startup device provided by an embodiment of the present disclosure;
[0023] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0024] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0025] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0026] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0027] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0028] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0029] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0030] During the startup process of an application, since the processing of messages is usually queued and processed according to the first-in-first-out logic, it may take a long time to start the application, and the application may start slowly because non-user interface (UI) messages, such as broadcast, service and business logic messages, are processed first. At present, the startup speed can be improved through the mechanism of priority information processing in the Android system, but the above method needs to traverse the entire queue to obtain this priority information when processing messages, which increases the traversal time. The startup time is still long and the startup is slow. In order to solve the above problems, the embodiments of the present disclosure provide a program startup method, which is introduced in conjunction with specific embodiments below.
[0031] Figure 1 The present invention provides a flowchart of a program startup method provided by an embodiment of the present invention. The method can be executed by a program startup device, wherein the device can be implemented by software and / or hardware and can generally be integrated in an electronic device. Figure 1 As shown, the method includes:
[0032] Step 101: Receive a start request of a target application and obtain a start message queue of the target application, wherein the start message queue includes a priority queue, and the priority queue includes interactive messages and user interface messages.
[0033] Among them, the target application refers to any application that needs to be started, and the operating system where the target application is located is not limited. In the embodiment of the present disclosure, the target application in the Android system is used as an example for explanation. The startup message queue refers to the collection of messages corresponding to the tasks that need to be executed when the target application is started, and the messages are stored in the form of a queue. The priority queue refers to the collection of messages that need to be processed first in the startup message queue. In the embodiment of the present disclosure, the messages in the priority queue may include messages related to the user interface and interaction, that is, the priority queue includes messages such as interaction messages and user interface messages. For example, in the Android system, since the EXECUTE_TRANSACTION type message is mainly used to process messages related to the interaction and user interface during the application startup process, this type of message is a message in the priority queue.
[0034] Specifically, by detecting the user's trigger operation, a start request of the target application can be received. After receiving the start request, the start message queue of the target application can be obtained to prepare for subsequent start. The start message queue may include a pre-set priority queue. The above start request can be generated based on the user's trigger operation. The form of the trigger operation is not limited. For example, the trigger operation can be a user clicking on the icon of the target application.
[0035] Optionally, the above-mentioned start request can be a cold start request or a hot start request. The above-mentioned cold start means that when the application is started, there is no process of the application in the background, and a new process needs to be created and assigned to the application. For example, after an application is killed in the background, the application is restarted. This startup method is a cold start. A hot start refers to starting an application from an existing process when there is an existing process. Since a large number of messages need to be processed during a cold start, the embodiment of the present disclosure is described by taking a cold start request as an example.
[0036] In the disclosed embodiment, after receiving the start request of the target application, it may also include: inputting the message required for starting the target application into the start message queue, and adding an initial bidirectional pointer between adjacent messages according to the order in which the messages in the start message queue are enqueued, wherein the start message queue is a bidirectional queue, and the initial bidirectional pointer includes a forward pointer and a backward pointer.
[0037] After receiving the startup request of the target application, the program startup device can create a startup message queue, obtain the message required for startup, and enter the message into the startup message queue. Then, it can add an initial bidirectional pointer between adjacent messages according to the order in which each message is enqueued. The initial bidirectional pointer can include a forward pointer and a backward pointer, so the startup message queue is a bidirectional queue.
[0038] Step 102: Execute a task corresponding to the priority queue based on the queue information of the priority queue, wherein the queue information of the priority queue includes a priority queue head, a priority queue tail, and a priority pointer of the priority queue.
[0039] Among them, the queue information of the priority queue can be understood as information used to distinguish the messages of the priority queue from other messages, and is also used to process the messages in the priority queue. In the embodiment of the present disclosure, the queue information of the priority queue may include the priority queue head, priority queue tail and priority pointer of the priority queue. The priority pointer is used to represent the order of messages in the priority queue.
[0040] In the disclosed embodiment, before executing step 102, the process of enqueuing messages in the startup message queue may also include: determining a priority queue in the startup message queue, determining a priority queue head and a priority queue tail in the priority queue based on the order in which each message in the priority queue is enqueued, and adding a priority pointer between adjacent messages in the priority queue. For the messages included in the startup message queue, interactive messages and user interface messages may be determined as messages in the priority queue when enqueuing. After the message enqueuing is completed, a priority queue head may be added to the first message enqueued in the priority queue, and a priority queue tail may be added to the last message enqueued. Priority pointers may be added between adjacent messages according to the order in which each message in the priority queue is enqueued to indicate the order of the messages.
[0041] For example, Figure 2 A schematic diagram of starting a message queue provided by an embodiment of the present disclosure, such as Figure 2 As shown in the figure, a startup message queue is shown. The messages in the startup message queue may include B1, B2, A1, C1, A2, B3, A3, and A4 in the figure in the order of entering the queue. "Pre" in the figure represents the forward pointer and "next" represents the backward pointer. When the message is entered into the queue, it can be determined that A1, A2, A3, and A4 form a priority queue by judging the message attributes. In the figure, "prioritynext" represents the priority pointer. The head of the priority queue points to A1, and the tail of the priority queue points to A4.
[0042] In an embodiment of the present disclosure, after obtaining the startup message queue of the target application, the task corresponding to the priority queue is executed based on the queue information of the priority queue, including: starting from the head of the priority queue, extracting the messages pointed to by each priority pointer from the priority queue as messages to be executed in sequence, and executing the tasks corresponding to the messages to be executed until the tail of the priority queue is reached, wherein the number of priority pointers is at least one.
[0043] When the messages in the priority queue are processed preferentially, the first message pointed to by the priority pointer at the head of the priority queue can be extracted as a message to be executed, and the task corresponding to the first message can be executed. Then, the second message pointed to by the priority pointer of the first message can be extracted as a message to be executed, and the task corresponding to the second message can be executed, and the execution can be carried out in sequence until the tail of the priority queue is reached. For example, see Figure 2 First, execute the task corresponding to message A1 pointed to by the priority pointer at the head of the priority queue, and then execute the tasks corresponding to messages A2, A3, and A4 in sequence according to the priority pointer.
[0044] In the above scheme, based on the queue information of the queue head, queue tail and pointer in the priority queue, the traversal of the entire message queue in the existing scheme can be avoided, thereby improving the startup speed. Since the messages in the priority queue are interactive messages and user interface messages, the priority processing of messages in the priority queue can enable the step of refreshing the screen to run earlier, thereby achieving faster drawing of the first frame during the application startup process, thereby improving the startup speed.
[0045] Step 103: After the task corresponding to the priority queue is executed, the tasks corresponding to the remaining queues in the startup message queue except the priority queue are executed to start the target application.
[0046] The remaining queue refers to the queue composed of other messages in the startup message queue except the messages in the priority queue. After the tasks corresponding to the priority queue are completed, the tasks corresponding to the remaining queue can be executed, and after the execution is completed, the target application can be completely started.
[0047] In the disclosed embodiment, the program startup method may further include: in the process of executing the task corresponding to the priority queue, updating the initial bidirectional pointer of the remaining queue according to the initial bidirectional pointer of the target message of the task that has been executed, and obtaining the target bidirectional pointer of the remaining queue. The target message refers to the message that has been processed in the priority queue. In the process of executing the task corresponding to the priority queue, after each message is executed, the forward pointer and the backward pointer of the target message can update the initial bidirectional pointer of the message associated with the target message in the remaining queue, and obtain the updated target bidirectional pointer of the remaining queue.
[0048] Optionally, the initial bidirectional pointer of the remaining queue is updated according to the initial bidirectional pointer of the target message of the executed task to obtain the target bidirectional pointer of the remaining queue, including: determining the first message pointed to by the forward pointer of the target message, and modifying the target message pointed to by the backward pointer of the first message to the second message pointed to by the backward pointer of the target message, and modifying the target message pointed to by the forward pointer of the second message to the first message, to obtain the target bidirectional pointer of the remaining queue, wherein the first message and the second message are messages in the remaining queue.
[0049] For the target message that has been processed, the first message pointed to by the forward pointer of the target message and the second message pointed to by the backward pointer are both messages in the remaining queue. Since the target message needs to be deleted after execution is completed, the backward pointer of the first message initially points to the target message and is modified to point to the second message. The forward pointer of the second message also initially points to the target message and is modified to the first message. That is, the first message and the second message become adjacent messages, and the bidirectional pointers change accordingly.
[0050] Therefore, the above execution of the tasks corresponding to the remaining queues except the priority queue in the startup message queue may include: extracting each message in the remaining queue in turn according to the target bidirectional pointer of the remaining queue and the remaining queue head, and executing the corresponding tasks. Among them, the remaining queue head is the queue head of the startup message queue. After the execution of the tasks corresponding to the priority queue is completed, the messages in the remaining queue can be extracted in turn according to the remaining queue head and the target bidirectional pointer after the remaining queue is updated, and the tasks corresponding to the messages are executed, and the remaining queue head keeps moving forward until no message can be extracted and the task execution is completed.
[0051] In the current solution, the message queue is a one-way queue. When updating the pointer after the message is executed, it is necessary to re-traverse from the queue head, which takes a long time. In the above solution, since the startup message queue is a two-way queue, during the message processing in the priority queue, the two-way pointer of the remaining queue can be quickly updated based on the two-way pointer. The correctness of message processing in the priority queue and the remaining queue can be guaranteed without any traversal, and the efficiency of message processing is improved.
[0052] The program startup scheme provided by the embodiment of the present disclosure obtains the startup message queue of the target application, wherein the startup message queue includes a priority queue, wherein the priority queue includes interactive messages and user interface messages; based on the queue information of the priority queue, the task corresponding to the priority queue is executed, wherein the queue information of the priority queue includes the priority queue head, the priority queue tail and the priority pointer of the priority queue; after the task corresponding to the priority queue is executed, the tasks corresponding to the remaining queues in the startup message queue except the priority queue are executed to start the target application. By adopting the above technical scheme, tasks corresponding to messages related to interaction and user interface are executed preferentially in the process of starting the application, and tasks of messages are executed based on the queue head, the queue tail and the pointer of the priority queue, thereby avoiding traversal of the entire message queue, saving traversal time, and effectively improving the startup speed of the application.
[0053] Figure 3 This is a flow chart of another program startup method provided by the embodiment of the present disclosure; based on the above embodiment, this embodiment further optimizes the above program startup method. Figure 3 As shown, the method includes:
[0054] Step 201: Receive a start request of a target application.
[0055] Wherein, the start request includes a hot start request or a cold start request;
[0056] Step 202: Input the message required for starting the target application into the startup message queue, and add an initial bidirectional pointer between adjacent messages according to the order in which the messages in the startup message queue are queued.
[0057] The startup message queue is a bidirectional queue, and the initial bidirectional pointer includes a forward pointer and a backward pointer.
[0058] Step 203: determine the priority queue in the startup message queue, determine the priority queue head and the priority queue tail in the priority queue based on the order in which the messages in the priority queue are enqueued, and add priority pointers between adjacent messages in the priority queue.
[0059] Step 204: Obtain the startup message queue of the target application.
[0060] The startup message queue includes a priority queue, and the priority queue includes interaction messages and user interface messages.
[0061] Step 205: Execute the task corresponding to the priority queue based on the queue information of the priority queue.
[0062] The queue information of the priority queue includes a priority queue head, a priority queue tail and a priority pointer of the priority queue.
[0063] Optionally, the task corresponding to the priority queue is executed based on the priority queue head and priority pointer of the priority queue, including: starting from the priority queue head, extracting the messages pointed to by each priority pointer from the priority queue as messages to be executed in sequence, and executing the tasks corresponding to the messages to be executed until the priority queue tail is reached, wherein the number of priority pointers is at least one.
[0064] Step 206: In the process of executing the task corresponding to the priority queue, the initial bidirectional pointers of the remaining queues are updated according to the initial bidirectional pointers of the target messages of the executed tasks to obtain the target bidirectional pointers of the remaining queues.
[0065] Optionally, the initial bidirectional pointer of the remaining queue is updated according to the initial bidirectional pointer of the target message of the executed task to obtain the target bidirectional pointer of the remaining queue, including: determining the first message pointed to by the forward pointer of the target message, and modifying the target message pointed to by the backward pointer of the first message to the second message pointed to by the backward pointer of the target message, and modifying the target message pointed to by the forward pointer of the second message to the first message, to obtain the target bidirectional pointer of the remaining queue, wherein the first message and the second message are messages in the remaining queue.
[0066] For example, Figure 4 A schematic diagram of another method of starting a message queue provided in an embodiment of the present disclosure is shown. Figure 4 The startup message queue in Figure 3 Same, such as Figure 4 As shown, assuming that A1 has been processed, A1 is the target message. The dotted arrow related to A1 in the figure represents the pointer that needs to be updated. The backward pointer of B2 can be modified to point to C1. B2 can be obtained through the forward pointer of A1, and C1 can be obtained through the backward pointer of A1. The forward pointer of C1 is modified to point to B2.
[0067] Step 207: After the execution of the task corresponding to the priority queue is completed, the tasks corresponding to the remaining queues in the startup message queue except the priority queue are executed to start the target application.
[0068] Optionally, executing tasks corresponding to remaining queues in the startup message queue except the priority queue includes: extracting messages in the remaining queues in sequence according to target bidirectional pointers of the remaining queues and the remaining queue heads, and executing corresponding tasks.
[0069] Next, the program startup method in the embodiment of the present disclosure is further explained through a specific example. Taking the Android system as an example, the embodiment of the present disclosure transforms the Android hander so that it has both the ordinary queue and the priority queue functions, and can flexibly control the start and end points of the priority queue. Specifically, when the message of the target application is queued, the message queue is started to realize a bidirectional queue and determine the priority queue. There is a separate priority pointer for the priority queue. This design is to achieve the update of the original queue and the priority queue without traversal, such as Figure 2 As shown, the three pointers are the forward pointer "pre", the backward pointer "next" and the priority pointer "priorityNext" in the figure.
[0070] When processing messages on the startup message queue, in the first case, see Figure 5 , Figure 5 A schematic diagram of another startup message queue provided for an embodiment of the present disclosure, assuming that the priority queue has not been enabled, that is, the priority queue is included in the timely startup message queue, but the function of the priority queue has not been enabled, then the messages in the startup message queue are processed normally in a first-in-first-out order, and B1, B2, and A1 in the figure are processed respectively. The queue update situation can be: for the remaining queues in the startup message queue, B1 and B2 are processed respectively, and when A1 is processed, the remaining queue head points to C1; for the priority queue, the priority queue head is updated from A1 to A2, and A2 is obtained by the priority pointer of A1. After processing B1, B2, and A1, the remaining messages for the remaining queues are C1, A2, B3, A3, and A4, and the remaining messages for the priority queues are A2, A3, and A4.
[0071] In the second case, see Figure 4 , assuming that the priority queue is enabled, the messages in the priority queue are processed first, such as Figure 4 After processing A1, the queue pointer can be updated. For the priority queue, the priority pointer of the priority queue head can be pointed to A2, and A2 can be obtained through the back pointer of A1; for the remaining queues, the back pointer of B2 can be modified to point to C1, B2 is obtained through the forward pointer of A1, C1 can be obtained through the back pointer of A1, and the forward pointer of C1 is modified to point to B2. If B2 is empty, that is, A1 is the first information of the remaining queue, then the head of the remaining queue is directly pointed to C1. After processing A1, the remaining messages for the remaining queue are B1, B2, C1, A2, B3, A3 and A4, and the remaining messages for the priority queue are A2, A3, A4. In the third case, after the application is started, the native queue execution logic can be restored.
[0072] In the disclosed embodiment, taking the cold start of an application in an Android system as an example, the priority queue function is implemented on the basis of ensuring that the native handler queue messages in the Android system are unchanged, so that the Android Hander message processing mechanism has both the queue first-in-first-out function and the priority queue function. And by utilizing this priority queue function, the messages related to the Android UI (EXECUTE_TRANSACTION) are prioritized during the startup of the program, so that the life cycle and user interface messages are prioritized during the cold start process to improve the display speed of the first frame, thereby improving the cold start speed.
[0073] The program startup scheme provided by the embodiment of the present disclosure receives the startup request of the target application, inputs the message required for the startup of the target application into the startup message queue, adds an initial bidirectional pointer between adjacent messages according to the queue order of each message in the startup message queue, determines the priority queue in the startup message queue, determines the priority queue head and the priority queue tail in the priority queue based on the queue order of each message in the priority queue, adds a priority pointer between adjacent messages in the priority queue, obtains the startup message queue of the target application, and executes the task corresponding to the priority queue based on the queue information of the priority queue; in the process of executing the task corresponding to the priority queue, updates the initial bidirectional pointer of the remaining queue according to the initial bidirectional pointer of the target message that has been executed, obtains the target bidirectional pointer of the remaining queue, and after the task corresponding to the priority queue is executed, executes the tasks corresponding to the remaining queues in the startup message queue except the priority queue to start the target application. By adopting the above technical scheme, in the process of starting the application, the tasks corresponding to the messages related to the interaction and the user interface are executed first, and the tasks of the messages are executed based on the queue head, the queue tail and the pointer of the priority queue, avoiding the traversal of the entire message queue, saving the traversal time, and effectively improving the startup speed of the application.
[0074] Figure 6 This is a schematic diagram of the structure of a program startup device provided by an embodiment of the present disclosure. The device can be implemented by software and / or hardware and can generally be integrated into an electronic device. Figure 6 As shown, the device comprises:
[0075] The message queue module 301 is used to receive a start request of a target application and obtain a start message queue of the target application, wherein the start message queue includes a priority queue, and the priority queue includes an interactive message and a user interface message;
[0076] A priority queue module 302, configured to execute a task corresponding to the priority queue based on queue information of the priority queue, wherein the queue information of the priority queue includes a priority queue head, a priority queue tail, and a priority pointer of the priority queue;
[0077] The program starting module 303 is used to execute the tasks corresponding to the remaining queues in the starting message queue except the priority queue after the execution of the task corresponding to the priority queue is completed, so as to start the target application.
[0078] Optionally, the priority queue module 302 is specifically used for:
[0079] Starting from the head of the priority queue, the messages pointed to by each priority pointer in the priority queue are extracted as to-be-executed messages in turn, and the tasks corresponding to the to-be-executed messages are executed until the tail of the priority queue is reached, wherein the number of the priority pointers is at least one.
[0080] Optionally, the device further comprises a startup queue module, which is used to, after receiving a startup request of the target application,
[0081] The message required for starting the target application is input into the startup message queue, and an initial bidirectional pointer is added between adjacent messages according to the order in which the messages in the startup message queue are enqueued, wherein the startup message queue is a bidirectional queue, and the initial bidirectional pointer includes a forward pointer and a backward pointer.
[0082] Optionally, the device further comprises a priority module, configured to:
[0083] Determine a priority queue in the startup message queue, determine a priority queue head and a priority queue tail in the priority queue based on the order in which each message in the priority queue is enqueued, and add the priority pointer between adjacent messages in the priority queue.
[0084] Optionally, the device further includes a pointer updating module, configured to:
[0085] In the process of executing the task corresponding to the priority queue, the initial bidirectional pointer of the remaining queue is updated according to the initial bidirectional pointer of the target message of the executed task to obtain the target bidirectional pointer of the remaining queue.
[0086] Optionally, the pointer updating module is specifically used for:
[0087] Determine the first message pointed to by the forward pointer of the target message, and modify the target message pointed to by the backward pointer of the first message to the second message pointed to by the backward pointer of the target message, and modify the target message pointed to by the forward pointer of the second message to the first message, to obtain the target bidirectional pointer of the remaining queue, wherein the first message and the second message are messages in the remaining queue.
[0088] Optionally, the program startup module 303 is specifically used for:
[0089] According to the target bidirectional pointer of the remaining queue and the remaining queue head, the messages in the remaining queue are extracted in sequence, and the corresponding tasks are executed.
[0090] The program startup device provided in the embodiments of the present disclosure can execute the program startup method provided in any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
[0091] An embodiment of the present disclosure provides a computer program product, including a computer program / instruction, which implements the program startup method provided by any embodiment of the present disclosure when the computer program / instruction is executed by a processor.
[0092] Figure 7 This is a schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure. Figure 7 , which shows a schematic diagram of the structure of an electronic device 400 suitable for implementing the embodiment of the present disclosure. The electronic device 400 in the embodiment of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 7 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0093] like Figure 7 As shown, the electronic device 400 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 401, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 402 or a program loaded from a storage device 408 into a random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the electronic device 400 are also stored. The processing device 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0094] Typically, the following devices may be connected to the I / O interface 405: an input device 406 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 407 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 408 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 409. The communication device 409 may allow the electronic device 400 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 7The electronic device 400 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0095] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 409, or installed from a storage device 408, or installed from a ROM 402. When the computer program is executed by the processing device 401, the above-mentioned functions defined in the program startup method of the embodiment of the present disclosure are executed.
[0096] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0097] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0098] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0099] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the electronic device, the electronic device: receives a startup request of a target application and obtains a startup message queue of the target application, wherein the startup message queue includes a priority queue, and the priority queue includes interactive messages and user interface messages; executes the task corresponding to the priority queue based on the queue information of the priority queue, wherein the queue information of the priority queue includes a priority queue head, a priority queue tail and a priority pointer of the priority queue; after the execution of the task corresponding to the priority queue is completed, executes the tasks corresponding to the remaining queues in the startup message queue except the priority queue to start the target application.
[0100] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0101] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0102] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit does not, in some cases, limit the unit itself.
[0103] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0104] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0105] According to one or more embodiments of the present disclosure, the present disclosure provides a program startup method, including:
[0106] Receive a start request of a target application, and obtain a start message queue of the target application, wherein the start message queue includes a priority queue, and the priority queue includes an interactive message and a user interface message;
[0107] Execute the task corresponding to the priority queue based on the queue information of the priority queue, wherein the queue information of the priority queue includes a priority queue head, a priority queue tail and a priority pointer of the priority queue;
[0108] After the execution of the task corresponding to the priority queue is completed, the tasks corresponding to the remaining queues in the startup message queue except the priority queue are executed to start the target application.
[0109] According to one or more embodiments of the present disclosure, in the program startup method provided by the present disclosure, executing the task corresponding to the priority queue based on the queue information of the priority queue includes:
[0110] Starting from the head of the priority queue, the messages pointed to by each priority pointer in the priority queue are extracted as to-be-executed messages in turn, and the tasks corresponding to the to-be-executed messages are executed until the tail of the priority queue is reached, wherein the number of the priority pointers is at least one.
[0111] According to one or more embodiments of the present disclosure, in the program startup method provided by the present disclosure, after receiving a startup request of a target application, the method further includes:
[0112] The message required for starting the target application is input into the startup message queue, and an initial bidirectional pointer is added between adjacent messages according to the order in which the messages in the startup message queue are enqueued, wherein the startup message queue is a bidirectional queue, and the initial bidirectional pointer includes a forward pointer and a backward pointer.
[0113] According to one or more embodiments of the present disclosure, the program startup method provided by the present disclosure further includes:
[0114] Determine a priority queue in the startup message queue, determine a priority queue head and a priority queue tail in the priority queue based on the order in which each message in the priority queue is enqueued, and add the priority pointer between adjacent messages in the priority queue.
[0115] According to one or more embodiments of the present disclosure, the program startup method provided by the present disclosure further includes:
[0116] In the process of executing the task corresponding to the priority queue, the initial bidirectional pointer of the remaining queue is updated according to the initial bidirectional pointer of the target message of the executed task to obtain the target bidirectional pointer of the remaining queue.
[0117] According to one or more embodiments of the present disclosure, in the program startup method provided by the present disclosure, updating the initial bidirectional pointer of the remaining queue according to the initial bidirectional pointer of the target message of the executed task to obtain the target bidirectional pointer of the remaining queue includes:
[0118] Determine the first message pointed to by the forward pointer of the target message, and modify the target message pointed to by the backward pointer of the first message to the second message pointed to by the backward pointer of the target message, and modify the target message pointed to by the forward pointer of the second message to the first message, to obtain the target bidirectional pointer of the remaining queue, wherein the first message and the second message are messages in the remaining queue.
[0119] According to one or more embodiments of the present disclosure, in the program startup method provided by the present disclosure, executing tasks corresponding to the remaining queues in the startup message queue except the priority queue includes:
[0120] According to the target bidirectional pointer of the remaining queue and the remaining queue head, the messages in the remaining queue are extracted in sequence, and the corresponding tasks are executed.
[0121] According to one or more embodiments of the present disclosure, the present disclosure provides a program startup device, including:
[0122] A message queue module, used to receive a start request of a target application and obtain a start message queue of the target application, wherein the start message queue includes a priority queue, and the priority queue includes an interactive message and a user interface message;
[0123] A priority queue module, configured to execute a task corresponding to the priority queue based on queue information of the priority queue, wherein the queue information of the priority queue includes a priority queue head, a priority queue tail and a priority pointer of the priority queue;
[0124] The program startup module is used to execute the tasks corresponding to the remaining queues in the startup message queue except the priority queue after the execution of the task corresponding to the priority queue is completed, so as to start the target application.
[0125] According to one or more embodiments of the present disclosure, in the program startup device provided by the present disclosure, the priority queue module is specifically used to:
[0126] Starting from the head of the priority queue, the messages pointed to by each priority pointer in the priority queue are extracted as to-be-executed messages in turn, and the tasks corresponding to the to-be-executed messages are executed until the tail of the priority queue is reached, wherein the number of the priority pointers is at least one.
[0127] According to one or more embodiments of the present disclosure, in the program startup device provided by the present disclosure, the device further includes a startup queue module, which is used to, after receiving a startup request of a target application program,
[0128] The message required for starting the target application is input into the startup message queue, and an initial bidirectional pointer is added between adjacent messages according to the order in which the messages in the startup message queue are enqueued, wherein the startup message queue is a bidirectional queue, and the initial bidirectional pointer includes a forward pointer and a backward pointer.
[0129] According to one or more embodiments of the present disclosure, in the program startup device provided by the present disclosure, the device further includes a priority module, which is used to:
[0130] Determine a priority queue in the startup message queue, determine a priority queue head and a priority queue tail in the priority queue based on the order in which each message in the priority queue is enqueued, and add the priority pointer between adjacent messages in the priority queue.
[0131] According to one or more embodiments of the present disclosure, in the program startup device provided by the present disclosure, the device further includes a pointer updating module, which is used to:
[0132] In the process of executing the task corresponding to the priority queue, the initial bidirectional pointer of the remaining queue is updated according to the initial bidirectional pointer of the target message of the executed task to obtain the target bidirectional pointer of the remaining queue.
[0133] According to one or more embodiments of the present disclosure, in the program startup device provided by the present disclosure, the pointer update module is specifically used for:
[0134] Determine the first message pointed to by the forward pointer of the target message, and modify the target message pointed to by the backward pointer of the first message to the second message pointed to by the backward pointer of the target message, and modify the target message pointed to by the forward pointer of the second message to the first message, to obtain the target bidirectional pointer of the remaining queue, wherein the first message and the second message are messages in the remaining queue.
[0135] According to one or more embodiments of the present disclosure, in the program startup device provided by the present disclosure, the program startup module is specifically used to:
[0136] According to the target bidirectional pointer of the remaining queue and the remaining queue head, the messages in the remaining queue are extracted in sequence, and the corresponding tasks are executed.
[0137] According to one or more embodiments of the present disclosure, the present disclosure provides an electronic device, including:
[0138] processor;
[0139] a memory for storing instructions executable by the processor;
[0140] The processor is used to read the executable instructions from the memory and execute the instructions to implement any program startup method provided by the present disclosure.
[0141] According to one or more embodiments of the present disclosure, the present disclosure provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program is used to execute any program startup method provided by the present disclosure.
[0142] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0143] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0144] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. A program startup method, It is characterized in that include: Receive a start request of a target application, and obtain a start message queue of the target application, wherein the start message queue includes a priority queue, the priority queue refers to a message set in the start message queue that needs to be processed first, the priority queue includes interactive messages and user interface messages, the start message queue is a bidirectional queue, an initial bidirectional pointer is added between adjacent messages in the start message queue, and the initial bidirectional pointer includes a forward pointer and a backward pointer; Execute the task corresponding to the priority queue based on the queue information of the priority queue, wherein the queue information of the priority queue includes a priority queue head, a priority queue tail and a priority pointer of the priority queue, the priority queue head is used to indicate the message that is first queued in the priority queue, the priority queue tail is used to indicate the message that is last queued in the priority queue, a priority pointer is added between adjacent messages in the priority queue, the priority pointer is used to indicate the order of the messages in the priority queue, and the messages included in the priority queue are simultaneously added with the forward pointer, the backward pointer and the priority pointer; After the execution of the task corresponding to the priority queue is completed, the tasks corresponding to the remaining messages in the startup message queue except for the priority queue are executed to start the target application.
2. The method according to claim 1, It is characterized in that Executing a task corresponding to the priority queue based on the queue information of the priority queue includes: Starting from the head of the priority queue, the messages pointed to by each priority pointer in the priority queue are extracted as to-be-executed messages in turn, and the tasks corresponding to the to-be-executed messages are executed until the tail of the priority queue is reached, wherein the number of the priority pointers is at least one.
3. The method according to claim 1, It is characterized in that After receiving the start request of the target application, it also includes: The message required for starting the target application is input into the startup message queue, and an initial bidirectional pointer is added between adjacent messages according to the order in which the messages in the startup message queue are enqueued, wherein the startup message queue is a bidirectional queue, and the initial bidirectional pointer includes a forward pointer and a backward pointer.
4. The method according to claim 3, It is characterized in that Also includes: Determine a priority queue in the startup message queue, determine a priority queue head and a priority queue tail in the priority queue based on the order in which each message in the priority queue is enqueued, and add the priority pointer between adjacent messages in the priority queue.
5. The method according to claim 3, It is characterized in that Also includes: In the process of executing the task corresponding to the priority queue, the initial bidirectional pointers of the remaining messages are updated according to the initial bidirectional pointers of the target messages of the executed tasks to obtain the target bidirectional pointers of the remaining messages.
6. The method according to claim 5, It is characterized in that Updating the initial bidirectional pointers of the remaining messages according to the initial bidirectional pointers of the target messages whose tasks have been executed, to obtain the target bidirectional pointers of the remaining messages, includes: Determine the first message pointed to by the forward pointer of the target message, and modify the target message pointed to by the backward pointer of the first message to the second message pointed to by the backward pointer of the target message, and modify the target message pointed to by the forward pointer of the second message to the first message, to obtain the target bidirectional pointers of the remaining messages, wherein the first message and the second message are the remaining messages.
7. The method according to claim 6, It is characterized in that Executing tasks corresponding to remaining messages in the startup message queue except the priority queue, including: According to the target bidirectional pointers of the remaining messages and the queue heads of the remaining messages, the remaining messages are extracted in sequence, and corresponding tasks are executed.
8. A program starting device, It is characterized in that include: A message queue module, used to receive a start request of a target application and obtain a start message queue of the target application, wherein the start message queue includes a priority queue, which refers to a collection of messages in the start message queue that need to be processed with priority, and the priority queue includes interactive messages and user interface messages. The start message queue is a bidirectional queue, and an initial bidirectional pointer is added between adjacent messages in the start message queue, and the initial bidirectional pointer includes a forward pointer and a backward pointer; A priority queue module, configured to execute a task corresponding to the priority queue based on queue information of the priority queue, wherein the queue information of the priority queue includes a priority queue head, a priority queue tail and a priority pointer of the priority queue, wherein the priority queue head is used to indicate a message that is first queued in the priority queue, and the priority queue tail is used to indicate a message that is last queued in the priority queue, and a priority pointer is added between adjacent messages in the priority queue, and the priority pointer is used to indicate a sequence of messages in the priority queue, and the messages included in the priority queue are simultaneously added with the forward pointer, the backward pointer and the priority pointer; The program startup module is used to execute the tasks corresponding to the remaining messages in the startup message queue except the priority queue after the execution of the tasks corresponding to the priority queue is completed, so as to start the target application.
9. An electronic device, It is characterized in that The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the instructions to implement the program startup method described in any one of claims 1-7.
10. A computer-readable storage medium, It is characterized in that The storage medium stores a computer program, and the computer program is used to execute the program startup method described in any one of claims 1 to 7.
