CN108268564B - Asynchronous calculation method and device for network function in spreadsheet - Google Patents

Asynchronous calculation method and device for network function in spreadsheet Download PDF

Info

Publication number
CN108268564B
CN108268564B CN201710003977.2A CN201710003977A CN108268564B CN 108268564 B CN108268564 B CN 108268564B CN 201710003977 A CN201710003977 A CN 201710003977A CN 108268564 B CN108268564 B CN 108268564B
Authority
CN
China
Prior art keywords
function
thread
calculated
calculation result
cache region
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710003977.2A
Other languages
Chinese (zh)
Other versions
CN108268564A (en
Inventor
潘永
杨柏林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Office Software Inc
Zhuhai Kingsoft Office Software Co Ltd
Guangzhou Kingsoft Mobile Technology Co Ltd
Original Assignee
Beijing Kingsoft Office Software Inc
Zhuhai Kingsoft Office Software Co Ltd
Guangzhou Kingsoft Mobile Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Kingsoft Office Software Inc, Zhuhai Kingsoft Office Software Co Ltd, Guangzhou Kingsoft Mobile Technology Co Ltd filed Critical Beijing Kingsoft Office Software Inc
Priority to CN201710003977.2A priority Critical patent/CN108268564B/en
Publication of CN108268564A publication Critical patent/CN108268564A/en
Application granted granted Critical
Publication of CN108268564B publication Critical patent/CN108268564B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

The embodiment of the invention provides an asynchronous calculation method and device of a network function in a spreadsheet. The method comprises the following steps: the first thread acquires function information of a network function to be calculated; the first thread searches a calculation result corresponding to the function information in a first cache region; if the calculation result corresponding to the function information is not found in the first cache region, the first thread stores the function information to a second cache region; and the second thread acquires the function information from the second cache region, calculates the network function according to the function information, stores the calculation result into the first cache region, and starts the first thread to search the calculation result corresponding to the function information. Asynchronous calculation of the network function is achieved, time for a user to wait for the network function to return a calculation result can be reduced, and user experience is improved.

Description

Asynchronous calculation method and device for network function in spreadsheet
Technical Field
The invention relates to the technical field of electronic form information processing, in particular to an asynchronous calculation method and device for network functions in electronic forms.
Background
In the electronic form, a common calculation flow is composed of calculation processes of functions in cells, the calculation process of the functions is generally that a thread performs function calculation in sequence, and after one function calculation is completed, the next function is calculated. With the expansion of the spreadsheet function, the method is often applied to a network function, and when the network function is calculated, the calculation result needs to be obtained through a network, which results in that the calculation time of the network function is dozens of times or even hundreds of times of that of a common function.
Therefore, under the condition that a large number of network functions are quoted, by adopting the calculation mode of the common functions, one calculation process consumes a long time, a user needs to wait for a long time in the operation process, and the user experience is not good. Therefore, it is desirable to provide an asynchronous calculation method of network functions that can reduce the user waiting time.
Disclosure of Invention
The embodiment of the invention aims to provide an asynchronous calculation method and device of a network function in a spreadsheet, so as to realize asynchronous calculation of the network function, reduce the time for a user to wait for the network function to return a calculation result and improve the user experience. The specific technical scheme is as follows:
a method for asynchronous computation of a network function in a spreadsheet, comprising:
the first thread acquires function information of a network function to be calculated;
the first thread searches a calculation result corresponding to the function information in a first cache region;
if the calculation result corresponding to the function information is not found in the first cache region, the first thread stores the function information to a second cache region;
and the second thread acquires the function information from the second cache region, calculates the network function according to the function information, stores the calculation result into the first cache region, and starts the first thread to search the calculation result corresponding to the function information.
The method as above, wherein the function information comprises: function ID and parameters;
the step of obtaining the function information of the network function to be calculated by the first thread includes:
after the first thread is started, judging whether a function to be calculated exists in the first dirty unit set; the first dirty unit set comprises a unit cell to be processed;
if the function ID and the parameter of the function to be calculated exist, the first thread acquires the function ID and the parameter of the function to be calculated;
the first thread judges whether the function to be calculated is a network function or not according to the function ID;
and if the judgment result is that the function to be calculated is the network function, the function ID and the parameter of the function to be calculated are function information of the network function to be calculated.
The method as described above, wherein the method further comprises:
if the calculation result corresponding to the function information is found in the first cache region, returning the calculation result to the memory;
and returning to the step that the first thread judges whether the function to be calculated exists in the first dirty unit set until the first thread judges that the function to be calculated does not exist in the first dirty unit set.
The method as described above, wherein the method further comprises:
if the first thread judges that the function to be calculated is not a network function, the first thread performs function calculation according to the function ID and the parameters to obtain a calculation result of the function to be calculated, and the calculation result is returned to the memory;
and returning to the step that the first thread judges whether the function to be calculated exists in the first dirty unit set until the first thread judges that the function to be calculated does not exist in the first dirty unit set.
The method, wherein the determining, by the first thread, whether the function to be computed is a network function according to the function ID, includes:
the first thread determines a marking bit corresponding to the function ID of the function to be calculated according to a preset function ID and a marking bit mapping table;
and the first thread judges whether the function to be calculated is a network function or not according to the mark bit.
The method as described above, where the step in which the second thread acquires the function information from the second cache area, performs calculation of a network function according to the function information, stores a calculation result in the first cache area, and starts the first thread to search for a calculation result corresponding to the function information includes:
the second thread judges whether the function ID and the parameter of the function to be calculated exist in a second cache region;
if the function ID and the parameter exist, the second thread acquires the function ID and the parameter from the second cache region, and records the cell where the function to be calculated is located in a second dirty unit set;
the second thread calculates the network function according to the function ID and the parameters to obtain a calculation result;
the second thread stores the calculation result to the first cache region;
returning to the step of judging whether the function ID and the parameter of the function to be calculated exist in the second cache region until the second thread judges that the function ID and the parameter of the function to be calculated do not exist in the second cache region, and judging whether the first thread is finished by the second thread;
if the first thread is finished, the second thread puts the cell recorded in the second dirty unit set into a first dirty unit set;
and the second thread starts the first thread to search a calculation result corresponding to the function information and enters a dormant state.
The method as described above, wherein after the first thread stores the function information in the second cache region, the method further includes:
the first thread judges whether the second thread is in a dormant state or not through a state flag bit;
and if the second thread is in a dormant state, the first thread wakes up the second thread.
The method as above, wherein the second thread determining whether the first thread is finished comprises:
the second thread judges whether the synchronous variable is marked;
if the synchronous variable is marked, the second thread judges that the first thread is not finished;
and if the synchronous variable is not marked, the second thread judges that the first thread is ended.
The method as above, wherein the second thread starting the first thread comprises:
and the second thread sends a starting message to the first thread to start the first thread.
An asynchronous computing device of network functions in spreadsheets, comprising:
the acquisition module is used for acquiring function information of the network function to be calculated by using a first thread;
the searching module is used for searching a calculation result corresponding to the function information in a first cache region by using the first thread;
the storage module is used for storing the function information to a second cache region by using the first thread if the search module does not search the calculation result corresponding to the function information in the first cache region;
and the processing module is used for acquiring the function information from the second cache region by using a second thread, calculating a network function according to the function information, storing a calculation result to the first cache region, and starting the first thread to search a calculation result corresponding to the function information.
The apparatus as described above, wherein the function information includes: function ID and parameters;
the acquisition module is specifically configured to: after the first thread is started, judging whether a function to be calculated exists in the first dirty unit set; the first dirty unit set comprises a unit cell to be processed; if so, acquiring a function ID and parameters of the function to be calculated by using the first thread; judging whether the function to be calculated is a network function or not according to the function ID; and if the judgment result is that the function to be calculated is the network function, the function ID and the parameter of the function to be calculated are function information of the network function to be calculated.
The apparatus as described above, wherein the lookup module is further configured to:
if the calculation result corresponding to the function information is found in the first cache region, returning the calculation result to the memory;
the first triggering module is used for triggering the acquisition module; and ending the operation until the obtaining module judges that the function to be calculated does not exist in the first dirty unit set by using the first thread.
The apparatus as described above, further comprising: a calculation module;
the function calculation module is used for calculating the function to be calculated according to the function ID and the parameter by using the first thread if the acquisition module uses the first thread to judge that the function to be calculated is not the network function, so as to obtain a calculation result of the function to be calculated, and returning the calculation result to the memory;
the first triggering module is used for triggering the acquisition module; and ending the operation until the obtaining module judges that the function to be calculated does not exist in the first dirty unit set by using the first thread.
The apparatus as described above, wherein the obtaining module is specifically configured to:
determining a marking bit corresponding to the function ID of the function to be calculated by using the first thread according to a preset function ID and a marking bit mapping table; and judging whether the function to be calculated is a network function or not according to the mark bit.
The apparatus as above, wherein the processing module is configured to:
judging whether the function ID and the parameter of the function to be calculated exist in a second cache region by using the second thread; if the cell to be calculated exists in the first cache region, acquiring the function ID and the parameter from the first cache region, and recording the cell in which the function to be calculated is located in a first dirty cell set; calculating a network function according to the function ID and the parameters to obtain a calculation result; storing the calculation result to the first cache region;
the second triggering module is used for triggering the processing module; until the processing module judges that the function ID and the parameter of the function to be calculated do not exist in the second cache region by using the second thread;
the processing module judges whether the first thread is finished or not by using the second thread; if the first thread is finished, placing the cell recorded in the second dirty unit set into a first dirty unit set; and starting the first thread to search a calculation result corresponding to the function information, and entering a dormant state.
The apparatus as described above, further comprising:
the first judging module is used for judging whether the second thread is in a dormant state or not by using the first thread through a state flag bit;
and the awakening module is used for awakening the second thread by using the first thread if the first judging module judges that the second thread is in the dormant state.
The apparatus as described above, further comprising: a second judging module:
for determining whether a synchronization variable is marked using the second thread; if the synchronous variable is marked, judging that the first thread is not finished; and if the synchronous variable is not marked, judging that the first thread is ended.
The apparatus as described above, wherein the processing module is specifically configured to:
and sending a starting message to the first thread by using the second thread to start the first thread.
According to the asynchronous calculation method and device for the network function in the electronic form, function information of the network function to be calculated is obtained through a first thread; the first thread searches a calculation result corresponding to the function information in a first cache region; if the calculation result corresponding to the function information is not found in the first cache region, the first thread stores the function information to a second cache region; and the second thread acquires the function information from the second cache region, calculates the network function according to the function information, stores the calculation result into the first cache region, and starts the first thread to search the calculation result corresponding to the function information.
Therefore, in the calculation process of the first thread, if the first thread encounters the network function to be calculated, the second thread is awakened to calculate the network function to be calculated, and after the second thread completes the calculation of the network function, the first thread is started to search the calculation result corresponding to the function information in the first cache region, so that the asynchronous calculation of the network function is realized, the time for a user to wait for the network function to return the calculation result is reduced, and the user experience is improved. Of course, it is not necessary for any product or method of practicing the invention to achieve all of the above-described advantages at the same time.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a flowchart of a method for asynchronous computation of a network function in a spreadsheet according to an embodiment of the present invention;
FIG. 2 is a schematic structural diagram of an asynchronous computing device for network functions in a spreadsheet according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an asynchronous computing device for network functions in a spreadsheet according to a second embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that, in the embodiments of the present invention, one or more resident threads are provided, and for simplicity, one thread is taken as an example in the embodiments of the present invention, and is specifically used for calculating the network function. In the embodiments of the present invention, a thread for calculating a normal function is referred to as a first thread and is denoted by S, and a thread for calculating a network function is referred to as a second thread and is denoted by T. In addition, in each embodiment of the present invention, a first cache region is further provided for storing a calculation result of a network function, and a second cache region is used for storing function information of the network function that needs to be calculated.
The following describes a method for asynchronous calculation of a network function in a spreadsheet according to embodiments of the present invention with reference to the accompanying drawings.
Fig. 1 is a flowchart of an asynchronous calculation method of a network function in a spreadsheet according to an embodiment of the present invention. As shown in fig. 1, the method provided by this embodiment may include:
step 101, the first thread obtains function information of a network function to be calculated.
Specifically, the function information includes: function ID and parameters; in this step, when function information of the network function to be computed is obtained, after the first thread is started, whether a function to be computed exists in a first dirty unit set is judged; the first dirty unit set comprises a unit cell to be processed; if the function ID and the parameter of the function to be calculated exist, the first thread acquires the function ID and the parameter of the function to be calculated; the first thread judges whether the function to be calculated is a network function or not according to the function ID; and if the judgment result is that the function to be calculated is the network function, the function ID and the parameter of the function to be calculated are function information of the network function to be calculated.
Specifically, the first thread S may be started by the second thread T, or may be started by a user operation, such as an operation of changing a cell, changing a configuration of a spreadsheet, and the like.
When the first thread judges whether the function to be calculated is a network function, firstly, a marking bit corresponding to the function ID of the function to be calculated is determined according to a preset function ID and a marking bit mapping table, and then whether the function to be calculated is the network function is judged according to the determined marking bit, wherein the marking bit is used for marking the type of the function to be calculated.
It should be noted that, if the first thread determines that the function to be calculated is not a network function, the first thread performs function calculation according to the function ID and the parameter to obtain a calculation result of the function to be calculated, and returns the calculation result to the memory; and returning to the step that the first thread judges whether the function to be calculated exists in the first dirty unit set until the first thread judges that the function to be calculated does not exist in the first dirty unit set.
And 102, searching a calculation result corresponding to the function information in a first cache region by the first thread.
In practical application, if the first thread finds a calculation result corresponding to the function information in the first cache region, returning the calculation result to a memory, and returning to the step of the first thread for determining whether a function to be calculated exists in the first dirty unit set, until the first thread determines that the function to be calculated does not exist in the first dirty unit set, ending the step.
Step 103, if the calculation result corresponding to the function information is not found in the first cache region, the first thread stores the function information in a second cache region.
After the first thread stores the function information into a second cache region, judging whether the second thread is in a dormant state or not through a state flag bit; and if the second thread is in a dormant state, the first thread wakes up the second thread.
It should be noted that the status flag bit and the handle of the second thread are placed in a data structure. In this embodiment, the second thread is woken up by calling the system function resumerthread of the Windows system.
And step 104, the second thread acquires the function information from the second cache region, performs network function calculation according to the function information, stores a calculation result to the first cache region, and starts the first thread to search a calculation result corresponding to the function information.
In this step, the second thread first needs to determine whether a function ID and a parameter of the function to be calculated exist in a second cache region; if the function ID and the parameter exist, the second thread acquires the function ID and the parameter from the second cache region, and records the cell where the function to be calculated is located in a second dirty unit set; the second thread calculates the network function according to the function ID and the parameters to obtain a calculation result; and the calculation result is stored in the first cache region; and returning to the step of judging whether the function ID and the parameter of the function to be calculated exist in the second cache region until the second thread judges that the function ID and the parameter of the function to be calculated do not exist in the second cache region, and judging whether the first thread is finished by the second thread.
Additionally, it may also happen that the first thread and the second thread access the second set of dirty cells simultaneously, and therefore a synchronization lock is set such that only one of the threads is randomly allowed to change the second set of dirty cells at the same time. Therefore, in this step, the determining, by the second thread, whether the first thread is finished includes: the second thread judges whether the synchronous variable is marked; if the synchronous variable is marked, the second thread judges that the first thread is not finished; and if the synchronous variable is not marked, the second thread judges that the first thread is ended.
In this embodiment, a method of comparing CPU consumption is adopted, a thread synchronization variable is used, the first thread marks once when starting calculation, and the mark is removed when finishing calculation; and after the second thread finishes the calculation of the network function, checking the synchronous variable every second, if the synchronous variable is marked, continuously checking the synchronous variable every second, and if the synchronous variable is not marked, judging that the first thread is finished.
If the first thread is finished, the second thread puts the cell recorded in the second dirty unit set into a first dirty unit set; and starting the first thread to search a calculation result corresponding to the function information, and entering a dormant state.
It should be noted that the first thread is usually a main thread, and the main thread may invoke different processes, such as a calculation process, according to different messages in the message queue.
In an actual application process, the first thread may have a process of diffusion before calculation, for example, a formula referred to by the cell a1 is a-a 2, a formula referred to by a2 is 1, when a user changes a2 to 2, only a2 is added to the first dirty cell set, and the diffusion before calculation of the first thread may also add a1 to the first dirty cell set, which is an existing mechanism of the WPS electronic form, and is not described herein again.
In practical applications, a situation that the first thread wakes up the second thread, the second thread starts the first thread, and the first thread wakes up the second thread again (wakes up) in such a loop start may also occur, so in this embodiment, a time limit is added to such a loop start (wake up), for example, 7 times, and if the time limit is exceeded, the first thread is made to no longer start the second thread in the process of calculating the network function, but is made to directly wait for the calculation result of the network function by the second thread.
In summary, in practical applications, the above process can be divided into two parts:
a first part: the second thread T starts and enters a sleep state. After the second thread T is woken up by the first thread S, it is checked whether function information exists in the second cache region C2, and if function information exists in the second cache region C2, that is, the function ID and the parameter of the function to be calculated, the function ID and the parameter are taken out to perform calculation of the network function, and the calculation result, the function ID and the parameter are placed in the first cache region C1. This is repeated until there are no function IDs and parameters of the functions to be calculated in the second buffer C2. And after the first thread S is finished, putting the cell recorded by the second dirty unit set TD into the first dirty unit set SD, starting the first thread S once, and entering a dormant state.
A second part: in the calculation process of the first thread S, if a network function is encountered, first, whether a corresponding calculation result exists is searched in the first cache region C1 through a function ID and a parameter of the network function, and if the calculation result can be found, the calculation result is directly returned to the memory; if not, the function ID and the parameter are put into the second buffer C2, determine whether the second thread T is in a sleeping state, if the second thread T is in the sleeping state, wake up the second thread T, record the cell being operated by the second dirty cell set TD, and return an error VALUE, wherein the error VALUE refers to # VALUE! # NUM! And the value is used as the calculation result of the function, the calculation result is returned to the first thread S to be used as the normal calculation result, and the calculation of the next function is continued. It should be noted that, the error value is returned to the memory, and when the spreadsheet is displayed, the data is fetched from the memory and drawn on the display screen.
In the asynchronous calculation method of the network function in the spreadsheet provided by the embodiment, a first thread acquires function information of the network function to be calculated; the first thread searches a calculation result corresponding to the function information in a first cache region; if the calculation result corresponding to the function information is not found in the first cache region, the first thread stores the function information to a second cache region; and the second thread acquires the function information from the second cache region, calculates the network function according to the function information, stores the calculation result into the first cache region, and starts the first thread to search the calculation result corresponding to the function information. Therefore, in the calculation process of the first thread, if the first thread encounters the network function to be calculated, the second thread is awakened to calculate the network function to be calculated, and after the second thread completes the calculation of the network function, the first thread is started to search the calculation result corresponding to the function information in the first cache region, so that the asynchronous calculation of the network function is realized, the time for a user to wait for the network function to return the calculation result is reduced, and the user experience is improved.
Fig. 2 is a schematic structural diagram of an asynchronous computing device for network functions in a spreadsheet according to an embodiment of the present invention. As shown in fig. 2, the apparatus provided in this embodiment may include: an acquisition module 21, a search module 22, a storage module 23 and a processing module 24.
The obtaining module 21 is configured to obtain function information of a network function to be calculated by using a first thread;
the searching module 22 is configured to search, in the first cache region, a calculation result corresponding to the function information by using the first thread;
a storage module 23, configured to store the function information in a second cache region by using the first thread if the search module 22 does not find the calculation result corresponding to the function information in the first cache region;
the processing module 24 is configured to obtain the function information from the second cache region by using a second thread, perform network function calculation according to the function information, store a calculation result in the first cache region, and start the first thread to search for a calculation result corresponding to the function information.
Specifically, the function information includes: function ID and parameters; the obtaining module 21 is specifically configured to: after the first thread is started, judging whether a function to be calculated exists in the first dirty unit set; the first dirty unit set comprises a unit cell to be processed; if so, acquiring a function ID and parameters of the function to be calculated by using the first thread; judging whether the function to be calculated is a network function or not according to the function ID; and if the judgment result is that the function to be calculated is the network function, the function ID and the parameter of the function to be calculated are function information of the network function to be calculated.
Further, the search module 22 is further configured to: if the calculation result corresponding to the function information is found in the first cache region, returning the calculation result to the memory; as shown in fig. 3, the apparatus provided in this embodiment further includes a first triggering module 31, configured to trigger the obtaining module 21; until the obtaining module 21 uses the first thread to determine that there is no function to be calculated in the first dirty unit set.
Further, the apparatus provided in this embodiment further includes: a calculation module 32; the obtaining module 21 is configured to, if the obtaining module 21 uses the first thread to determine that the function to be calculated is not a network function, perform function calculation according to the function ID and the parameter using the first thread to obtain a calculation result of the function to be calculated, and return the calculation result to the memory; a first triggering module 31, configured to trigger the obtaining module 21; until the obtaining module 21 uses the first thread to determine that there is no function to be calculated in the first dirty unit set.
The obtaining module 21 is specifically configured to: determining a marking bit corresponding to the function ID of the function to be calculated by using the first thread according to a preset function ID and a marking bit mapping table; and judging whether the function to be calculated is a network function or not according to the mark bit.
The processing module 24 is configured to: judging whether the function ID and the parameter of the function to be calculated exist in a second cache region by using the second thread; if the cell to be calculated exists in the first cache region, acquiring the function ID and the parameter from the first cache region, and recording the cell in which the function to be calculated is located in a first dirty cell set; calculating a network function according to the function ID and the parameters to obtain a calculation result; storing the calculation result to the first cache region; the second triggering module 32 is configured to trigger the processing module 24; until the processing module 24 uses the second thread to determine that the function ID and the parameter of the function to be calculated do not exist in the second cache region; the processing module 24 uses the second thread to determine whether the first thread is finished; if the first thread is finished, placing the cell recorded in the second dirty unit set into a first dirty unit set; and starting the first thread to search a calculation result corresponding to the function information, and entering a dormant state.
The device further comprises: a first determining module 34, configured to determine whether the second thread is in a sleep state by using a status flag bit of the first thread; a waking module 35, configured to wake up the second thread by using the first thread if the first determining module 34 determines that the second thread is in the sleep state.
The apparatus further comprises the second determining module 36 for determining whether a synchronization variable is marked using the second thread; if the synchronous variable is marked, judging that the first thread is not finished; and if the synchronous variable is not marked, judging that the first thread is ended.
The processing module 24 is specifically configured to: and sending a starting message to the first thread by using the second thread to start the first thread.
The embodiment provides an asynchronous computing device of a network function in a spreadsheet, which can be used for executing the technical scheme of the method embodiment, and the implementation principle and the technical effect are similar, and are not described herein again.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (18)

1. A method for asynchronous computation of a network function in a spreadsheet, comprising:
the first thread acquires function information of a network function to be calculated;
the first thread searches a calculation result corresponding to the function information in a first cache region;
if the calculation result corresponding to the function information is not found in the first cache region, the first thread stores the function information to a second cache region;
and the second thread acquires the function information from the second cache region, calculates the network function according to the function information, stores the calculation result into the first cache region, and starts the first thread to search the calculation result corresponding to the function information.
2. The method of claim 1, wherein the function information comprises: function ID and parameters;
the step of obtaining the function information of the network function to be calculated by the first thread includes:
after the first thread is started, judging whether a function to be calculated exists in the first dirty unit set; the first dirty unit set comprises a unit cell to be processed;
if the function ID and the parameter of the function to be calculated exist, the first thread acquires the function ID and the parameter of the function to be calculated;
the first thread judges whether the function to be calculated is a network function or not according to the function ID;
and if the judgment result is that the function to be calculated is the network function, the function ID and the parameter of the function to be calculated are function information of the network function to be calculated.
3. The method of claim 2, further comprising:
if the calculation result corresponding to the function information is found in the first cache region, returning the calculation result to the memory;
and returning to the step that the first thread judges whether the function to be calculated exists in the first dirty unit set until the first thread judges that the function to be calculated does not exist in the first dirty unit set.
4. The method of claim 2, further comprising:
if the first thread judges that the function to be calculated is not a network function, the first thread performs function calculation according to the function ID and the parameters to obtain a calculation result of the function to be calculated, and the calculation result is returned to the memory;
and returning to the step that the first thread judges whether the function to be calculated exists in the first dirty unit set until the first thread judges that the function to be calculated does not exist in the first dirty unit set.
5. The method according to claim 2, wherein the first thread determining whether the function to be calculated is a network function according to the function ID comprises:
the first thread determines a marking bit corresponding to the function ID of the function to be calculated according to a preset function ID and a marking bit mapping table;
and the first thread judges whether the function to be calculated is a network function or not according to the mark bit.
6. The method according to claim 2, wherein the step of the second thread obtaining the function information from the second cache region, performing network function calculation according to the function information, storing a calculation result in the first cache region, and starting the first thread to search for the calculation result corresponding to the function information includes:
the second thread judges whether the function ID and the parameter of the function to be calculated exist in a second cache region;
if the function ID and the parameter exist, the second thread acquires the function ID and the parameter from the second cache region, and records the cell where the function to be calculated is located in a second dirty unit set;
the second thread calculates the network function according to the function ID and the parameters to obtain a calculation result;
the second thread stores the calculation result to the first cache region;
returning to the step of judging whether the function ID and the parameter of the function to be calculated exist in the second cache region until the second thread judges that the function ID and the parameter of the function to be calculated do not exist in the second cache region, and judging whether the first thread is finished by the second thread;
if the first thread is finished, the second thread puts the cell recorded in the second dirty unit set into a first dirty unit set;
and the second thread starts the first thread to search a calculation result corresponding to the function information and enters a dormant state.
7. The method of claim 6, wherein after the first thread stores the function information in a second cache, further comprising:
the first thread judges whether the second thread is in a dormant state or not through a state flag bit;
and if the second thread is in a dormant state, the first thread wakes up the second thread.
8. The method of claim 6, wherein the second thread determining whether the first thread is finished comprises:
the second thread judges whether the synchronous variable is marked;
if the synchronous variable is marked, the second thread judges that the first thread is not finished;
and if the synchronous variable is not marked, the second thread judges that the first thread is ended.
9. The method of claim 6, wherein the second thread starting the first thread comprises:
and the second thread sends a starting message to the first thread to start the first thread.
10. An apparatus for asynchronous computation of network functions in spreadsheets, comprising:
the acquisition module is used for acquiring function information of the network function to be calculated by using a first thread;
the searching module is used for searching a calculation result corresponding to the function information in a first cache region by using the first thread;
the storage module is used for storing the function information to a second cache region by using the first thread if the search module does not search the calculation result corresponding to the function information in the first cache region;
and the processing module is used for acquiring the function information from the second cache region by using a second thread, calculating a network function according to the function information, storing a calculation result to the first cache region, and starting the first thread to search a calculation result corresponding to the function information.
11. The apparatus of claim 10, wherein the function information comprises: function ID and parameters;
the acquisition module is specifically configured to: after the first thread is started, judging whether a function to be calculated exists in the first dirty unit set; the first dirty unit set comprises a unit cell to be processed; if so, acquiring a function ID and parameters of the function to be calculated by using the first thread; judging whether the function to be calculated is a network function or not according to the function ID; and if the judgment result is that the function to be calculated is the network function, the function ID and the parameter of the function to be calculated are function information of the network function to be calculated.
12. The apparatus of claim 11, wherein the lookup module is further configured to:
if the calculation result corresponding to the function information is found in the first cache region, returning the calculation result to the memory;
the first triggering module is used for triggering the acquisition module; and ending the operation until the obtaining module judges that the function to be calculated does not exist in the first dirty unit set by using the first thread.
13. The apparatus of claim 11, further comprising: a calculation module;
the function calculation module is used for calculating the function to be calculated according to the function ID and the parameter by using the first thread if the acquisition module uses the first thread to judge that the function to be calculated is not the network function, so as to obtain a calculation result of the function to be calculated, and returning the calculation result to the memory;
the first triggering module is used for triggering the acquisition module; and ending the operation until the obtaining module judges that the function to be calculated does not exist in the first dirty unit set by using the first thread.
14. The apparatus of claim 11, wherein the obtaining module is specifically configured to:
determining a marking bit corresponding to the function ID of the function to be calculated by using the first thread according to a preset function ID and a marking bit mapping table; and judging whether the function to be calculated is a network function or not according to the mark bit.
15. The apparatus of claim 11, wherein the processing module is configured to:
judging whether the function ID and the parameter of the function to be calculated exist in a second cache region by using the second thread; if the cell to be calculated exists in the first cache region, acquiring the function ID and the parameter from the first cache region, and recording the cell in which the function to be calculated is located in a first dirty cell set; calculating a network function according to the function ID and the parameters to obtain a calculation result; storing the calculation result to the first cache region;
the second triggering module is used for triggering the processing module; until the processing module judges that the function ID and the parameter of the function to be calculated do not exist in the second cache region by using the second thread;
the processing module judges whether the first thread is finished or not by using the second thread; if the first thread is finished, placing the cell recorded in the second dirty unit set into a first dirty unit set; and starting the first thread to search a calculation result corresponding to the function information, and entering a dormant state.
16. The apparatus of claim 15, further comprising:
the first judging module is used for judging whether the second thread is in a dormant state or not by using the first thread through a state flag bit;
and the awakening module is used for awakening the second thread by using the first thread if the first judging module judges that the second thread is in the dormant state.
17. The apparatus of claim 15, further comprising: a second judging module:
for determining whether a synchronization variable is marked using the second thread; if the synchronous variable is marked, judging that the first thread is not finished; and if the synchronous variable is not marked, judging that the first thread is ended.
18. The apparatus of claim 15, wherein the processing module is specifically configured to:
and sending a starting message to the first thread by using the second thread to start the first thread.
CN201710003977.2A 2017-01-04 2017-01-04 Asynchronous calculation method and device for network function in spreadsheet Active CN108268564B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710003977.2A CN108268564B (en) 2017-01-04 2017-01-04 Asynchronous calculation method and device for network function in spreadsheet

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710003977.2A CN108268564B (en) 2017-01-04 2017-01-04 Asynchronous calculation method and device for network function in spreadsheet

Publications (2)

Publication Number Publication Date
CN108268564A CN108268564A (en) 2018-07-10
CN108268564B true CN108268564B (en) 2020-08-14

Family

ID=62771601

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710003977.2A Active CN108268564B (en) 2017-01-04 2017-01-04 Asynchronous calculation method and device for network function in spreadsheet

Country Status (1)

Country Link
CN (1) CN108268564B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115658144B (en) * 2022-12-09 2023-05-02 西安葡萄城软件有限公司 Electronic form formula on-demand calculation method and device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102222023A (en) * 2010-04-15 2011-10-19 微软公司 Asynchronous workflows
CN102662614A (en) * 2012-03-23 2012-09-12 安科智慧城市技术(中国)有限公司 Embedded device and time display method and time display system thereof
CN102724056A (en) * 2011-07-28 2012-10-10 北京天地互连信息技术有限公司 Mobile IPv6 network management system and method
CN104104614A (en) * 2014-06-13 2014-10-15 中国科学院计算技术研究所 Software defined network controller system in named data networking and method thereof
CN105446755A (en) * 2014-08-06 2016-03-30 阿里巴巴集团控股有限公司 Method and device for rapidly loading Activity data for Android system
CN106209606A (en) * 2016-08-31 2016-12-07 北京深思数盾科技股份有限公司 A kind of use the method for WEB mail, terminal and system safely

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102222023A (en) * 2010-04-15 2011-10-19 微软公司 Asynchronous workflows
CN102724056A (en) * 2011-07-28 2012-10-10 北京天地互连信息技术有限公司 Mobile IPv6 network management system and method
CN102662614A (en) * 2012-03-23 2012-09-12 安科智慧城市技术(中国)有限公司 Embedded device and time display method and time display system thereof
CN104104614A (en) * 2014-06-13 2014-10-15 中国科学院计算技术研究所 Software defined network controller system in named data networking and method thereof
CN105446755A (en) * 2014-08-06 2016-03-30 阿里巴巴集团控股有限公司 Method and device for rapidly loading Activity data for Android system
CN106209606A (en) * 2016-08-31 2016-12-07 北京深思数盾科技股份有限公司 A kind of use the method for WEB mail, terminal and system safely

Also Published As

Publication number Publication date
CN108268564A (en) 2018-07-10

Similar Documents

Publication Publication Date Title
US11181968B2 (en) Method and apparatus for running application program
JP2013145568A (en) Multi-thread processor having lock indicator
CN106570027B (en) Transactional task processing method and device
CN111274039B (en) Memory recycling method and device, storage medium and electronic equipment
US9170837B2 (en) Transaction concurrent execution control system, method and program for carrying out a control of concurrently executing a transaction, including measuring execution time from starting to ending of transaction execution
WO2019006997A1 (en) Program deadlock detection method, storage medium, device and system
CN103377292B (en) Database result set caching method and device
CN108268564B (en) Asynchronous calculation method and device for network function in spreadsheet
CN108133000B (en) Metadata storage method and device and server
CN113672263A (en) Firmware parameter update control method and device and electronic equipment
CN107273080B (en) Multithreading-based mobile terminal picture rendering method and device
CN110543259B (en) Fingerprint unlocking method of display equipment and display equipment
WO2018223359A1 (en) Heart rate measurement method and device
CN109062602A (en) It is a kind of for the data processing method of application program, device and electronic equipment
US20200372068A1 (en) Photo processing method, device and computer equipment
CN116700818B (en) Application program running method and electronic equipment
CN113625954B (en) Method, device and equipment for inquiring volume information and readable storage medium
CN115623557A (en) Network finding frequency determining method, network finding frequency determining device and electronic equipment
CN115061896A (en) Jitter time calculation method and device of electromagnetic transient simulation operating system
JP2002297443A (en) Dynamic memory management device, dynamic memory management method, computer program, recording medium with the program recorded thereon and portable terminal having these
WO2016107147A1 (en) Character entry method and device
CN114281792A (en) Transaction processing method, device, equipment and storage medium
CN105512338A (en) Method and device for realizing navigation tree with large data volume nodes on web front end
US8214834B2 (en) Asynchronous wakeup mechanism that places reference to process on sleep queue if execution of copyout functionality is caused to sleep
CN106326599B (en) System state monitoring method and device for multiprocessor system simulation

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant