Application starting method, electronic device, and storage medium

By dividing the task group into multiple sub-task groups and creating corresponding sub-threads during the application startup process, and having the main thread monitor and take over the sub-thread tasks, the problem of excessively long startup time for large applications is solved, achieving fast response and efficient startup, and improving the user experience.

WO2026066467A1PCT designated stage Publication Date: 2026-04-02HUAWEI TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2025-06-30
Publication Date
2026-04-02

AI Technical Summary

Technical Problem

In existing technologies, the startup process of large applications relies on the main thread to load modules and resources, which leads to extended startup time and makes it difficult to meet users' needs for fast response and efficient startup.

Method used

By dividing the application's task groups into multiple sub-task groups and creating corresponding sub-threads, the main thread monitors the progress of the sub-threads and takes over the execution of the sub-tasks when they are not completed, thus avoiding the repeated execution of completed tasks and optimizing the task execution order of the main thread.

Benefits of technology

It effectively shortens application startup time, improves response speed, enhances user experience, and reduces idle time of the main thread waiting for child threads to complete.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025106350_02042026_PF_FP_ABST
    Figure CN2025106350_02042026_PF_FP_ABST
Patent Text Reader

Abstract

The present application provides an application starting method, an electronic device, and a storage medium. In the method, a main thread creates corresponding sub-threads on the basis of the number of task groups, and each sub-thread is responsible for executing one or more sub-tasks in the corresponding task group. When a first task that the main thread is about to execute is the same as a first sub-task that has not been completed by a sub-thread, the sub-thread stops executing the first sub-task, and then the main thread takes over and completes the first sub-task. In this way, the main thread does not need to re-execute the portion of the subtask that has already been completed by the sub-thread, thereby further accelerating an application starting process. In addition, since the task execution efficiency of the main thread is higher than that of the sub-thread, using the main thread to execute the first sub-task can prevent the main thread from being in an idle state while waiting for the sub-thread to complete the first sub-task, thereby further speeding up the completion of the first sub-task, effectively reducing the response time of a first application, and improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Application starting method, electronic device and storage medium

[0001] The present application claims priority to the Chinese patent application No. 2024113961570, filed on September 30, 2024, and entitled "Application starting method, electronic device and storage medium", the content of which is incorporated herein by reference in its entirety. TECHNICAL FIELD

[0002] The present application relates to the technical field of terminals, and in particular to an application starting method, an electronic device and a storage medium. BACKGROUND

[0003] In the prior art, the starting process of an application program often relies on a main thread to load modules and resources (such as software development kits (SDKs)) corresponding to the application program. This design pattern may cause all loading tasks to be executed on the main thread when facing large-scale applications with complex functions and numerous modules, thereby prolonging the starting time of the application program, reducing the user experience, and being difficult to meet the user demand for fast response and efficient starting of the application program. Therefore, it is urgent to optimize the related design pattern to further reduce the starting delay of the application program and ensure that the user can quickly enter the available state after operating the application icon of the application program. SUMMARY

[0004] The present application provides an application starting method, an electronic device and a storage medium, which can effectively reduce the starting time of the application program.

[0005] To achieve the above-mentioned purpose, the present application adopts the following technical solutions:

[0006] In a first aspect, the present application provides an application starting method, which comprises: determining M task groups corresponding to a first application, each task group comprising one or more sub-tasks, wherein M is an integer greater than or equal to 1; creating M sub-threads corresponding to a main thread according to the M task groups, the main thread being used to start the first application, the sub-threads corresponding to the task groups one by one, and the sub-threads being used to execute one or more sub-tasks in the corresponding task groups; when it is monitored that a first task to be executed by the main thread is a first sub-task in a first task group which is not executed by a first sub-thread, the first sub-thread is notified to stop executing the first sub-task, and the first sub-task is continued to be executed by the main thread, wherein the first sub-thread is one of the M sub-threads, and the first task group is a task group corresponding to the first sub-thread in the M task groups; and starting the first application.

[0007] The application starting method provided by the embodiments of the present application creates sub-threads corresponding to the number of task groups, so that the sub-threads execute a plurality of sub-tasks in the corresponding task groups. When the first task prepared to be executed by the main thread is the same as the first sub-task that has not been executed by the sub-thread, the sub-thread stops executing the first sub-task, and the main thread takes over and executes the first sub-task. In this way, the main thread does not need to repeatedly execute the sub-tasks that have been executed by the sub-thread, so that in the first application starting process, the time for the main thread to execute the sub-tasks that have been executed by the sub-thread can be effectively saved, the first application starting process is further accelerated, and the starting efficiency of the first application is optimized.

[0008] In addition, compared with the first sub-thread continuing to execute the first sub-task, the main thread taking over the execution of the first sub-task from the first sub-thread can avoid the idling of the main thread during the waiting for the first sub-task to be completed by the sub-thread, further accelerates the completion of the first sub-task, effectively reduces the response time of the first application, accelerates the response speed of the first application, and improves the user experience.

[0009] The first application can be any application displayed on the desktop of the electronic device, can be an application encapsulated based on a web kernel, or an application embedded in another application (such as a mini-program).

[0010] It should be understood that the application starting method provided by the embodiments of the present application can be used to trigger any control, application icon or service, so that the electronic device can start the first application in response to the triggering operation.

[0011] In actual design, the specific operation of triggering any control, application icon or service can be clicking, touching, single-clicking, double-clicking, double-finger sliding, or long-pressing any control or application icon for a preset time length, or one or more operations of key input, gesture recognition, body language recognition, speech recognition, expression recognition, eye movement recognition, and face recognition. The present application does not make a specific limitation in this regard.

[0012] For example, in the first application starting process, M task groups can be obtained from the configuration file corresponding to the first application. The M task groups can be predefined in the development process of the first application.

[0013] It should be understood that in the first application starting process, the sub-tasks in the task groups can include error handling, security checking, permission checking, asynchronous task (such as AsyncTask, Loader, etc.) loading, callback and detection, resource loading corresponding to language and region settings, component initialization, debugging, log recording, performance monitoring and optimization, etc.

