Task scheduling method and device, storage medium and electronic equipment

By implementing the task scheduling method in the browser, the problem of repeated triggering of computing tasks under high-frequency interaction is solved. Through delayed execution and deduplication operations, computing resource consumption is reduced and browser performance is improved.

CN119781945AActive Publication Date: 2025-04-08ZHEJIANG LAB

Patent Information

Application Number
CN202510274623.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-10
Publication Date
2025-04-08
Estimated Expiration
2045-03-10

AI Technical Summary

Technical Problem

In the case of high-frequency interaction, the computing tasks of the front-end page of the browser are repeatedly triggered, resulting in frequent call to event functions, occupying a large amount of computing resources, resulting in page stuttering or web page crashing.

Method used

By implementing the task scheduling method in the browser, in response to the target task triggered by user interaction, it is determined whether there is the same calculation task in the waiting state. If not, set the target task to wait. After the waiting state of the target task ends, if there is no identical computing task in the task to be executed, the target task is added to the task to be executed and executed when the browser thread is idle.

Benefits of technology

Through delayed execution and two deduplication operations, the execution of repeated calculation tasks is greatly reduced, computing resource consumption is reduced, and the performance and stability of the browser is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119781945A_ABST
    Figure CN119781945A_ABST
Patent Text Reader

Abstract

The invention discloses a task scheduling method and device, a storage medium and electronic equipment, and the method comprises the steps: in response to a received target task triggered by an interaction operation of a user on a front-end page of a browser, determining whether there is a calculation task which is the same as the target task and is in a waiting state within a set time; if not, the target task is set to be in a waiting state, after the waiting state of the target task is finished, under the condition that it is determined that no calculation task identical to the target task exists in the tasks to be executed, the target task is added to the tasks to be executed, and the tasks to be executed are the calculation tasks executed when the browser thread is idle. Through the method, the target task initiated by the user in real time and the calculation task initiated by the user in the waiting state in history are subjected to first-time duplicate removal, and after the waiting state of the target task is finished, second-time duplicate removal is performed in the to-be-executed task, so that the execution of repeated calculation tasks is reduced through two-time duplicate removal, and the calculation efficiency is improved. And the performance of the browser is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a task scheduling method, device, storage medium and electronic device. Background Art

[0002] In the browser front-end page, many high-frequency interactions may occur, such as users continuously clicking buttons, quickly adjusting window sizes, and quickly dragging page elements.

[0003] Because the front-end page is generally written in JavaScript, which only supports single-threaded tasks, in high-frequency interaction situations, computing tasks are repeatedly triggered, and event functions that execute computing tasks are frequently called, which will take up a lot of computing resources and easily cause page freezes or even web page crashes, affecting the performance of the browser front-end page.

[0004] How to improve the performance of browser front-end pages under high-frequency interaction conditions is an urgent problem to be solved. Summary of the invention

[0005] The present specification provides a task scheduling method, device, storage medium and electronic device to at least partially solve the above-mentioned problems existing in the prior art.

[0006] This manual adopts the following technical solutions: This specification provides a task scheduling method, which is applied to a browser, including: In response to receiving a target task triggered by an interactive operation of a user on a front-end page of a browser, determining whether there is a computing task in a waiting state that is the same as the target task within a set time; If not, setting the target task to a waiting state; After the waiting state of the target task ends, if it is determined that there is no computing task identical to the target task in the tasks to be executed, the target task is added to the tasks to be executed, and the tasks to be executed are computing tasks that are executed when the browser thread is idle.

[0007] Optionally, determining whether there is a computing task in a waiting state identical to the target task within a set time includes: In the first queue, query whether there is a computing task identical to the target task, wherein the first queue stores computing tasks in a waiting state; If not, the target task is set to a waiting state, specifically including: If not, adding the target task to the first queue and setting a delay time for the target task; The method further comprises: If so, terminate the target task.

