Check patentability & draft patents in minutes with Patsnap Eureka AI!

Coroutine processing and management method based on interrupt reentry mechanism

A processing method and coroutine technology, applied in the computer field, can solve problems such as large thread resource consumption, complex programming model, and no support for high-availability features of programs, and achieve the effect of low thread resource consumption

Pending Publication Date: 2021-01-01
曹蕤
View PDF0 Cites 1 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

Obviously, the problem with such a program is that once large-scale parallel advancement is required (for example, more than 1,000 parallel branches), and many branches have long-term synchronous blocking scenarios, the runtime thread resource consumption is huge
Obviously, the consumption of thread resources is minimized, but the problem with such a program is that the programming model is complex, does not conform to people's thinking habits, the maintainability of the code is poor, and it cannot even support component-based development, and the Process method cannot be encapsulated into A method that returns the completion result when the E action completes
Unfortunately, there are few languages ​​that support this coroutine programming model, and the most widely used languages ​​in the industry such as Java and C++ do not support it; and even if the language itself supports this coroutine programming model, most languages ​​generally do not support it. The program automatically has some high-availability features, such as the same scheduler can be switched to run, and the program can continue to execute after the system is restored.

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Coroutine processing and management method based on interrupt reentry mechanism
  • Coroutine processing and management method based on interrupt reentry mechanism
  • Coroutine processing and management method based on interrupt reentry mechanism

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0060] A coroutine processing method based on an interrupt reentry mechanism. The coroutine includes a main coroutine and a sub-coroutine. The interrupt reentry steps include:

[0061] S1: The main coroutine throws an interrupt request, and the underlying framework of the main coroutine responds to the interrupt request and sends the task request asynchronously;

[0062] S2: Switch to the external system processing logic, and the main coroutine releases thread resources;

[0063] S3: The task request response executes the reentrant sub-coroutine through the callback interface, and restores the context state at the time of interruption;

[0064] S4: The sub-coroutine continues to process subsequent logic until the execution ends and the thread resources are released; or the sub-coroutine throws an interrupt request as the new main coroutine, and repeats the above steps S1 to S4.

[0065] Such as Figure 5 As shown, the main coroutine executes the PartA action and throws an in...

Embodiment 3

[0092] Such as Figure 11 As shown, a coroutine management method based on the interrupt reentrant mechanism, the coroutine described in Embodiment 1 is combined into an application, the coroutine includes a coroutine identifier, an interrupt identifier isInterrupted and a memory, and the application operation includes a start processing interface Process() and multiple reentry processing interface Resume() calls, including application entry OnProcess(), start processing interface Process() and reentry processing interface Resume() are executed by calling application entry OnProcess() Logic, the application entry OnProcess() includes the CallBatch() interface described in Embodiment 1; before calling the application entry OnProcess(), the application entry OnProcess() is invoked by traversing the set of coroutines of the application.

[0093] Looping through the application's collection of coroutines involves the following steps:

[0094] 1. Execute the while loop to traverse t...

Embodiment 4

[0110] Apply the method for processing coroutines based on the interrupt reentry mechanism described in Embodiment 1 and the method for managing coroutines based on the mechanism of interrupt reentry described in Embodiment 3 to process the case of batch wage payment transactions during the day.

[0111] The transaction processing process includes 3 steps: file reading and warehousing —> wage payment —> result file generation. The data scale to be processed in the file may be relatively large (ranging from tens of thousands to millions). In order to improve transaction processing performance on the basis of efficient use of thread resources, these three steps are arranged in the batch salary payment scheduling application (executed based on the scheduling system). When step 2 is executed, we will The data is divided into blocks, and each block corresponds to a batch batch processing task (executed based on the batch processing system). In this way, all batch processing task re...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention discloses a coroutine processing and management method based on an interrupt reentry mechanism; and in a processing method, a coroutine comprises a main coroutine and a sub-coroutine, the interrupt reentry step comprises the following steps: S1, enabling the main coroutine to throw an interrupt request, and so a bottom layer framework of the main coroutine responds to the interrupt request and asynchronously sends a task request; s2, switching to an external system processing logic, wherein the main co-thread releases thread resources; s3, executing reentry of the task request response into the sub-coroutine through a callback interface, and recovering to a context state during interruption; s4, enabling the sub-coroutines to continue to process subsequent logic until execution is finished, and then thread resources are released; or using the sub-coroutine as a new main coroutine to throw out the interrupt request, and repeating the steps S1 to S4; in the management method, the coroutine combination is an application, and the application program entry OnProcess () comprises a CallBatch () interface in the processing method. According to the invention, the developmentand maintenance complexity and workload of a scheduling program with a large number of parallel branches are greatly reduced.

Description

technical field [0001] The invention belongs to the technical field of computers, and in particular relates to a coroutine processing and management method based on an interrupt reentry mechanism. Background technique [0002] In business application development, it is often necessary to develop some schedulers. These programs need to advance many branch processes at the same time, and many branch processes will take a long time to execute due to external cooperation, such as figure 1 The scheduling process shown (wherein, B, C, and D all represent submitting a batch task and waiting for the completion result of the task). The above-mentioned scheduler is developed in a common programming language, and usually cooperates with the outside world in a synchronous blocking manner. Therefore, only multi-threading can be used to achieve multi-branch parallel advancement. Its working mechanism is as follows: figure 2 shown. Obviously, the problem with such a program is that once...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Applications(China)
IPC IPC(8): G06F9/48G06F9/46G06F9/50G06F9/52
CPCG06F9/4812G06F9/461G06F9/5027G06F9/52G06F2209/5018
Inventor 曹蕤
Owner 曹蕤
Features
  • R&D
  • Intellectual Property
  • Life Sciences
  • Materials
  • Tech Scout
Why Patsnap Eureka
  • Unparalleled Data Quality
  • Higher Quality Content
  • 60% Fewer Hallucinations
Social media
Patsnap Eureka Blog
Learn More