[0014] The tasks performed by the main thread can not only include multiple subtasks in the task group in the above examples; but also can include window creation, view management (such as measurement, layout, drawing, etc.), initialization operations (such as initializing a database connection, initializing global variables, or network requests, etc.), message loop processing, lifecycle callbacks, etc.

[0015] In a possible implementation of the first aspect, the method further includes: after the main thread finishes executing the first subtask, executing a second subtask, the second subtask and the first subtask being subtasks in a same task group.

[0016] In a possible implementation of the first aspect, the executing the first subtask by the main thread includes: obtaining a task node corresponding to a time when the first subthread stops executing the first subtask; and executing the first subtask by the main thread according to the task node.

[0017] In a possible implementation of the first aspect, the creating M subthreads for starting the main thread of the first application includes: when the number of tasks executed by the main thread is less than or equal to a preset threshold, creating M subthreads according to the M task groups.

[0018] In a possible implementation of the first aspect, the method of creating the M subthreads includes: the main thread calling a first interface to create the M subthreads; and for the first application, the priority of the subthread created through the first interface is higher than the priority of the subthread created through other interfaces.

[0019] In a possible implementation of the first aspect, the first interface includes an ffrt interface and a hander interface.

[0020] In a possible implementation of the first aspect, the M subthreads are all subthreads with the highest priority in the starting process of the first application.

[0021] In a possible implementation of the first aspect, the subtasks in each task group belong to a same task type.

[0022] In a second aspect, the present application provides an electronic device configured to execute the method in any possible implementation of the first aspect.

[0023] Optionally, the electronic device can comprise: a processor configured to: determine M task groups corresponding to starting the first application, each task group comprising one or more sub-tasks, wherein M is an integer greater than or equal to 1; create M sub-threads corresponding to a main thread according to the M task groups, the main thread being used to start the first application, the sub-threads corresponding to the task groups one by one, the sub-threads being used to execute one or more sub-tasks in the corresponding task groups; when it is monitored that a first task to be executed by the main thread is a first sub-task in a first task group that is not executed by a first sub-thread, notify the first sub-thread to stop executing the first sub-task, execute the first sub-task by the main thread, wherein the first sub-thread is one of the M sub-threads, and the first task group is a task group corresponding to the first sub-thread in the M task groups; and start the first application.

[0024] In a possible implementation of the second aspect, the processor is configured to: execute the second sub-task after the first sub-task is executed by the main thread.

[0025] In a possible implementation of the second aspect, executing the first sub-task by the main thread comprises: the processor is configured to acquire a task node corresponding to when the first sub-thread stops executing the first sub-task; and execute the first sub-task by the main thread according to the task node.

[0026] In a possible implementation of the second aspect, creating M sub-threads corresponding to the main thread used to start the first application according to the M task groups comprises: when the number of tasks executed by the main thread is less than a preset threshold, creating the M sub-threads according to the M task groups.

[0027] In a possible implementation of the second aspect, the method for creating the M sub-threads comprises: the main thread calling a first interface to create the M sub-threads.

[0028] In a possible implementation of the second aspect, the first interface comprises an ffrt interface and a hander interface.

[0029] In a possible implementation of the second aspect, the M sub-threads are all sub-threads with the highest priority in the starting process of the first application.

[0030] In a possible implementation of the second aspect, the sub-tasks in each task group belong to the same task type.

[0031] In a third aspect, the present application provides a chip system, the chip system comprising a processor, the processor executing a computer program stored in a memory to implement the method in any possible implementation of the first aspect.

[0032] In a fourth aspect, the present application provides a computer readable storage medium, which stores a computer program. The computer program is executed by a processor to implement the method in any possible implementation manner of the first aspect.

[0033] In a fifth aspect, the present application provides a computer program product, which comprises computer instructions. When the computer instructions are run on an electronic device, the electronic device executes the method in any possible implementation manner of the first aspect.

[0034] The technical effects of the second aspect to the fifth aspect provided in the present application can refer to the technical effects of the various possible implementation manners of the first aspect, which will not be described here again. BRIEF DESCRIPTION OF DRAWINGS

[0035] FIG. 1 is a structural schematic diagram of an electronic device provided in an embodiment of the present application.

[0036] FIG. 2 is a software structural schematic diagram of an electronic device provided in an embodiment of the present application.

[0037] FIG. 3 is a flow schematic diagram corresponding to an application starting process provided in an embodiment of the present application.

[0038] FIG. 4 is a trace recording result schematic diagram of a main thread in an application starting process provided in an embodiment of the present application.

[0039] FIG. 5 is a flow schematic diagram of an application starting method provided in an embodiment of the present application.

[0040] FIG. 6 is an illustrative interaction diagram of an application starting method provided in an embodiment of the present application. DETAILED DESCRIPTION

[0041] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application and related embodiments. In the description of the embodiments of the present application, the terms used in the following embodiments are only for the purpose of describing the specific embodiments and are not intended to be limiting to the present application. As used in the specification and the appended claims of the present application, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that "at least one" and "one or more" as used in the embodiments of the present application refer to one or two or more (including two). The term "and / or" is used to describe the association relationship of the associated objects, which means that there can be three relationships; for example, A and / or B can represent the following three cases: A exists alone, A and B exist together, and B exists alone, where A and B can be singular or plural. The character " / " generally represents an "or" relationship between the associated objects.

[0042] Reference within this specification to "one embodiment" or "an embodiment" or "some embodiments" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the application. The appearances of the phrase "in one embodiment" or "in some embodiments" within this specification do not necessarily refer to the same embodiment, although it can. The terms "including," "comprising," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise. The term "coupled" means either a direct connection or an indirect connection through one or more intervening wires or components, unless otherwise explicitly stated. The terms "first," "second," and "third," etc. are used to describe various elements, but do not connote priority or importance among the elements, and are used only for the purpose of distinguishing between the various elements.

[0043] In the embodiments of the present application, the word "exemplarily" or "for example" is used to represent an example, illustration or description. Any embodiment or design scheme described as "exemplarily" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or having more advantages than other embodiments or design schemes. In fact, the word "exemplarily" or "for example" is used to present the relevant concept in a specific manner.