[0008] Optionally, querying whether there is a computing task identical to the target task specifically includes: Determine the event function and calculation parameters corresponding to the target task according to the user's interactive operation on the browser front-end page, where the calculation parameters are input parameters of the event function; Determine whether there is a computing task in the first queue whose corresponding event function and computing parameters are the same as those of the target task.

[0009] Optionally, when it is determined that there is no computing task identical to the target task in the tasks to be executed, the target task is added before the tasks to be executed, and the method further includes: Determine whether there is a task to be executed; When it is determined that there is no computing task identical to the target task in the tasks to be executed, adding the target task to the tasks to be executed specifically includes: When there are tasks to be executed, if it is determined that there is no computing task identical to the target task in the tasks to be executed, adding the target task to the tasks to be executed; When the to-be-executed task does not exist, the target task is added to the to-be-executed task.

[0010] Optionally, the tasks to be executed are stored in a second queue; When it is determined that there is no computing task identical to the target task in the tasks to be executed, adding the target task to the tasks to be executed specifically includes: When the computing tasks included in the second queue are different from the target task, the target task is added to the second queue.

[0011] Optionally, when the computing tasks included in the second queue are different from the target task, adding the target task to the second queue specifically includes: Determine the event function and calculation parameters corresponding to the target task according to the user's interactive operation on the browser front-end page, where the calculation parameters are input parameters of the event function; When the event function and the calculation parameters corresponding to the computing task in the second queue are different from those of the target task, the target task is taken as a task to be executed and is added to the second queue.

[0012] Optionally, the method further comprises: When the target task exists in the tasks to be executed, the target task is terminated.

[0013] This specification provides a task scheduling device, which is applied to a browser, and the device includes: A first deduplication module, in response to receiving a target task triggered by an interactive operation of a user on a front-end page of a browser, determines whether there is a computing task in a waiting state that is the same as the target task within a set time; Delay module, if not, sets the target task to a waiting state; The second deduplication module, after the waiting state of the target task ends, if it is determined that there is no computing task identical to the target task in the tasks to be executed, adds the target task to the tasks to be executed, and the tasks to be executed are computing tasks that are executed when the browser thread is idle.

[0014] This specification provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned task scheduling method is implemented.

[0015] This specification provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned task scheduling method when executing the program.

[0016] At least one of the above technical solutions adopted in this specification can achieve the following beneficial effects: In the task scheduling method applied to the browser provided in the present specification, in response to receiving a target task triggered by an interactive operation of a user on the front-end page of the browser, it is determined whether there is a computing task in a waiting state identical to the target task within a set time. If not, the target task is set to a waiting state. After the waiting state of the target task ends, if it is determined that there is no computing task identical to the target task in the tasks to be executed, the target task is added to the tasks to be executed. The tasks to be executed are computing tasks that are executed when the browser thread is waiting to be idle.

[0017] Through this method, a delayed execution is set for the computing tasks initiated by the user, so that the target task initiated by the user in real time and the computing tasks that have been initiated by the user in the waiting state in the past can be deduplicated. After the waiting state of the target task ends, the target task and the pending tasks that need to be executed when the thread is idle are deduplicated for the second time. When it is ensured that there are no duplicate tasks in the pending tasks, the target task is used as the computing task to be executed by the browser thread. Therefore, through two deduplications, the execution of duplicate computing tasks is greatly reduced, the consumption of computing resources is reduced, and the browser performance is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The drawings described herein are used to provide a further understanding of this specification and constitute a part of this specification. The illustrative embodiments and descriptions of this specification are used to explain this specification and do not constitute an improper limitation on this specification. In the drawings: Figure 1 A flowchart of a task scheduling method in this specification; Figure 2 This is a task scheduling overall framework diagram provided in this manual; Figure 3 Another overall framework diagram of task scheduling provided in this manual; Figure 4 A schematic diagram of a task scheduling device provided in this specification; Figure 5 The corresponding Figure 1 Schematic diagram of electronic equipment. DETAILED DESCRIPTION

