Task Processing Method, Device, Electronic Device and Medium
By realizing a unified first task driving layer in the execution engine, the problem that the execution engine compatibility performance affects task processing efficiency is solved, and efficient and stable task data interaction and compatibility performance are improved.
Patent Information
- Application Number
- CN202111179287.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-09
- Publication Date
- 2025-06-10
- Estimated Expiration
- 2041-10-09
AI Technical Summary
During task processing, the compatibility performance of the execution engine affects the processing efficiency of task requests and the stability of data interaction.
By implementing the first task driving layer in the execution engine, this layer provides a unified interface for different host applications, processes various task requests, and returns the processing results to the target host application.
Improves the compatibility performance of the execution engine, reduces unnecessary execution engine layout, reduces the size of the host application, and improves task processing efficiency and data interaction stability.
Smart Images

Figure CN113867920B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technologies, and particularly to the field of computer communication technologies, and can be applied to task processing scenarios. Background Art
[0002] During the operation of an application, different task requests may be generated, and there may be a need for data interaction between task requests initiated by various applications. In the case where an execution engine needs to process task requests of various applications, the compatibility performance of the execution engine will affect the processing efficiency of task requests and the data interaction stability between task requests. Summary of the Invention
[0003] The present disclosure provides a task processing method, apparatus, electronic device, storage medium, and program product.
[0004] According to one aspect of the present disclosure, a task processing method is provided, including: in response to a task request received from at least one host application, using a first task driving layer implemented by an execution engine corresponding to the at least one host application to execute a task processing action associated with each task request, obtaining a task processing result associated with each task request; and returning the task processing result associated with each task request to a target host application among the at least one host application. The first task driving layer is configured to provide an interface function for responding to the task request.
[0005] According to another aspect of the present disclosure, a task processing apparatus is provided, including: a first processing module, configured to, in response to a task request received from at least one host application, use a first task driving layer implemented by an execution engine corresponding to the at least one host application to execute a task processing action associated with each task request, obtaining a task processing result associated with each task request; and a second processing module, configured to return the task processing result associated with each task request to a target host application among the at least one host application. The first task driving layer is configured to provide an interface function for responding to the task request.
[0006] According to another aspect of the present disclosure, an electronic device is provided, including: at least one processor and a memory communicatively connected to the at least one processor. Wherein, the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the above-mentioned task processing method.
[0007] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, and the computer instructions are used to cause a computer to execute the above-mentioned task processing method.
[0008] According to another aspect of the present disclosure, there is provided a computer program product including a computer program which, when executed by a processor, implements the above-mentioned task processing method.
[0009] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] The drawings are used to better understand the solution and do not constitute a limitation to the present disclosure. Among them:
[0011] Figure 1 Schematically shows the system architecture of the task processing and device according to an embodiment of the present disclosure;
[0012] Figure 2 Schematically shows the flowchart of the task processing method according to an embodiment of the present disclosure;
[0013] Figure 3 Schematically shows the flowchart of the task processing method according to another embodiment of the present disclosure;
[0014] Figure 4A Schematically shows the schematic diagram of the execution engine according to an embodiment of the present disclosure;
[0015] Figure 4B Schematically shows the schematic diagram of the execution engine according to another embodiment of the present disclosure;
[0016] Figure 5 Schematically shows the block diagram of the task processing device according to an embodiment of the present disclosure; and
[0017] Figure 6 Is the block diagram of the electronic device for implementing the embodiments of the present disclosure for task processing. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0018] The following describes exemplary embodiments of the present disclosure with reference to the accompanying drawings. Various details of the embodiments of the present disclosure are included to help understanding, and they should be considered merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0019] The terms used herein are for describing specific embodiments only and are not intended to limit the present disclosure. The terms "including", "comprising" and the like used herein indicate the presence of the described features, steps, operations and / or components, but do not preclude the presence or addition of one or more other features, steps, operations or components.
[0020] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those of ordinary skill in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification, and should not be interpreted in an idealized or overly rigid manner.
[0021] In cases where expressions similar to "at least one of A, B, and C" are used, generally, it should be interpreted according to the meaning commonly understood by those of ordinary skill in the art (for example, "a system having at least one of A, B, and C" should include, but is not limited to, a system having only A, only B, only C, having A and B, having A and C, having B and C, and / or having A, B, and C, etc.).
[0022] Embodiments of the present disclosure provide a task processing method. The task processing method includes: in response to a task request initiated by at least one host application received, using a first task driving layer implemented by an execution engine corresponding to the at least one host application, performing a task processing action associated with each task request to obtain a task processing result associated with each task request, and returning the task processing result associated with each task request to a target host application in the at least one host application. The first task driving layer is configured to provide an interface function for responding to task requests.
[0023] Figure 1 Schematically shows the system architecture of a task processing and device according to an embodiment of the present disclosure. It should be noted that Figure 1 What is shown is only an example of the system architecture to which the embodiments of the present disclosure can be applied, to help those of ordinary skill in the art understand the technical content of the present disclosure, but does not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios.
[0024] As Figure 1 shown, the system architecture 100 according to this embodiment may include host applications (multiple are shown in the figure, such as host applications 101, 102, 103), a network 104, and an execution engine 105. The network 104 is used to provide a medium for a communication link between the host applications (such as host applications 101, 102, 103) and the execution engine 105.
[0025] The execution engine 105 is configured to, in response to a received task request initiated by at least one host application (such as host applications 101, 102, 103), utilize a first task-driven layer implemented by the execution engine 105 to execute task processing actions associated with each task request, obtain task processing results associated with each task request, and return the task processing results associated with each task request to a target host application among at least one host application (such as host applications 101, 102, 103) via the network 104. The first task-driven layer is configured to provide an interface function for responding to task requests.
[0026] It should be noted that the task processing method provided by the embodiments of the present disclosure can be executed by the execution engine 105. Correspondingly, the task processing device provided by the embodiments of the present disclosure can be disposed in the execution engine 105. The task processing method provided by the embodiments of the present disclosure can also be implemented by another execution engine different from the execution engine 105 and capable of communicating with the host application and / or the execution engine 105. Correspondingly, the task processing device provided by the embodiments of the present disclosure can also be disposed in another execution engine different from the execution engine 105 and capable of communicating with the host application and / or the execution engine 105.
[0027] Those skilled in the art can understand that a "host application" can be an application in an operating system that realizes specific programming language functions by invoking an execution engine, and an "execution engine" can be a virtual machine that provides corresponding functions for host applications in the operating system by providing interface functions of a specific programming language.
[0028] It should be understood that Figure 1 the numbers of host applications, networks, and execution engines in
[0029] The embodiments of the present disclosure provide a task processing method. The following will describe the task processing method according to the exemplary embodiments of the present disclosure in conjunction with Figure 1 the system architecture of Figure 2 and Figure 3 and Figure 4A and Figure 4B and Figure 1 The task processing method of the embodiments of the present disclosure can be executed by the execution engine 105 shown in
[0030] Figure 2 Schematically shows a flowchart of the task processing method according to an embodiment of the present disclosure.
[0031] As Figure 2 shown, the task processing method 200 of the embodiments of the present disclosure can include, for example, operation S210 to operation S220.
[0032] In operation S210, in response to a task request initiated by at least one host application, using a first task-driven layer implemented by an execution engine corresponding to the at least one host application, perform task processing actions associated with each task request to obtain task processing results associated with each task request.
[0033] In operation S220, return the task processing results associated with each task request to a target host application among the at least one host applications. The first task-driven layer is configured to provide an interface function for responding to task requests.
[0034] The following details an example process of each operation of the task processing method of this embodiment.
[0035] Exemplarily, in response to a task request initiated by at least one host application, the execution engine creates a request object associated with each task request, and encapsulates each request object by setting parameters and callback functions for each request object. The execution engine sends each encapsulated request object to the first task-driven layer, and the first task-driven layer performs I / O operations in each request object to obtain I / O operation processing results associated with each request object, that is, obtains task processing results associated with each task request. The execution engine returns the processing results associated with each task request to a target host application among the at least one host applications.
[0036] The first task-driven layer is uniformly implemented by the execution engine and is configured to provide an interface function for responding to task requests of host applications. The interface functions that the first task-driven layer can implement can include, for example, message queues, memory allocation, interface debugging, system clocks, etc. The first task-driven layer can include, for example, a platform abstraction layer developed by the execution engine based on the native service interface of the operating system. The execution engine can include, for example, a rendering engine that can convert HTML (Hyper Text Markup Language) / CSS (Cascading Style Sheets) / JS (JavaScript, a browser scripting language) text and corresponding resource files into image results.
[0037] Exemplarily, the execution engine can be a V8 JS engine. The V8 JS engine can, in response to a task request initiated by at least one host application, compile each task request into machine code for CPU execution and hand the machine code to the first task-driven layer for execution to obtain task processing results associated with each task request.
[0038] When using the first task driving layer to execute task processing actions associated with each task request, task requests initiated by at least one host application can be added to the process task queue. In the engine process that matches the first task driving layer, the first task driving layer extracts each task request in the process task queue and executes the task processing actions associated with each task request to obtain task processing results associated with each task request.
[0039] An execution stack for executing synchronous tasks and a process task queue for storing asynchronous tasks are created in the execution engine. The execution stack can be the main thread running in the execution engine, and the process task queue can be a child thread controlled by the main thread. Task requests initiated by at least one host application are stored in the process task queue. After the synchronous tasks in the execution stack are executed, the execution stack can extract task requests from the process task queue through a callback function for processing.
[0040] The engine process is the basic unit for resource allocation and scheduling in the operating system. The engine process can include multiple threads, the addressing space of the independently allocated memory, and file / network handles. Multiple threads can run simultaneously within the engine process. A thread is an independent execution unit execution flow within the engine process and is also referred to as an execution instance. The message queue is a first-in, first-out data structure for storing messages, and the messages include the data transmitted during the task processing. Generally, a single thread corresponds to a single message queue, and the number of message queues within a single thread does not exceed one.
[0041] Obtain the first call pointer pre-allocated to the host application associated with each task request, and according to the process address space in the engine process indicated by each first call pointer, execute the task processing actions associated with each task request within the corresponding process address space to obtain task processing results associated with each task request.
[0042] In an example way, the first call pointer pre-allocated to the host application associated with each task request can be obtained in the isolated data area associated with the engine process. Exemplarily, an Isolate object (a thread for implementing memory isolation) pre-bound to the engine process can be obtained in the data area of the engine process, and the first call pointer pre-allocated to each host application can be obtained from the extended data slot of the Isolate object.
[0043] When the first task driving layer extracts task requests from the process task queue, determine the first call pointer associated with the task identifier according to the task identifier of the extracted task request. According to the process address space indicated by the first call pointer, assign the starting address of the process address space to the global variable pointer in the callback function to implement the pointer address switching operation based on the global variable pointer in the callback function.
[0044] Determining the process address space indicated by the first call pointer pre-allocated to each host application is equivalent to determining the execution engine thread for processing the task requests of each host application, that is, determining the message queue for processing the task requests of each host application. A feasible method is to execute the task processing actions associated with each task request within the corresponding process address space according to the process address space indicated by the first call pointer associated with the task identifier. Another feasible method is to add each task request to the corresponding message queue for processing according to the message queue indicated by the first call pointer associated with the task identifier, so as to execute the task processing actions associated with each task request and obtain the task processing results associated with each task request.
[0045] When there is a host application configured to stop calling the execution engine, or when the duration for which a host application has not called the execution engine exceeds a preset threshold, a process address release operation can be performed on the host application to release the process address space previously allocated to the host application.
[0046] Through the embodiments of the present disclosure, in response to the task requests initiated by at least one host application received, using the first task-driven layer implemented by the execution engine corresponding to the at least one host application, execute the task processing actions associated with each task request, obtain the task processing results associated with each task request, and return the task processing results associated with each task request to the target host application among the at least one host applications. The first task-driven layer is configured to provide an interface function for responding to task requests.
[0047] By uniformly implementing the first task-driven layer through the execution engine, the problem of non-uniform task-driven layers caused by differences in the current operating environment, operating system, implementation method, etc. can be effectively solved. The execution engine uniformly generates the first task-driven layer and provides the first task-driven layer to different host applications for calling, so that the task requests of different host applications can be processed within the engine process matching the first task-driven layer, which can effectively improve the compatibility performance of the execution engine, reduce unnecessary execution engine layouts, and is beneficial to effectively reducing the size of the host application.
[0048] When data interaction is required between the task requests of different host applications, for example, when two host applications need to jointly complete an interface drawing, processing the task requests of different host applications based on the same engine process is beneficial to realizing efficient and stable task data interaction, can effectively improve the task processing efficiency, and improve the task processing effect.
[0049] Figure 3 Schematically shows a flowchart of a task processing method according to another embodiment of the present disclosure.
[0050] As Figure 3As shown, the task processing method 300 of the embodiments of the present disclosure may include, for example, operations S310 to S320.
[0051] In operation S310, when the task request initiated by at least one host application includes a rendering task request for invoking a browser kernel, the second task driving layer implemented by the browser kernel is utilized to execute a task processing action associated with the rendering task request, and a task processing result associated with the rendering task request is obtained.
[0052] In operation S320, the task processing result associated with the rendering task request is returned to the corresponding host application.
[0053] The following details the example processes of the operations of the task processing method of this embodiment.
[0054] Exemplarily, when the task request initiated by at least one host application includes a rendering task request for invoking a browser kernel, the second task driving layer implemented by the browser kernel is utilized to execute a task processing action associated with the rendering task request. The second task driving layer implemented by the browser kernel is configured to provide an interface function for responding to the rendering task request and an auxiliary function for supporting the browser kernel to call an execution engine.
[0055] The browser kernel invoked by the rendering task request may be, for example, the Blink kernel. The second task driving layer implemented by the Blink kernel may include, for example, a platform abstraction layer. The Blink kernel may include multiple sub-projects. The implementation of the second task driving layer may be completed in a certain sub-project. In addition to implementing the interface function of the second task driving layer, this sub-project may also implement other auxiliary functions for supporting the Blink kernel to call an execution engine.
[0056] When executing the task processing action associated with the rendering task request, a second call pointer associated with the second task driving layer is obtained. According to the kernel process indicated by the second call pointer, the task processing action associated with the rendering task request is executed in the kernel process, and a task processing result associated with the rendering task request is obtained. The second call pointer is a global variable pointer for indicating the kernel process address space.
[0057] Exemplarily, in response to the received rendering task request, the execution engine compiles the rendering task request to obtain machine code for execution by the CPU. The execution engine invokes a second task driver layer implemented by the browser kernel, and the second task driver layer performs the page rendering action indicated by the machine code to obtain a page rendering result. A feasible way is to run the machine code through a preset Skia interface of the second task driver layer to generate a page rendering result corresponding to the machine code. The preset Skia interface can be obtained by encapsulating a graphics processing function interface in the form of a JavaScript object.
[0058] In the case where the task request initiated by at least one host application further includes a background task request, a second call pointer associated with the second task driver layer can be obtained. In the kernel process indicated by the second call pointer, a background task processing action associated with the background task request is performed to obtain a task processing result associated with the background task request, and the task processing result associated with the background task request is returned to the corresponding host application.
[0059] Since the background task request can be executed in any process address space, the task processing action associated with the background task request can be executed in a kernel process matching the second task driver layer or an engine process matching the first task driver layer. Since the kernel process matching the second task driver layer includes a larger number of threads and can support processing more task requests, the background task request can be executed in the kernel process matching the second task driver layer to obtain a task processing result associated with the background task request.
[0060] In the case where the received task request does not include a rendering task request for invoking the browser kernel, a global variable pointer associated with the first task driver layer is invoked, and in the engine process indicated by the global variable pointer, a background task processing action associated with the background task request is performed to obtain a task processing result associated with the background task request, and the task processing result associated with the background task request is returned to the corresponding host application.
[0061] Figure 4A A schematic diagram of an execution engine according to an embodiment of the present disclosure is schematically shown.
[0062] As Figure 4AAs shown, the execution engine stores a first task driving layer 4A1 uniformly implemented by the execution engine and a second task driving layer 4A2 implemented by the browser kernel. The second task driving layer 4A2 is used to process B-type task requests, and the B-type task requests include rendering task requests for requesting to call the browser kernel. The first task driving layer 4A1 is used to process A-type task requests, and the A-type task requests include other task requests except for the rendering task requests for requesting to call the browser kernel. Both the first task driving layer 4A1 and the second task driving layer 4A2 can be used to process background task requests.
[0063] Figure 4B Schematically shows a schematic diagram of an execution engine according to another embodiment of the present disclosure.
[0064] As Figure 4B shown, the execution engine stores a first call pointer set 4B1 and a second call pointer 4B2. The first call pointer set 4B1 is used to indicate the process address space in the engine process that matches the first task driving layer, and the second call pointer 4B2 is used to indicate the kernel process 4B21 that matches the second task driving layer. The first call pointer set 4B1 may include multiple first call pointers. The first call pointer is used, for example, to indicate the engine process address space 4B11, the engine process address space 4B12,..., the engine process address space 4B1n, where n is an integer greater than 1.
[0065] Using the second task driving layer implemented by the browser kernel, execute the rendering task request for requesting to call the browser kernel. Using the first task driving layer uniformly implemented by the execution engine, execute other task requests except for the rendering task requests for requesting to call the browser kernel. Processing task requests initiated by different host applications in the engine process that matches the first task driving layer can effectively improve the compatibility of the execution engine and effectively improve the processing efficiency of task requests for different host applications. When data interaction is required between task requests of different host applications, processing task requests of different host applications based on the same process can effectively ensure the stability and efficiency of data interaction between different task requests. Regarding the improvement of the compatibility of the execution engine, the number of execution engines in the layout of the application can be effectively reduced, which is beneficial to effectively controlling the size of the application.
[0066] Figure 5 Schematically shows a block diagram of a task processing device according to an embodiment of the present disclosure.
[0067] As Figure 5 shown, the task processing device 500 according to the embodiment of the present disclosure includes, for example, a first processing module 510 and a second processing module 520.
[0068] The first processing module 510 is configured to, in response to a task request initiated by at least one host application, utilize a first task-driven layer implemented by an execution engine corresponding to the at least one host application to execute task processing actions associated with each task request, and obtain task processing results associated with each task request. The second processing module 520 is configured to return the task processing results associated with each task request to a target host application among the at least one host applications. The first task-driven layer is configured to provide an interface function for responding to task requests.
[0069] According to the embodiments of the present disclosure, in response to a task request initiated by at least one host application, a first task-driven layer implemented by an execution engine corresponding to the at least one host application is utilized to execute task processing actions associated with each task request, obtain task processing results associated with each task request, and return the task processing results associated with each task request to a target host application among the at least one host applications. The first task-driven layer is configured to provide an interface function for responding to task requests.
[0070] By uniformly implementing the first task-driven layer through the execution engine, the problem of non-uniform task-driven layers caused by differences in the current operating environment, operating system, implementation methods, etc. can be effectively solved. The first task-driven layer is uniformly generated by the execution engine and provided to different host applications for invocation, so that task requests of different host applications can be processed within the engine process matching the first task-driven layer, which can effectively improve the compatibility performance of the execution engine, reduce unnecessary execution engine layouts, and is conducive to effectively reducing the size of the host application.
[0071] When data interaction is required between task requests of different host applications, for example, when two host applications need to jointly complete an interface drawing, processing task requests of different host applications based on the same engine process is conducive to achieving efficient and stable task data interaction, can effectively improve task processing efficiency, and improve task processing effects.
[0072] According to an embodiment of the present disclosure, the first processing module includes: a first processing sub-module configured to add a task request initiated by at least one host application to a process task queue; and a second processing sub-module configured to, in an engine process matching the first task-driven layer, the first task-driven layer extracts each task request in the process task queue and executes task processing actions associated with each task request to obtain task processing results associated with each task request.
[0073] According to an embodiment of the present disclosure, the second processing sub-module includes: a first processing unit configured to obtain a first call pointer pre-allocated to a host application associated with each task request; and a second processing unit configured to perform a task processing action associated with each task request within a corresponding process address space according to the process address space in the engine process indicated by each first call pointer, so as to obtain a task processing result associated with each task request.
[0074] According to an embodiment of the present disclosure, each task request has a task identifier; the second processing unit includes: a first processing subunit configured to determine a process address space indicated by a first call pointer associated with the task identifier according to the task identifier of the task to be extracted; and a second processing subunit configured to perform a task processing action within the process address space associated with each task to be extracted, so as to obtain a task processing result associated with each task request.
[0075] According to an embodiment of the present disclosure, the first processing unit includes: a third processing subunit configured to obtain a first call pointer pre-allocated to a host application associated with each task request in an isolated data area associated with the engine process.
[0076] According to an embodiment of the present disclosure, the apparatus further includes a third processing module configured to: in a case where a task request initiated by at least one host application includes a rendering task request for requesting to call a browser kernel, utilize a second task driving layer implemented by the browser kernel to perform a task processing action associated with the rendering task request, so as to obtain a task processing result associated with the rendering task request, and return the task processing result associated with the rendering task request to a corresponding host application.
[0077] According to an embodiment of the present disclosure, the third processing module includes: a third processing sub-module configured to obtain a second call pointer associated with the second task driving layer; a fourth processing sub-module configured to perform a task processing action associated with the rendering task request within the kernel process according to the kernel process indicated by the second call pointer, so as to obtain a task processing result associated with the rendering task request, and the second call pointer is a global variable pointer.
[0078] According to an embodiment of the present disclosure, the second task driving layer implemented by the browser kernel is configured to provide an interface function for responding to a rendering task request, and provide an auxiliary function for supporting the browser kernel to call an execution engine.
[0079] According to an embodiment of the present disclosure, the third processing module further includes: a fifth processing sub-module, configured to obtain a second call pointer associated with the second task driver layer when the task request initiated by at least one host application further includes a background task request; execute a background task processing action associated with the background task request in the kernel process indicated by the second call pointer to obtain a task processing result associated with the background task request; and return the task processing result associated with the background task request to the corresponding host application.
[0080] According to an embodiment of the present disclosure, the apparatus further includes a fourth processing module, configured to: when the task request initiated by at least one host application does not include a rendering task request for invoking a browser kernel, call a global variable pointer associated with the first task driver layer; execute a background task processing action associated with the background task request in the engine process indicated by the global variable pointer to obtain a task processing result associated with the background task request; and return the task processing result associated with the background task request to the corresponding host application.
[0081] It should be noted that in the technical solution of the present disclosure, the processing of information collection, storage, use, processing, transmission, provision, and disclosure complies with the provisions of relevant laws and regulations and does not violate public order and good customs.
[0082] According to an embodiment of the present disclosure, the present disclosure further provides an electronic device, a readable storage medium, and a computer program product.
[0083] Figure 6 It is a block diagram of an electronic device for implementing the task processing in the embodiments of the present disclosure.
[0084] Figure 6 FIG. shows a schematic block diagram of an exemplary electronic device 600 that can be used to implement the embodiments of the present disclosure. The electronic device 600 is intended to represent various forms of digital computers, such as, a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, a personal digital processing, a cellular phone, a smart phone, a wearable device, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0085] Such as Figure 6As shown, device 600 includes a computing unit 601, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 602 or a computer program loaded from a storage unit 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the device 600 can also be stored. The computing unit 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0086] Multiple components in the device 600 are connected to the I / O interface 605, including: an input unit 606, such as a keyboard, a mouse, etc.; an output unit 607, such as various types of displays, speakers, etc.; a storage unit 608, such as a magnetic disk, an optical disc, etc.; and a communication unit 609, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0087] The computing unit 601 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 601 executes the various methods and processes described above, such as the task processing method. For example, in some embodiments, the task processing method can be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as the storage unit 608. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 600 via the ROM 602 and / or the communication unit 609. When the computer program is loaded into the RAM 603 and executed by the computing unit 601, one or more steps of the task processing method described above can be executed. Alternatively, in other embodiments, the computing unit 601 can be configured to execute the task processing method in any other appropriate manner (e.g., by means of firmware).
[0088] The various embodiments of the systems and techniques described above in this document can be implemented in digital electronic circuitry, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on a chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be a special-purpose or general-purpose programmable processor that receives data and instructions from a storage system, at least one input device, and at least one output device, and transmits the data and instructions to the storage system, the at least one input device, and the at least one output device.
[0089] The program code for implementing the methods of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the program codes are executed by the processor or controller, the functions / operations specified in the flowchart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.
[0090] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0091] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and a pointing device (e.g., a mouse or a trackball) through which the user can provide input to the computer. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, speech input, or tactile input).
[0092] The systems and techniques described herein can be implemented in a computing system including backend components (e.g., as a data server), or a computing system including middleware components (e.g., an application server), or a computing system including frontend components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system including any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected by digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include: local area network (LAN), wide area network (WAN), and the Internet.
[0093] A computer system can include a client and a server. The client and the server are generally far from each other and typically interact through a communication network. The relationship between the client and the server is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, or a server of a distributed system, or a server incorporating a blockchain.
[0094] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps recited in this disclosure can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this is not limited herein.
[0095] The above specific embodiments do not constitute a limitation on the protection scope of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the protection scope of this disclosure.
Claims
1. A task processing method, including: In response to a task request initiated by at least one host application, using a first task driver layer uniformly implemented by an execution engine, execute a task processing action associated with each task request to obtain a task processing result associated with each task request; and Return the task processing result associated with each task request to a target host application among the at least one host application, wherein the first task driver layer is configured to provide an interface function for responding to the task request for the host application to call. Among them, the step of, in response to a task request initiated by at least one host application, using a first task driver layer implemented by an execution engine corresponding to the at least one host application, execute a task processing action associated with each task request to obtain a task processing result associated with each task request includes: Adding the task request initiated by the at least one host application to a process task queue; and In an engine process matching the first task driver layer, the first task driver layer extracts each task request in the process task queue and executes a task processing action associated with each task request to obtain a task processing result associated with each task request, wherein the step of, in an engine process matching the first task driver layer, the first task driver layer extracts each task request in the process task queue and executes a task processing action associated with each task request to obtain a task processing result associated with each task request includes: Obtaining a first call pointer pre-allocated to the host application associated with each task request; and According to the process address space in the engine process indicated by each first call pointer, execute a task processing action associated with each task request in the corresponding process address space to obtain a task processing result associated with each task request.
2. The method according to claim 1, wherein each task request has a task identifier; the step of, according to the process address space in the engine process indicated by each first call pointer, execute a task processing action associated with each task request in the corresponding process address space to obtain a task processing result associated with each task request includes: Determining the process address space indicated by the first call pointer associated with the task identifier according to the task identifier of the extracted task; and Execute a task processing action in the process address space associated with each extracted task to obtain a task processing result associated with each task request.
3. The method according to claim 1, wherein the step of obtaining a first call pointer pre-allocated to the host application associated with each task request includes: In an isolated data area associated with the engine process, obtain a first call pointer pre-allocated to the host application associated with each task request.
4. The method according to claim 1, further including: In the case that the task request initiated by the at least one host application includes a rendering task request for invoking the browser kernel, use the second task driving layer implemented by the browser kernel to execute a task processing action associated with the rendering task request, and obtain a task processing result associated with the rendering task request; And Return the task processing result associated with the rendering task request to the corresponding host application.
5. The method according to claim 4, wherein, The using the second task driving layer implemented by the browser kernel to execute a task processing action associated with the rendering task request and obtaining a task processing result associated with the rendering task request includes: Obtain a second call pointer associated with the second task driving layer; According to the kernel process indicated by the second call pointer, execute a task processing action associated with the rendering task request in the kernel process, and obtain a task processing result associated with the rendering task request, wherein the second call pointer is a global variable pointer.
6. The method according to claim 4 or 5, wherein, The second task driving layer implemented by the browser kernel is configured to provide an interface function for responding to the rendering task request and an auxiliary function for supporting the browser kernel to call the execution engine.
7. The method according to claim 4, wherein, In the case that the task request initiated by the at least one host application further includes a background task request, obtain a second call pointer associated with the second task driving layer; In the kernel process indicated by the second call pointer, execute a background task processing action associated with the background task request, and obtain a task processing result associated with the background task request; and Return the task processing result associated with the background task request to the corresponding host application.
8. The method according to claim 1, further comprising, in the case that the task request initiated by the at least one host application does not include a rendering task request for invoking the browser kernel: Invoke a global variable pointer associated with the first task driving layer; In the engine process indicated by the global variable pointer, execute a background task processing action associated with the background task request, and obtain a task processing result associated with the background task request; and Return the task processing result associated with the background task request to the corresponding host application.
9. A task processing device, comprising: A first processing module, configured to, in response to a task request initiated by at least one host application, use a first task driving layer uniformly implemented by an execution engine to execute a task processing action associated with each task request, and obtain a task processing result associated with each task request; And A second processing module, configured to return the task processing result associated with each task request to a target host application in the at least one host application, wherein the first task driving layer is configured to provide an interface function for responding to the task request for the host application to call, wherein the first processing module includes: The first processing sub-module is configured to add a task request initiated by the at least one host application to a process task queue; and The second processing sub-module is configured to, in an engine process that matches the first task driver layer, extract each task request in the process task queue by the first task driver layer, and perform a task processing action associated with each task request to obtain a task processing result associated with each task request, wherein, the second processing sub-module includes: The first processing unit is configured to obtain a first call pointer pre-allocated to the host application associated with each task request; and The second processing unit is configured to perform a task processing action associated with each task request within a corresponding process address space according to the process address space in the engine process indicated by each first call pointer, to obtain a task processing result associated with each task request.
10. The apparatus according to claim 9, wherein, each task request has a task identifier; the second processing unit includes: The first processing sub-unit is configured to determine the process address space indicated by the first call pointer associated with the task identifier according to the task identifier of the task to be extracted; and The second processing sub-unit is configured to perform a task processing action within the process address space associated with each task to be extracted to obtain a task processing result associated with each task request.
11. The apparatus according to claim 9, wherein, the first processing unit includes: The third processing sub-unit is configured to obtain, in an isolated data area associated with the engine process, a first call pointer pre-allocated to the host application associated with each task request.
12. The apparatus according to claim 9, further includes a third processing module configured to: In the case that the task request initiated by the at least one host application includes a rendering task request for requesting to call a browser kernel, utilize a second task driver layer implemented by the browser kernel to perform a task processing action associated with the rendering task request to obtain a task processing result associated with the rendering task request; and Return the task processing result associated with the rendering task request to the corresponding host application.
13. The apparatus according to claim 12, wherein, the third processing module includes: The third processing sub-module is configured to obtain a second call pointer associated with the second task driver layer; The fourth processing sub-module is configured to perform a task processing action associated with the rendering task request in the kernel process according to the kernel process indicated by the second call pointer to obtain a task processing result associated with the rendering task request, wherein, the second call pointer is a global variable pointer.
14. The apparatus according to claim 12 or 13, wherein, The second task driver layer implemented by the browser kernel is configured to provide an interface function for responding to the rendering task request, and provide an auxiliary function for supporting the browser kernel to call the execution engine.
15. The apparatus according to claim 12, wherein, The third processing module further includes: a fifth processing sub-module, configured to obtain a second call pointer associated with the second task driver layer when the task request initiated by the at least one host application further includes a background task request; in the kernel process indicated by the second call pointer, execute a background task processing action associated with the background task request to obtain a task processing result associated with the background task request; and return the task processing result associated with the background task request to the corresponding host application.
16. The apparatus according to claim 9, further comprising a fourth processing module, configured to: when the task request initiated by the at least one host application does not include a rendering task request for invoking a browser kernel: invoke a global variable pointer associated with the first task driver layer; in the engine process indicated by the global variable pointer, execute a background task processing action associated with the background task request to obtain a task processing result associated with the background task request, and return the task processing result associated with the background task request to the corresponding host application.
17. An electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein, the memory stores instructions executable by the at least one processor, and when the instructions are executed by the at least one processor, the at least one processor is enabled to execute the method according to any one of claims 1-8.
18. A non-transitory computer-readable storage medium storing computer instructions, wherein, the computer instructions are used to cause the computer to execute the method according to any one of claims 1-8.
19. A computer program product, comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1-8.
Citation Information
Patent Citations
Data task processing method and device and electronic equipment
CN112988350A