[0044] The application starting method provided by the embodiments of the present application can be applied to an electronic device. For example, the electronic device can include, but is not limited to, a personal computer (PC), a smart phone, a netbook, a tablet computer, a smart camera, a wearable device, a palm computer, a smart television, a personal digital assistant (PDA), a portable multimedia player (PMP), a projection device, a smart screen device, an augmented reality (AR) / virtual reality (VR) device, a mixed reality (MR) device, a vehicle-mounted device, a smart screen, a cloud server, a television, or a motion sensing game machine in a human-computer interaction scene, etc. The embodiments of the present application do not make any limitation on the specific type of the electronic device.

[0045] Referring to FIG. 1, a structural schematic diagram of an electronic device 100 provided in the present application is shown. The electronic device 100 can include a processor 110, an external memory interface 120, an internal memory 131, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a loudspeaker 170A, a receiver 170B, a microphone 170C, a headset interface 170D, a sensor module 180, a key 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 can include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0046] It can be understood that the structure shown in the embodiments of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 can include more or fewer components than shown, or combine certain components, or split certain components, or different arrangement of components. The components shown can be implemented in hardware, software, or a combination of software and hardware.

[0047] For example, when the electronic device 100 is a mobile phone or a tablet computer, it can include all the components shown, or only include part of the components shown.

[0048] The processor 110 can include one or more processing units, for example: the processor 110 can include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units can be independent devices, or can be integrated into one or more processors.

[0049] The controller can be the nerve center and command center of the electronic device 100. The controller can generate operation control signals according to instruction operation codes and timing signals, and complete the control of instruction fetching and instruction execution.

[0050] The processor 110 can also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory can store instructions or data that have just been used or are recycled by the processor 110. If the processor 110 needs to use the instructions or data again, it can be directly called from the memory. This avoids repeated access and reduces the waiting time of the processor 110, thereby improving the efficiency of the system.

[0051] In some embodiments, the processor 110 can include one or more interfaces. The interfaces can include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0052] The electronic device 100 realizes display functions through a GPU, a display screen 194, and an application processor, etc. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 can include one or more GPUs that execute program instructions to generate or change display information. The display screen 194 is used to display images, videos, etc.

[0053] The external memory interface 120 can be used to connect an external storage card, such as a Micro SD card, to realize the expansion of the storage capacity of the electronic device 100. The external storage card communicates with the processor 110 through the external memory interface 120 to realize the data storage function. For example, music, video, etc. files are saved in the external storage card.

[0054] The internal memory 131 can be used to store computer executable program codes including instructions. The processor 110 performs various function applications and data processing of the electronic device 100 by executing the instructions stored in the internal memory 131. The internal memory 131 can include a program storage area and a data storage area. The program storage area can store an operating system, at least one application program (e.g., a sound play function, an image play function, etc.) required for at least one function. The data storage area can store data (e.g., audio data, a phone book, etc.) created during the use of the electronic device 100.

[0055] In addition, the internal memory 131 can include a high-speed random access memory and can further include a non-volatile memory such as at least one of a magnetic disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0056] The software system of the electronic device 100 can employ a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. For example, the software system of the electronic device 100 can employ a layered architecture in which the software system is divided into a plurality of layers. For example, the software system of the electronic device 100 can employ a layered architecture in which the software system is divided into a plurality of layers. For example, the software system of the electronic device 100 can employ a layered architecture in which the software system is divided into a plurality of layers.

[0057] Referring to FIG. 2, a software structure block diagram of the electronic device 100 according to an embodiment of the disclosure is illustrated.

[0058] In some embodiments, the layered architecture can divide software into a plurality of layers, each of which has a clear role and division of labor. Layers communicate with each other through a software interface. In some embodiments, the operating system is divided into four layers, from top to bottom, an application layer, an application framework layer, a runtime and system library, and a kernel layer.

[0059] The application layer can include a series of application packages.

[0060] As illustrated in FIG. 2, the application packages can include camera, gallery, calendar, call, memo, navigation, WLAN, Bluetooth, music, video, short message, etc.

[0061] The application framework layer provides an application programming interface (API) and a programming framework for the applications of the application layer. The application framework layer includes some pre-defined functions.

[0062] As shown in FIG. 2, the application framework layer can include a runtime management service, a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, etc.

[0063] The runtime management service can be a type of service in the operating system, which is used to manage the running of an application, such as managing the life cycle of an activity, etc. For most applications, there can be components of a user interface, which are mainly used to interact with a user, such as making a phone call, sending an email, and viewing a map, etc. Most of the content that a user can see in an application is provided by such components. For example, for different operating systems, the components of the user interface can be an ability or an activity or a UI view controller. For ease of understanding, in the following, an ability is mainly taken as an example.

[0064] During the starting process of an application, the runtime management service is mainly used to receive a starting request of an application, to implement functions such as managing the life cycle of an application, managing the application process of an application and the components corresponding to the process, and being responsible for the scheduling of the application process to adjust the running state of an application, etc.

[0065] The window manager is used to manage a window program. The window manager can obtain the size of a display screen, judge whether there is a status bar, lock a screen, and intercept a screen, etc.

[0066] The content provider is used to store and obtain data, and make the data accessible by an application. The data can include a video, an image, an audio, a phone call, a browsing history and a bookmark, a phone book, etc.

[0067] The view system includes visual controls, such as a control for displaying text, a control for displaying a picture, etc. The view system can be used to build an application. A display interface can be composed of one or more views. For example, a display interface including a short message notification icon can include a view for displaying text and a view for displaying a picture.

[0068] The phone manager is used to provide a communication function of the electronic device 100. For example, the management of a call state (including connecting, hanging up, etc.).

[0069] The resource manager provides various resources for an application, such as a localized string, an icon, a picture, a layout file, a video file, etc.

[0070] The notification manager enables applications to display notification information in the status bar, which can be used to convey alert-type messages that can automatically disappear after a brief stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the form of a chart or a scroll bar text in the top status bar of the system, such as a notification of an application running in the background, and can also be a notification that appears in the form of a dialog window on the screen. For example, the notification manager can be used to display text information in the status bar, issue a prompt sound, vibrate the electronic device, flash the indicator light, etc.

[0071] The runtime includes a core library and a virtual machine. The runtime is responsible for scheduling and management of the operating system.