[0019] In order to make the purpose, technical solutions and advantages of this specification more clear, the technical solutions of this specification will be clearly and completely described below in combination with the specific embodiments of this specification and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0020] The technical solutions provided by the embodiments of this specification are described in detail below in conjunction with the accompanying drawings.

[0021] Figure 1 The following is a flowchart of a task scheduling method in this specification. The task scheduling method is applied to a browser and specifically includes the following steps: S100: In response to receiving a target task triggered by an interactive operation of a user on a front-end page of a browser, determining whether there is a computing task in a waiting state that is the same as the target task within a set time.

[0022] All steps in the task scheduling method provided in this specification can be implemented by any electronic device with computing functions, such as a terminal, a server, etc. For ease of description, the task scheduling method provided in this specification is described below with the server as the execution subject.

[0023] In the browser front-end page, the user's click, scroll, input and other interactive operations correspond to the corresponding event functions. When the user performs these operations, the calculation task corresponding to the event function is triggered. If the user performs operations frequently, the calculation task is triggered frequently.

[0024] Usually, many computing tasks are complex. When the event functions of these complex computing tasks are triggered frequently, they occupy a large amount of CPU resources, which will greatly reduce the performance of the web page. For example, when the user quickly adjusts the size of the browser window, the resize event will be triggered continuously. If no measures are taken, the computing tasks associated with the resize event, such as the recalculation layout function and the rerendering page function, will be frequently executed, causing the browser to freeze.

[0025] In the method of the present specification, the server responds to the user's interactive operation, determines the computing task triggered by the user, and uses the computing task at the current moment as the target task to be scheduled in real time.

[0026] The server sets a delay for each computing task triggered by the user, and the computing task before the delay ends is in a waiting state.

[0027] If the user continuously performs the same interactive operation and frequently triggers a computing task, multiple identical computing tasks will be generated in a waiting state within a period of time. In other words, if there is a computing task identical to the target task among the computing tasks in the waiting state, it can be considered that frequent interactive operations have occurred. Based on this feature, the server performs the first deduplication of the target task based on the computing tasks in the waiting state.

[0028] The server queries whether there is a computing task identical to the target task among the computing tasks in the waiting state.

[0029] S102: If not, setting the target task to a waiting state.

[0030] If there is no computing task identical to the target task in the computing tasks in the waiting state, it means that the user has not triggered the target task within the set time, and the server sets the target task to the waiting state.

[0031] Specifically, the server can set a timer for the target task according to the preset delay time, and when the delay time countdown ends, the waiting state of the target task is released. The delay time can be set to any value as needed.

[0032] If there is a computing task identical to the target task in the computing tasks in the waiting state, it means that the target task is repeatedly triggered within the set time, and the server terminates the target task.

[0033] In one example, the delay time can be set to 300ms. In a scenario where the user scrolls the page continuously and quickly, assume that the current time is the 200th ms, and the computing task of the user's first scrolling of the page is recorded as Task B, the timestamp of Task B is recorded as the zero time, and Task B is set to delay 300ms. At the current moment, the user continues to scroll the page, and the target task triggered by the scrolling of the page at the current moment is recorded as Task A. At the current moment, the delay of Task B has not ended. The server finds that Task B in the waiting state is the same computing task as Task A, and terminates Task A.

[0034] In particular, when the server determines that there is no computing task in the waiting state at the current moment, the target task can be directly set to the waiting state without executing the query operation in the computing task in the waiting state, thereby speeding up the execution rate.

[0035] S104: After the waiting state of the target task ends, if it is determined that there is no computing task identical to the target task in the tasks to be executed, the target task is added to the tasks to be executed, where the tasks to be executed are computing tasks that are executed when the browser thread is idle.

[0036] When the waiting state of the target task ends, the server performs a second deduplication operation on the target task according to the pending tasks, wherein the pending tasks are computing tasks that are executed when the browser thread is idle.