[0072] The system library can include a plurality of functional modules. For example, a surface manager, media libraries, a three-dimensional graphics processing library (for example, OpenGL ES), a 2D graphics engine (for example, SGL), etc.

[0073] The surface manager is used to manage the display subsystem and provides a fusion of 2D and 3D layers for a plurality of applications.

[0074] The media library supports a plurality of commonly used audio, video format playback and recording, and static image files, etc. The media library can support a plurality of audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, etc.

[0075] The three-dimensional graphics processing library is used to implement three-dimensional graphics drawing, image rendering, synthesis, and layer processing, etc.

[0076] The 2D graphics engine is a drawing engine for 2D drawing.

[0077] The kernel layer is a layer between hardware and software. The kernel layer at least includes a display driver, a camera driver, an audio driver, and a sensor driver.

[0078] In order to better understand the embodiments of the present application, first, the starting process of any application on the desktop of the electronic device 100 is exemplarily introduced in combination with FIG. 3.

[0079] When a user touches an application icon corresponding to an application on the desktop of an electronic device, a start-up process of the application is triggered. In the start-up process of the application, the application (client) first sends an application start request to a running management service (server). As a manager of the application start-up process, the running management service creates and starts an application process corresponding to the application after receiving the application start request sent by the application. The application process then enables a main thread corresponding to the application to execute the code corresponding to the application. After the main thread goes through a series of key stages in the start-up process of the application, the main interface (or home page) corresponding to the application is finally displayed on the desktop of the electronic device.

[0080] Referring to FIG. 3, the above-mentioned multiple key stages can include:

[0081] The first stage: the HandleLaunchApplication stage.

[0082] It can be understood that after the main thread is started, the HandleLaunchApplication stage can be entered first to prepare for the start-up of the application.

[0083] Runtime initialization: The runtime environment of the application is initialized, including starting a virtual machine, loading necessary system libraries (such as libc, libm, etc.), and configuring a class loader (such as PathClassLoader or DexClassLoader) to ensure that the application can smoothly load and execute the corresponding code. For example, the virtual machine can be an Ark virtual machine, a Java virtual machine, or a virtual machine of other programming languages.

[0084] Load extension: According to different applications, extension modules or libraries that the application depends on can be loaded to implement corresponding extension functions, such as security reinforcement, performance optimization, or specific hardware support, etc.

[0085] Get module info: For an application including multiple modules, the module information corresponding to each module, such as the storage path of the module, the dependency, the version, etc., can be obtained in this stage to facilitate subsequent quick loading of the corresponding module.

[0086] The second stage: the HandleLaunchAbility stage.

[0087] This stage is mainly used to load the Ability related to the main interface. It should be understood that the Ability related to the main interface can also be referred to as a main Ability. In combination with the foregoing, the main Ability is a type of component in an application and can be responsible for implementing a business function related to a user interface. This stage mainly involves:

[0088] Converting the memory structure: The memory structure of a compiled bytecode file (for example, an abc.class file) can be converted to execute the corresponding code in the bytecode file, optimize memory usage efficiency, and reduce resource occupation.

[0089] Resource loading strategy: A preset strategy (such as depth first search (DFS) or dependency driving) is used to load resources (such as a Wi-Fi module or a Bluetooth module) required by the main Ability, to ensure that the main interface elements can be correctly rendered.

[0090] Load module: A module in a dynamic-link library (DLL) can be dynamically loaded using a function such as dlopen. After the module is loaded, the address of a function or variable defined in the module can be obtained using a function such as dlsym, to use the function or variable corresponding to the address to initialize the module, so that the module on which the main Ability depends can be loaded, ensuring that the main Ability is ready.

[0091] The third stage: Ability Transaction stage.

[0092] After the module on which the main Ability depends is loaded, the Ability Transaction stage is entered, and the configuration related to the life cycle of the main interface is performed.

[0093] Start: Start the life cycle of the main Ability, for example, start displaying the main interface of the application on the electronic device.

[0094] Create: The main Ability instance can be created, and life cycle methods such as onCreate can be called to initialize the main interface.

[0095] Foreground: Put the main interface in the foreground. The main interface can be finally presented to the user through operations such as setting window properties, drawing interface elements, and the like.

[0096] The fourth stage: Load Window stage.

[0097] Before the main interface with specific content is displayed, the loading window stage is mainly responsible for loading the window framework associated with the main interface, providing a container or carrier for subsequent page rendering and display.

[0098] The fifth stage is a load page stage.

[0099] Finally, the load page stage can fill the specific display content in the loaded window, including layout files, pictures, text, etc., to complete the final presentation of the main interface, thereby completing the application startup process.

[0100] In some examples, between the capability transaction stage and the loading window stage, there can also be intermediate stages such as main Ability preparation, life cycle callback, page layout parsing, data binding, etc. These stages work together to successfully start and display the main interface of the application.

[0101] As shown in FIG. 4, FIG. 4 is a schematic diagram of trace recording results corresponding to the execution of the above-mentioned multiple key stages by the main thread according to an embodiment of the present application. The y-axis direction in FIG. 4 represents the number of tasks. As can be seen from FIG. 4, during the startup process of the application, the main thread needs to perform many tasks in some stages (such as the process of starting the application program) to load the modules corresponding to the application program. This design mode may cause a large number of loading tasks to be executed on the main thread when facing a large application with complex functions and numerous modules, thereby prolonging the startup time of the application and making it difficult to meet the user's demand for fast response and efficient startup of the application, thereby reducing the user experience. Therefore, it is urgent to optimize the related design mode to further reduce the startup delay of the application and ensure that the user can quickly enter the available state after operating the application icon.

[0102] To this end, the application startup method provided in each of the embodiments of the present application can be used to stop the execution of the first subtask by the subthread when the first task prepared to be executed by the main thread is the same as the first subtask not yet completed by the subthread, and then the main thread takes over the subthread to complete the first subtask. Based on this, the main thread does not need to repeat the execution of the part of the subtask that has been completed by the subthread, thereby speeding up the startup process of the application. In addition, since the priority and efficiency of the main thread in executing tasks are higher than those of the subthread, the main thread can also avoid the idle time of the main thread during the waiting for the subthread to complete the first subtask, thereby further speeding up the completion of the first subtask, effectively reducing the response time of the first application, further optimizing the startup performance of the first application, and improving the user experience.

[0103] It should be noted that in the embodiments of the present application, "application" and "application program" are the same concept, refer to the same content, and one of them is used in different places. They can be interchangeable.

[0104] The application startup method provided in the present application will be exemplarily described below in combination with specific embodiments.

[0105] As shown in FIG. 5, it is a flowchart of an application startup method provided in an embodiment of the present application. Referring to FIG. 5, the method can include the following steps.

[0106] S501, determining M task groups corresponding to the first application, each of which includes one or more subtasks.

[0107] Wherein, M is an integer greater than or equal to 1. It is not difficult to understand that the specific value of M can be set according to the actual situation of different application programs (such as different functions or storage size, etc.), which is not limited herein.

[0108] It should be understood that in the embodiments of the present application, the first application can be any application program displayed on the desktop of the electronic device; it can also be an application program encapsulated based on the web kernel; it can also be an application program embedded in other applications (such as applet).

[0109] In some embodiments, the M task groups corresponding to the first application can be obtained from the configuration file corresponding to the first application. In actual application, the M task groups can be predefined in the configuration file of the first application. In other possible implementation manners, the M task groups can also be customized by the user.

[0110] In the embodiments of the present application, any one of the M task groups can include one or more subtasks. Wherein, the subtask can be part of the tasks executed by the main thread in the first application startup process.

[0111] It should be understood that the number of subtasks in different task groups can be the same or different. The present application does not make any limitation on this.

[0112] In some examples, the M task groups can be independent of each other, that is, there is no dependency relationship between the task groups, so that in the startup process of the application program, the M task groups can be executed in parallel, which can further shorten the startup time of the application program compared with serially executing the subtasks in each task group, and can also reduce the complexity of program design.

[0113] In other examples, the M task groups can also have a dependency relationship, based on which the execution sequence of each task group can be set in the configuration file to avoid loading errors and other problems, so that the M task groups can be executed in an orderly manner in the first application startup process, thereby completing the normal startup of the first application.

[0114] In some embodiments, the plurality of sub-tasks in each task group can have the same task type. That is, the sub-tasks in each task group belong to the same task type.

[0115] Since tasks of the same task type often have similar execution requirements and / or similar required modules, grouping tasks of the same task type into the same task group can facilitate the processing of sub-tasks of the same type, optimize the order and parallelism of task execution, reduce unnecessary waiting time, and further accelerate the overall startup speed of the application program.

[0116] In addition, the above arrangement can also improve the organization and maintainability of the code, allowing developers to more clearly understand and manage the logical relationships and dependencies between task groups and sub-tasks. A unified error handling mechanism and performance monitoring can also be set up to quickly locate and solve problems when the program runs, and to evaluate and optimize the performance of each task group based on the performance.

[0117] In some embodiments, the task group can also include one or more sub-tasks of different task types.

[0118] In this case, the plurality of sub-tasks in the task group can be sorted according to the task type. For example, sub-tasks of the same task type can be executed first (or last). Based on this, multiple sub-tasks of the same task type can be executed together to avoid the problem of low efficiency of sub-task execution caused by task type confusion.

[0119] As an example, but not limited to, assume that task group A includes three sub-tasks: task 1, task 2, and task 3, and the task types of the above three sub-tasks are the same (for example, all are performance monitoring and optimization sub-tasks), and during the application startup process, the above three sub-tasks can be executed in turn. In actual application, with the continuous upgrading of the application program, task 4 can be added to the task group A, and the task type of task 4 can be different from the task types of the above three sub-tasks, for example, the task type of task 4 can be an asynchronous task processing sub-task. Then during the application startup process, for task 1, task 2, task 3, and task 4 in task group A, task 1, task 2, and task 3 can be executed first, and then task 4 can be executed; or task 4 can be executed first, and then task 1, task 2, and task 3 can be executed; in this way, the execution timing of task 1, task 2, and task 3 of the same task type can be ensured, and task 4 can also be executed, improving the efficiency of the execution of the above multiple sub-tasks.

[0120] The sub-tasks in the task group can include error handling, security check, permission check, asynchronous task (e.g., AsyncTask, Loader, etc.) loading, callback and detection, resource loading corresponding to language and region settings, component initialization, debugging, log recording, performance monitoring and optimization, etc.

[0121] The tasks performed by the main thread can not only include one or more sub-tasks in the plurality of sub-tasks, i.e., one or more sub-tasks in the above examples. It can also include other tasks required to start the first application. For example, window creation, view management (e.g., measurement, layout, drawing, etc.), initialization operations (e.g., initialization of database connection, initialization of global variables, or network request, etc.), message loop processing, lifecycle callback, etc.

[0122] It should be noted that during the starting process of the first application, the number of tasks performed by the main thread can be greater than the number of sub-tasks, so that the main thread can perform the first application starting task while the sub-thread performs the plurality of sub-tasks in the corresponding task group. When the task performed by the main thread and the sub-task performed by the other thread are the same task, the main thread takes over the other thread to perform the unperformed sub-task in the task group, so that the main thread obtains the time difference between the sub-tasks corresponding to the task group that it does not need to perform and the sub-tasks that have been performed by the sub-thread, further reducing the time required for starting the first application and improving the starting efficiency of the first application.

[0123] In some embodiments, the electronic device can trigger the starting process of the first application in response to a user triggering operation on the first application. The triggering operation can be used to trigger any control, application icon or service, so that the electronic device can perform the application starting method provided by the embodiments of the present application in response to the triggering operation to start the first application.

[0124] It should be understood that the specific operation of triggering any control, application icon or service can be clicking, touching, single-clicking, double-clicking, double-finger sliding, or long-pressing any control or application icon for a preset time length, etc. It can also be one or more of key input, gesture recognition, body language recognition, speech recognition, expression recognition, eye movement recognition, and face recognition. The present application does not make specific limitations on this.

[0125] S502, create M sub-threads corresponding to the main thread according to M task groups, the main thread is used to start the first application, and the sub-thread corresponds to one of the task groups, and the sub-thread is used to perform one or more sub-tasks in the corresponding task group.