[0037] Specifically, the server checks whether there is a computing task identical to the target task in the computing tasks to be executed. If there is, it means that the target task is a repeatedly triggered computing task, and the target task is terminated. If there is no such task, it means that the target task has not been triggered in a short period of time, and the target task is added to the tasks to be executed, and the target task is executed when the browser thread is idle.

[0038] For example, if the target task is task A, after the waiting state ends, the processing of task A will continue. Check whether there is a task C that is the same as task A in the tasks to be executed. If there is, it means that task A is a duplicate of task C, and task A is terminated. If not, task A is added to the tasks to be executed, and task A is executed when the browser thread is idle.

[0039] This method executes computing tasks only when the thread is idle, avoiding the accumulation of computing tasks generated by frequent cunningness. At the same time, through the secondary deduplication operation of the tasks to be executed, the waste of computing resources caused by repeated computing tasks is reduced, and the fluency and stability of the browser are improved.

[0040] Figure 2 This is a task scheduling overall framework diagram provided in this specification, such as Figure 2As shown, after the target task is triggered according to the user's interactive operation, a query is first performed in the computing tasks in the waiting state to perform the first deduplication operation.

[0041] If there is a computing task that is the same as the target task in the waiting state, the target task is terminated. If there is no computing task that is the same as the target task in the waiting state, the target task is set to the waiting state, wait for the target task to end its waiting state, query the tasks to be executed, and perform the second deduplication operation.

[0042] If there is a computing task that is the same as the target task in the tasks to be executed, terminate the target task. If there is no computing task that is the same as the target task in the tasks to be executed, add the target task to the tasks to be executed. Wait until the browser thread is idle and execute the target task.

[0043] Based on the above Figure 1 The task scheduling method sets a delayed execution for the computing tasks initiated by the user, and can deduplicate the target task initiated by the user in real time and the computing tasks that have been initiated by the user in the waiting state in the past. After the waiting state of the target task ends, the target task is deduplicated for the second time from the pending tasks that need to be executed when the existing browser thread is idle. When it is ensured that there are no duplicate tasks in the pending tasks, the target task is used as the pending task to be executed by the browser thread. Therefore, through two deduplications, the execution of duplicate computing tasks is greatly reduced, the consumption of computing resources is reduced, and the browser performance is improved.

[0044] This method can reduce the pressure of some intensive and repetitive tasks on the limited computing resources of the browser and avoid the large amount of browser computing resources occupied by invalid calculations. Specifically, it can improve performance in the following four aspects: First, reduce computing resource consumption. In some high-frequency triggering scenarios (such as users clicking buttons to perform a certain type of complex computing task), if not restricted, functions may be called frequently, thereby occupying a large amount of CPU resources. For example, when a user quickly adjusts the size of the browser window, the resize event will be continuously triggered. If a complex function is directly bound (such as recalculating the layout, re-rendering the page, etc.), it may cause the browser to freeze. Through the method provided by the present invention, these frequent calls can be "merged" into one call, greatly reducing the number of function executions, thereby reducing the burden on the CPU.

[0045] Second, it provides smoother interaction. In some scenarios that require real-time feedback, such as dragging, scrolling, etc., the present invention can avoid the jamming and unsmoothness caused by frequently triggered computing tasks. For example, when dragging an element, the browser thread is busy. By using the method provided by the present invention, it can be ensured that the frequency of executing other computing tasks is reduced and only executed when the browser thread is idle, so that the dragging process is smoother.

[0046] Third, reduce the risk of browser crashes. In some extreme cases, such as when a user's quick operation causes a function to be called at a high frequency, the browser may crash or freeze. The present invention can reduce this risk by limiting the calling frequency of the event function of the computing task, thereby improving the stability and compatibility of the page.

[0047] Fourth, avoid misoperation. In some button click events, users may accidentally click multiple times quickly. If not restricted, it may lead to repeated form submission, repeated triggering of certain operations, etc. Through the present invention, it can ensure that multiple identical computing task triggers by users are merged into one, thereby avoiding the adverse effects caused by user misoperation.