[0126] It should be understood that the related content of the main thread can be referred to the foregoing description, which will not be repeated here.

[0127] In this embodiment, the number of sub-threads created according to the task groups is equal to the number of task groups, i.e., each sub-thread corresponds to one task group. During the first application startup process, each sub-thread can execute one or more sub-tasks in the corresponding task group in parallel.

[0128] For example, assuming that the task groups corresponding to the first application have three, namely Group1, Group2 and Group3, three sub-threads can be created according to the above three task groups, such as sub-thread 1, sub-thread 2 and sub-thread 3; wherein sub-thread 1 can correspond to Group1, for executing one or more sub-tasks in task group Group1; sub-thread 2 can correspond to Group2, for executing one or more sub-tasks in task group Group2; and sub-thread 3 can correspond to Group3, for executing one or more sub-tasks in task group Group3.

[0129] In some embodiments, the M sub-threads corresponding to the M task groups can be created when the main thread meets a preset condition.

[0130] In one example, the preset condition can include that the number of tasks executed by the main thread is less than or equal to a preset threshold. The preset threshold can be set according to the actual situation of the first application.

[0131] For example, assuming that the first application startup process requires 8s (ignoring the time for creating the main thread), the number of tasks executed in time period A: 0-2s is 3, the number of tasks executed in time period B: 2-5s is 20, the number of tasks executed in time period C: 5-6s is 5, and the number of tasks executed in time period D: 6-8s is 10. The preset threshold can be set to 5, i.e., if the number of tasks executed by the main thread is less than or equal to 5, the aforementioned M sub-threads corresponding to the M task groups can be created.

[0132] Based on the above example, the main thread can create M sub-threads corresponding to M task groups when the number of tasks executed by the main thread in the first time period is less than or equal to the preset threshold. Still taking the above example as an example, the first time period can be time period A and / or time period C, i.e., the main thread can create M sub-threads corresponding to M task groups when starting the first application (i.e., 0s of the first application startup process); and / or create M sub-threads corresponding to M task groups at the 5s of the first application startup process.

[0133] As can be appreciated, based on the above example, when the number of tasks executed by the main thread is less than or equal to 5, it can be considered that the number of tasks executed by the main thread in the time period is small, and the running load of the processor is small. In this case, the M sub-threads created can be used to execute the sub-tasks of the corresponding task groups, fully utilize the processor, and speed up the completion of all sub-tasks in the task group, so as to effectively reduce the response time of the first application.

[0134] In another example, the preset condition can also include that the number of tasks executed by the main thread in the first stage is less than or equal to a preset threshold. In other words, when the main thread satisfies that the number of tasks executed by the main thread in the first stage is less than or equal to the preset threshold, M sub-threads corresponding to M task groups are created.

[0135] For example, in the five key stages involved in the embodiments shown in FIGS. 3 and 4, before the stage of processing the starting application (see t1 in FIG. 4), the number of tasks executed by the main thread is small. Assuming that the number of tasks in the t1 stage is 2, the preset threshold can be set to 2. Then, when the number of tasks executed by the main thread is less than or equal to 2, M sub-threads corresponding to M task groups can be created to make the M sub-threads execute sub-tasks in the corresponding task groups, respectively.

[0136] Based on the above example, the first stage is the stage before the stage of processing the starting application. It should be understood that according to actual conditions, the first stage can also be other stages in the embodiments shown in FIGS. 3 and 4.

[0137] Of course, the preset threshold in the above-mentioned preset condition can also be 0. That is, when the number of tasks executed by the main thread is 0 (i.e., the processor is idle), the main thread can also create M sub-threads according to M task groups.

[0138] In some embodiments, the method of creating M sub-threads can be that the main thread calls a first interface to create M sub-threads. The first interface can include a function flow runtime (ffrt) interface, a handler interface, or an interface corresponding to other programming languages.

[0139] It should be noted that sub-threads can also be created based on different interfaces (or modules) provided by different programming languages and libraries. For example, in Java, Thread class and ExecutorService interface can be used to create sub-threads; in C++, std: : thread and related standard library functions can be used to create sub-threads; in Python, threading module can be used to create sub-threads, and so on.

[0140] In some embodiments, the priority of the M sub-threads can be the same, and the priority of the M sub-threads can be the highest priority sub-thread in the first application startup process. That is, the priority of the M sub-threads is lower than the priority of the main thread, but higher than the priority of other sub-threads. In this way, it can be ensured that the sub-threads can be used to prioritize processing each sub-task in the task group during the first application startup process, so that the sub-tasks can be completed faster, and the efficiency of the first application startup can be improved.

[0141] S503, when it is monitored that the first task to be executed by the main thread is the first sub-task in the first task group which is not executed by the first sub-thread, the first sub-thread is notified to stop executing the first sub-task, and the first sub-task is continued to be executed by the main thread.

[0142] The first sub-thread can be any one of the M sub-threads, and the first task group can be a task group corresponding to the first sub-thread in the M task groups. The first sub-task can be a sub-task that the first sub-thread is ready to execute or is executing in the first task group.

[0143] It should be understood that the first task to be executed by the main thread can be any one of the tasks executed by the main thread in the foregoing embodiments, and specific details can be referred to the related content in the foregoing embodiments, which will not be repeated here.

[0144] In the case where the first task to be executed by the main thread and the first sub-task which is not executed by the first sub-thread are the same task, the main thread can notify the first sub-thread to stop continuing to execute the first sub-task, and the main thread replaces the first sub-thread to execute the first sub-task. That is, when the first task to be executed by the main thread and the first sub-task which is executed or is being executed by the first sub-thread are the same, the completion of the first sub-task can be accelerated by switching the thread (i.e., switching from the first sub-thread to the main thread).

[0145] In some embodiments, if the first sub-task is a sub-task being executed by the first sub-thread, the main thread can obtain a task node corresponding to the time when the first sub-thread stops executing the first sub-task after notifying the first sub-thread to stop executing the first sub-task, so that the main thread continues to execute the first sub-task according to the task node. That is, when the main thread monitors that the first task to be executed by the main thread is the first sub-task being executed by the first sub-thread, the main thread can notify the first sub-thread to stop executing the first sub-task, and obtain a task node corresponding to the time when the first sub-thread stops executing the first sub-task, so that the main thread continues to execute the first sub-task from the task node corresponding to the first sub-task.