[0048] In one embodiment of the present specification, the computing tasks in the waiting state in the above step S102 can be stored in a queue, which is referred to as the first queue, that is, the computing tasks stored in the first queue are in the waiting state for the delay to end. According to the first-in-first-out characteristic of the queue, the earlier the computing tasks are triggered, the earlier their storage position in the queue is, and the earlier the computing tasks are triggered, the earlier their waiting state is released and they enter the next scheduling stage.

[0049] The server can query whether there is no computing task identical to the target task in the first queue. If so, the server terminates the target task while repeatedly calling the event function of the target task, resulting in a waste of resources. If not, it means that the target task is not repeatedly triggered within the set time. The server can set a delay time for the target task and add the target task to the first queue, waiting for the delay time to end before processing the target task in the next step.

[0050] In one embodiment of the present specification, the delay time in the above step S102 can be set to a dynamic value to flexibly adapt to different interaction scenarios.

[0051] The server can determine the delay time corresponding to the target task in real time according to the triggering time interval between the target task and the previous computing task of the target task.

[0052] Specifically, the server can determine the triggering time interval between the target task and the previous computing task of the target task, and determine whether the triggering time interval is less than the preset interval. If so, the specified time gradient value is added to the delay time of the previous computing task to obtain the delay time of the target task. If not, the delay time is not changed, that is, the delay time of the previous computing task is directly used as the delay time of the target task.

[0053] Through this embodiment, the more frequent the triggering operation, the longer the delay time can be set to prevent the browser thread from being blocked under high-frequency triggering.

[0054] In the above step S102, in order to fully utilize computing resources and improve computing efficiency, the server may monitor the idle status of the browser thread in real time.

[0055] When there are no other computing tasks in waiting state before the target task, and the waiting state of the target task has not ended, if the web page thread is monitored to be idle, the delay time of the target task is immediately cleared, the waiting state of the target task is ended, and the target task is added to the tasks to be executed.

[0056] In this embodiment, the browser thread is idle, which means that there are no other tasks to be executed at the current moment. That is, after the target task is added to the tasks to be executed, the target task is the only computing task waiting to be executed among the tasks to be executed. At this time, the target task can be executed immediately.

[0057] In the above step S104, the server may first determine whether there is a task to be executed before searching among the tasks to be executed.

[0058] When it is determined that there are tasks to be executed, the operation described in step S104 is performed again to remove computing tasks that are repeated with the target task from the tasks to be executed. If there are no tasks to be executed at the current moment, the server can directly add the target task to the tasks to be executed.

[0059] That is, in this embodiment, when the tasks to be executed are empty, the query operation in the tasks to be executed can be omitted, and the target task can be directly added to the tasks to be executed, thereby improving the task scheduling efficiency.

[0060] In one embodiment of the present specification, the tasks to be executed in the above step S104 may be stored in a queue, which is referred to as a second queue.

[0061] Because the browser web page only supports single-threaded tasks, the server will wait for the browser thread to be idle, and store the computing tasks to be executed in the second queue according to the triggering order. When the thread is idle, each computing task can be executed in sequence according to the order in which the computing tasks are stored.

[0062] In this embodiment, the server determines whether there is a task to be executed, specifically, it determines whether the second queue is empty.

[0063] When the second queue is empty, it means that there is no computing task waiting to be executed when the browser thread is idle at the current moment, and the server adds the target task to the tasks to be executed.

[0064] When the second queue is not empty, it means that there is at least one computing task waiting to be executed when the browser thread is idle. In this state, the server needs to ensure that there is no computing task that is repeated with the target task in the tasks to be executed. Then the server checks whether there is a computing task that is the same as the target task in the second queue. If it exists, the target task is terminated to avoid repeated execution of the same computing task in a short period of time. If it does not exist, the target task is added to the tasks to be executed, added to the second queue, and waits for the browser thread to be idle before executing the target task.