[0146] In a possible case, the first subtask can be the last subtask in the first task group, that is, when the first task to be executed by the main thread is the last subtask (i.e., the first subtask) in the first task group which is not executed by the first subthread, the first subthread can be replaced by the main thread to continue executing the first subtask until the first subtask is executed.

[0147] In another possible case, the first subtask can also not be the last subtask in the first task group, and in this case, when the first subtask is not the last subtask in the first task group, the second subtask can be executed after the main thread executes the first subtask, where the second subtask is a subtask after the first subtask in the first task group which is not executed, that is, the first subtask and the second subtask are subtasks in the same task group.

[0148] S504, starting the first application.

[0149] It can be understood that after the main thread executes the first subtask or the main thread executes the first subtask and the second subtask, other tasks for starting the first application can be executed to start the first application.

[0150] Based on the application starting method described in various embodiments of the present application, subthreads corresponding to the number of task groups are created to enable the subthreads to execute multiple subtasks in the corresponding task groups. When the first task to be executed by the main thread is the same as the first subtask which is not executed by the subthread, the subthread stops executing the first subtask, and the main thread replaces and executes the first subtask. In this way, the main thread does not need to repeatedly execute the subtasks which have been executed by the subthread, so that in the process of starting the first application, the time for the main thread to execute the subtasks which have been executed by the subthread can be effectively saved, the starting process of the first application is further accelerated, and the starting efficiency of the first application is improved.

[0151] In addition, compared with the first subthread continuing to execute the first subtask, the main thread has higher efficiency in executing tasks, and the main thread replacing the first subthread to execute the first subtask can avoid the idling of the main thread during waiting for the subthread to complete the first subtask, further accelerating the speed of completing the first subtask, effectively reducing the response time of the first application, accelerating the response speed of the first application, and improving the user experience.

[0152] Based on the application starting method shown in FIG. 5, FIG. 6 shows a data interaction process diagram corresponding to the above-mentioned application starting method provided by an embodiment of the present application. It mainly involves data transmission between the main thread and the subthread. The subthread can include subthread 1, subthread 2, …, and subthread M. Referring to FIG. 6, the above-mentioned data interaction process can specifically include:

[0153] Step 601, the first application loads a configuration file.

[0154] It should be understood that in the embodiments of the present application, the configuration file can include M task groups and a plurality of sub-tasks corresponding to each of the M task groups.

[0155] In some embodiments, the configuration file can further include a storage path (realPath) of a compiled file corresponding to the first application, module information, and the like. It is not difficult to understand that after the first application is installed on the electronic device, the configuration file is usually stored in a certain storage path (i.e., the above-mentioned realPath) of the operating system, so that the compiled bytecode file corresponding to the first application can be obtained through the storage path to execute the code in the bytecode file to implement the start of the first application. The module information can include module name and the like, and different modules can be called in the application start process by using the module information, so as to realize the corresponding functions.

[0156] Step 602, the first application sends a request for starting the first application to the running management service.

[0157] For example, the request for starting the first application sent by the first application to the running management service can be StartAbility, so that the running management service starts a new Ability.

[0158] In the process of starting the first application, the configuration file corresponding to the first application is first loaded into the code running environment (such as a virtual machine) to execute the code corresponding to the first application by using the code running environment. Then, the first application sends a request for starting the first application to the running management service to request to start the first application.

[0159] Step 603, the running management service creates a corresponding main thread according to the received request for starting the first application.

[0160] In actual application, after receiving the request for starting the first application sent by the first application, the running management service can create an application process corresponding to the first application and perform tasks such as allocating a process ID and process memory; then, the main thread for starting the first application can be created by using the application process corresponding to the first application, so that the main thread performs a plurality of key stages shown in FIG. 3 to start the first application.

[0161] Step 604, the main thread sends a plurality of sub-tasks in the M task groups to the sub-thread.

[0162] It should be understood that, referring to FIG. 6, after the main thread is created, the main thread can create the sub-thread 1, the sub-thread 2, …, and the sub-thread M by calling the first interface, so that each of the above-mentioned sub-threads executes one or more sub-tasks in the corresponding task group. In this step 604, the main thread can send one or more sub-tasks in the corresponding task group to the corresponding sub-thread, so that the sub-thread executes the sub-tasks in the corresponding task group in sequence after receiving the corresponding one or more sub-tasks.

[0163] In step 605, when the main thread monitors that the first task to be executed by the main thread is the first sub-task in the first task group which is not executed by the first sub-thread, the main thread notifies the first sub-thread to stop executing the first sub-task.

[0164] It should be understood that, referring to FIG. 6, the first sub-thread can be any one of the sub-thread 1, the sub-thread 2, …, and the sub-thread M. For example, the first sub-thread is the sub-thread 1, and then the first task group can be the task group corresponding to the sub-thread 1 in the M task groups.

[0165] If the first task to be executed by the main thread is the first sub-task which is prepared to be executed or is being executed by the first sub-thread, the main thread can notify the first sub-thread to interrupt the execution of the first sub-task in the first task group, and the main thread continues to execute the first sub-task instead of the first sub-thread. Based on this embodiment, if the first task group further includes a second sub-task which is not executed after the first sub-task, the main thread can continue to execute the second sub-task after the execution of the first sub-task is completed.

[0166] Correspondingly, if the main thread monitors that the second task to be executed by the main thread is the third sub-task which has been executed by the first sub-thread, the main thread can no longer execute the second task, and the main thread continues to execute the task after the second task.

[0167] Similarly, if the main thread monitors that the third task to be executed by the main thread is the fourth sub-task which has been executed by the second sub-thread in the second task group, the main thread can also no longer execute the third task, and the main thread continues to execute the task after the third task. It should be understood that the second sub-thread can be one of the M sub-threads; the second task group can be one of the M task groups, and the fourth sub-task can be one of the multiple sub-tasks corresponding to the second task group in the M task groups.

[0168] The above-mentioned contents related to the first application, the M task groups, and the multiple sub-tasks in steps 601 to 605 can refer to the corresponding descriptions in the above-mentioned embodiments of FIG. 5, and will not be described here again.