[0065] Figure 3 Another overall framework diagram of task scheduling provided in this specification is Figure 3 In the embodiment shown, computing tasks in a waiting state are stored in a first queue, and tasks to be executed are stored in a second queue. Figure 2 The execution process of the corresponding embodiment is similar, and reference may be made to the description of the corresponding contents above.

[0066] In one embodiment of the present specification, the basis for determining whether computing tasks are the same is the called event function and the input parameters of the event function, that is, computing tasks with the same called event function and the same input parameters are determined to be the same computing tasks.

[0067] In the above step S102, the server queries whether there is a computing task identical to the target task among the computing tasks in the waiting state, and the following method may be specifically adopted.

[0068] The server responds to the user's interactive operation on the front-end page of the browser to determine the event function and calculation parameters corresponding to the target task. The calculation parameters are the input parameters of the calculation function obtained according to the user's interactive operation. For example, if the user continuously scrolls the page to trigger a large number of position calculation tasks, then for the scrolling operation at the current moment, the position where the page stops when scrolling is the input parameter of the position calculation event function, that is, the calculation parameter of the target task.

[0069] The server queries among the computing tasks in the waiting state whether there is a computing task having the same event function and computing parameters as the target task.

[0070] Based on this embodiment, when a computing task in a state of waiting for the delay to end is stored in the first queue, the server can query in the first queue whether there is a computing task having the same event function and computing parameters as the target task.

[0071] Similarly, in the above step S104, the server determines whether there is a computing task identical to the target task in the tasks to be executed. Specifically, it queries whether there is a computing task identical to the target task in the tasks to be executed.

[0072] Based on this embodiment, when the task to be executed is stored in the second queue, the server can query in the second queue whether there is a computing task with the same event function and computing parameters as the target task.

[0073] In another embodiment of the present specification, the server may call a hash conversion function to determine the hash value of the computing task according to the event function and computing parameters of the computing task. The hash value is a unique identifier for each computing task. If the hash values ​​of different computing tasks are the same, it means that these different computing tasks are actually the same computing tasks that are repeatedly triggered.

[0074] In the above steps S102 and S104, by comparing the hash values, the query of the same computing task can be performed more quickly.

[0075] In one embodiment of the present specification, the computing tasks in the waiting state and the tasks to be executed can be stored in the same space, for example, in the same queue, which is referred to as the third queue. Then, this embodiment can realize the functions of the first queue and the second queue through the third queue.

[0076] The third queue includes computing tasks in two different states, so the computing tasks in this embodiment have a state identifier, which includes a waiting identifier and a pending identifier. The waiting identifier is used to mark the computing tasks in the waiting state, and the pending identifier is used to mark the computing tasks that are executed when the browser thread is idle. This specification does not limit the specific manifestations of the waiting identifier and the pending identifier, as long as there is a difference between the two state identifiers.

[0077] In this embodiment, the above step S100 may be specifically as follows: The server determines whether there is a computing task identical to the target task within a set time among the computing tasks included in the third queue.

[0078] When there is no computing task identical to the target task among the computing tasks included in the third queue, the above steps S102 to S104 are executed.

[0079] In this embodiment, the server performs a query in each computing task included in the third queue, and executes the two query steps of steps S102 and S104 at the same time, thereby reducing the number of queries and improving the task scheduling efficiency.

[0080] In this embodiment, when the server determines that there is a repeated task in the third queue, the repeated task is the same computing task as the target task. The server continues to determine the task status of the repeated task according to the status identifier of the repeated task.

[0081] If the repeating task is in a waiting state, the server terminates the target task or overwrites the repeating task with the target task.

[0082] If the repeated task is in the pending state, the trigger time interval is calculated according to the timestamp of the target task and the timestamp of the repeated task. When the trigger time interval is less than the preset repeating allowed time, the target task is terminated. When the trigger time interval is not less than the preset repeating allowed time, the target task is still treated as a pending task and waits for the browser thread to be idle to execute the target task.

[0083] Because, when the trigger time interval is not less than the preset allowed repetition time, it means that the trigger time interval between two identical computing tasks is long. In order to accurately respond to the user's interactive operation, it is selected to allow the computing task to be repeated.

[0084] The above is the task scheduling method provided in this specification. Based on the same idea, this specification also provides a corresponding task scheduling device, such as Figure 4 shown.

[0085] Figure 4 A schematic diagram of a task scheduling device provided in this specification, which is applied to a browser and specifically includes: The first deduplication module 200 is used to, in response to receiving a target task triggered by an interactive operation of a user on a front-end page of a browser, determine whether there is a computing task in a waiting state that is the same as the target task within a set time; The delay module 202 is used to, if not, set the target task to a waiting state; The second deduplication module 204 is used to add the target task to the tasks to be executed when it is determined that there is no computing task identical to the target task in the tasks to be executed after the waiting state of the target task ends. The tasks to be executed are computing tasks that are executed when the browser thread is idle.

[0086] Optionally, the first deduplication module 200 is specifically used to query whether there is a computing task identical to the target task in the first queue, and the first queue stores computing tasks in a waiting state. The delay module 202 is specifically used to, if not, add the target task to the first queue and set a delay time for the target task; if so, terminate the target task.

[0087] Optionally, the first deduplication module 200 is specifically used to determine the event function and calculation parameters corresponding to the target task based on the user's interactive operations on the browser front-end page, the calculation parameters being the input parameters of the event function, and to determine whether there is a calculation task in the first queue whose corresponding event function and calculation parameters are the same as those of the target task.

[0088] Optionally, the second deduplication module 204 is specifically used to determine whether there are tasks to be executed. When there are tasks to be executed, if it is determined that there are no computing tasks identical to the target task in the tasks to be executed, the target task is added to the tasks to be executed; when there are no tasks to be executed, the target task is added to the tasks to be executed.

[0089] Optionally, the tasks to be executed are stored in a second queue, and the second deduplication module 204 is specifically configured to add the target task to the second queue when the computing tasks included in the second queue are different from the target task.

[0090] Optionally, the second deduplication module 204 is specifically used to determine the event function and calculation parameters corresponding to the target task based on the user's interactive operations on the browser front-end page, and the calculation parameters are input parameters of the event function. When the event function and calculation parameters corresponding to the calculation task in the second queue are different from those of the target task, the target task is treated as a task to be executed and the target task is added to the second queue.

[0091] Optionally, the second deduplication module 204 is specifically configured to terminate the target task when the target task exists in the tasks to be executed.

[0092] This specification also provides a computer-readable storage medium, which stores a computer program, which can be used to execute the above Figure 1 Provides task scheduling methods.

[0093] This manual also provides Figure 5 The schematic structure diagram of the electronic device shown in FIG. Figure 5As mentioned above, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may also include other hardware required for the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it to achieve the above Figure 1 Of course, in addition to the software implementation, this specification does not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0094] For the improvement of a technology, it can be clearly distinguished whether it is a hardware improvement (for example, improvement of the circuit structure of diodes, transistors, switches, etc.) or a software improvement (improvement of the method flow). However, with the development of technology, many improvements of the method flow today can be regarded as direct improvements of the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that the improvement of a method flow cannot be implemented with a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming themselves, without having to ask chip manufacturers to design and make dedicated integrated circuit chips. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one kind of HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed ​​Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages ​​and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.

[0095] The controller may be implemented in any suitable manner, for example, the controller may take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (e.g., software or firmware) executable by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, and the memory controller may also be implemented as part of the control logic of the memory. It is also known to those skilled in the art that, in addition to implementing the controller in a purely computer-readable program code manner, the controller may be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller may be considered as a hardware component, and the devices for implementing various functions included therein may also be considered as structures within the hardware component. Or even, the devices for implementing various functions may be considered as both software modules for implementing the method and structures within the hardware component.

[0096] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.

[0097] For the convenience of description, the above device is described in various units according to their functions. Of course, when implementing this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0098] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0099] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0100] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0101] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0102] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0103] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0104] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0105] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0106] It should be understood by those skilled in the art that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, this specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0107] This specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0108] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0109] The above description is only an embodiment of this specification and is not intended to limit this specification. For those skilled in the art, this specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this specification should be included in the scope of the claims of this application.