[0169] In addition, it can be understood that the data interaction flowchart corresponding to the application starting method shown in FIG. 6 is only an example, and the flowchart provided by the embodiments of the present application does not constitute a specific limitation on the processing flow of starting the first application.

[0170] It should be understood that the size of the serial number of each step in the above embodiments does not mean the order of execution, and the execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0171] Based on the application starting method provided in each of the above embodiments, the embodiments of the present application further provide the following content:

[0172] The embodiments of the present application provide an application starting device and / or electronic equipment for executing the above-mentioned application starting method, which can achieve the same effect as the above-mentioned implementation method.

[0173] In the case of using an integrated unit, the application starting device and / or electronic equipment can include a processor (or processing module) and a display (or display module), wherein the processor can realize or execute various exemplary application starting methods described in combination with the disclosure of the present application. The display can be used to display the user interface corresponding to the application in the above embodiments.

[0174] Optionally, the above-mentioned application starting device and / or electronic equipment can also include a memory (or storage module), which can be used to store computer programs or instructions.

[0175] The embodiments of the present application provide a computer program product, which includes a program, when the program is run by an electronic device, so that the electronic device executes the application starting method shown in the above embodiments.

[0176] The embodiments of the present application provide a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to realize the application starting method shown in the above embodiments.

[0177] The embodiments of the present application provide a chip, which includes a memory and a processor, and the processor executes the computer program stored in the memory to realize the control of the above-mentioned electronic equipment to execute the application starting method shown in the above embodiments.

[0178] It should be appreciated that a processor referenced in the embodiments of the present application can be a CPU, and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.

[0179] It should also be understood that the memory referenced in the embodiments of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically EPROM (EEPROM) or a flash memory. The volatile memory can be a random access memory (RAM) used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced SDRAM (ESDRAM), synchlink DRAM (SLDRAM) and direct rambus RAM (DR RAM).

[0180] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above functional units and modules is taken as an example, and in actual application, the above functions can be completed by different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or software. In addition, the specific names of each functional unit and module are only for easy distinction, and do not limit the protection scope of the present application. In the above embodiments, the description of each embodiment has its own emphasis, and the parts not described or recorded in a certain embodiment can be referred to the related description of other embodiments.

[0181] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized in electronic hardware or a combination of computer software and electronic hardware. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0182] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the system embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division, and actual implementation can have another division manner. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interface, device or unit, and can be electrical, mechanical or other forms.

[0183] The units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the present embodiment.

[0184] In addition, each of the function units in each of the embodiments of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software function unit.

[0185] The integrated unit, if realized in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, all or part of the processes in the above-mentioned embodiment methods can be completed by instructing related hardware through a computer program, and the computer program can be stored in a computer readable storage medium. When the computer program is executed by a processor, the steps of each method embodiment described above can be implemented. The computer program includes computer program code, which can be in the form of source code, object code, executable files or some intermediate forms. The computer readable medium at least includes any entity or device capable of carrying the computer program code to the large screen device, recording medium, computer memory, read-only memory, random access memory, electrical carrier signal, telecommunication signal and software distribution medium. For example, U disk, mobile hard disk, magnetic disk or optical disk, etc. In some jurisdictions, according to legislation and patent practice, the computer readable medium cannot be an electrical carrier signal and a telecommunication signal.

[0186] Finally, it should be noted that: the above is only a specific embodiment of the present application, but the protection scope of the present application is not limited to this, any change or replacement within the technical scope disclosed in the present application should be covered in the protection scope of the present application.

Claims

1. An application starting method characterized by comprising: The method comprises: determining M task groups corresponding to starting a first application, each of the task groups comprising one or more sub-tasks, wherein M is an integer greater than or equal to 1; creating M sub-threads corresponding to a main thread according to the M task groups, the main thread being used to start the first application, the sub-threads corresponding to the task groups one by one, the sub-threads being used to execute one or more sub-tasks in the corresponding task groups; when it is monitored that a first task to be executed by the main thread is a first sub-task in a first task group which is not executed by a first sub-thread, the first sub-thread is informed to stop executing the first sub-task, and the first sub-task is continued to be executed by the main thread, wherein the first sub-thread is one of the M sub-threads, and the first task group is a task group corresponding to the first sub-thread in the M task groups; starting the first application.

2. The application launch method of claim 1, wherein, The method further comprises: after the first sub-task is executed by the main thread, a second sub-task is executed, the second sub-task and the first sub-task being sub-tasks in the same task group.

3. The application launch method according to claim 1 or 2, wherein The first sub-task is executed by the main thread, comprising: obtaining a task node corresponding to the first sub-thread stopping executing the first sub-task; the main thread executes the first sub-task according to the task node.

4. The application launch method according to any one of claims 1 to 3, characterized by, The M sub-threads corresponding to the main thread used to start the first application are created according to the M task groups, comprising: when the number of tasks executed by the main thread is less than or equal to a preset threshold, the M sub-threads are created according to the M task groups.

5. The application launch method according to any one of claims 1 to 4, wherein The method further comprises: the main thread calls a first interface to create the M sub-threads; wherein for the first application, the priority of the sub-threads created by the first interface is higher than that of the sub-threads created by other interfaces.

6. The application launch method of claim 5, wherein, The first interface comprises an ffrt interface and a hander interface.

7. The application launch method according to any one of claims 1 to 6, wherein The M sub-threads are all sub-threads with the highest priority in the starting process of the first application.

8. The application launch method according to any one of claims 1 to 7, wherein, The sub-tasks in each of the task groups belong to the same task type.

9. An electronic device, comprising: The electronic device is configured to execute the method of any one of claims 1-8.

10. A chip system, characterized by The chip system comprises a processor, and the processor executes a computer program stored in a memory to implement the method of any one of claims 1-8.

11. A computer readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method of any one of claims 1-8.

Citation Information

Patent Citations

  • Critical resource access method and device, computer equipment and readable storage medium

    CN112306699A

  • Application task processing method, device and equipment, and readable storage medium

    CN112445588A

  • Task management method, device and equipment and readable storage medium

    CN117290061A

  • System and method for consolidating middleware management

    US20080059559A1