Claims

1. A task scheduling method, characterized in that: Applies to browsers, including: In response to receiving a target task triggered by an interactive operation of a user on a front-end page of a browser, determining whether there is a computing task in a waiting state that is the same as the target task within a set time; If not, setting the target task to a waiting state; After the waiting state of the target task ends, if it is determined that there is no computing task identical to the target task in the tasks to be executed, the target task is added to the tasks to be executed, and the tasks to be executed are computing tasks that are executed when the browser thread is idle.

2. The method according to claim 1, characterized in that Determining whether there is a computing task in a waiting state identical to the target task within a set time includes: In a first queue, query whether there is a computing task identical to the target task, wherein the first queue stores computing tasks in a waiting state; If not, the target task is set to a waiting state, specifically including: If not, adding the target task to the first queue and setting a delay time for the target task; The method further comprises: If so, terminate the target task.

3. The method according to claim 2, characterized in that Check whether there is a computing task that is the same as the target task, including: Determine the event function and calculation parameters corresponding to the target task according to the user's interactive operation on the browser front-end page, where the calculation parameters are input parameters of the event function; Determine whether there is a computing task in the first queue whose corresponding event function and computing parameters are the same as those of the target task.

4. The method according to claim 1, characterized in that When it is determined that there is no computing task identical to the target task in the tasks to be executed, adding the target task before the tasks to be executed, the method further includes: Determine whether there is a task to be executed; When it is determined that there is no computing task identical to the target task in the tasks to be executed, adding the target task to the tasks to be executed specifically includes: When there are tasks to be executed, if it is determined that there is no computing task identical to the target task in the tasks to be executed, adding the target task to the tasks to be executed; When the to-be-executed task does not exist, the target task is added to the to-be-executed task.

5. The method according to claim 4, characterized in that The tasks to be executed are stored in a second queue; When it is determined that there is no computing task identical to the target task in the tasks to be executed, adding the target task to the tasks to be executed specifically includes: When the computing tasks included in the second queue are different from the target task, the target task is added to the second queue.

6. The method according to claim 5, characterized in that When the computing tasks included in the second queue are different from the target task, adding the target task to the second queue specifically includes: Determine the event function and calculation parameters corresponding to the target task according to the user's interactive operation on the browser front-end page, where the calculation parameters are input parameters of the event function; When the event function and the calculation parameters corresponding to the computing task in the second queue are different from those of the target task, the target task is taken as a task to be executed and is added to the second queue.

7. The method according to claim 1, characterized in that The method further comprises: When the target task exists in the tasks to be executed, the target task is terminated.

8. A task scheduling device, characterized in that: Applies to browsers, including: A first deduplication module, in response to receiving a target task triggered by an interactive operation of a user on a front-end page of a browser, determines whether there is a computing task in a waiting state that is the same as the target task within a set time; Delay module, if not, sets the target task to a waiting state; The second deduplication module, after the waiting state of the target task ends, if it is determined that there is no computing task identical to the target task in the tasks to be executed, adds the target task to the tasks to be executed, and the tasks to be executed are computing tasks that are executed when the browser thread is idle.

9. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method described in any one of claims 1 to 7 is implemented.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method described in any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Communication method and communication device of Bluetooth equipment

    CN105071839A

  • Method, device, computer device and storage medium for intercepting duplicate requests

    CN109040209A

  • Client network task scheduling method, system and device and storage medium

    CN116225638A

  • Abnormal call identification method and device, electronic equipment and medium

    CN117950962A

  • Event processing method and device, computer equipment, readable storage medium and program product

    CN119179584A

Cited By

  • Task arrangement and dynamic scheduling method oriented to multi-machine concurrency

    CN121979645A

  • A task scheduling and dynamic scheduling method for multi-machine concurrency

    CN121979645B