Method and system for distributing thread execution task

A technology for executing tasks and assigning lines, applied in the computer field, can solve the problems of no feedback of execution results and inconvenient application, and achieve the effects of convenient application, reduced waste, and flexible use of threads

Inactive Publication Date: 2012-07-18
BEIJING FEINNO COMM TECH
View PDF4 Cites 87 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] The present invention provides a method and system for assigning threads to execute tasks t

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
  • Method and system for distributing thread execution task
  • Method and system for distributing thread execution task
  • Method and system for distributing thread execution task

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0062] In order to make the object, technical solution and advantages of the present invention clearer, the implementation manner of the present invention will be further described in detail below in conjunction with the accompanying drawings.

[0063] see figure 1 , is a flow chart of the method for assigning threads to execute tasks provided by the present invention.

[0064] A method for assigning threads to perform tasks, characterized in that the method comprises:

[0065] Step S100, creating a thread pool.

[0066] Step S200, create a task, and add the task to the task queue.

[0067] Step S300, calling an idle thread in the thread pool, and assigning tasks in the task queue to the idle thread.

[0068] Step S400, after the thread executes the task, return the execution result to the task.

[0069] Further, the creating a task further includes adding result object parameters and a multicast delegate object containing task operations to the task.

[0070] The step S4...

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 method and a system for distributing thread execution task. The method comprises the following steps of: a step 1 of creating a thread pool; a step 2 of creating the task and adding the task into a task queue; a step 3 of calling idle threads in the thread pool and distributing the task in the task queue to the idle threads; and a step 4 of returning an execution result to the task after the threads execute the task. The invention can solve the problems of no feedback of the execution result, insufficient convenience and rapidness of application.

Description

technical field [0001] The invention relates to the field of computers, in particular to a method and system for assigning threads to execute tasks. Background technique [0002] In the prior art, in a multi-threaded application, if too many threads are created, the occupation of system resources will be increased, and the conflict between resource requirements and potential occupation needs to be dealt with. The use of multithreading will complicate the task execution process and resource competition, and errors are prone to occur. In the prior art, a thread pool is used to solve such problems. However, the thread pool solution in the prior art uses a fixed number of threads, and after the execution is completed, there is no feedback of the execution result, and there is no priority distinction for the execution of tasks. [0003] In the prior art, because there is no feedback on execution results, the application is not convenient enough; because the number of threads is...

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
IPC IPC(8): G06F9/50
Inventor 李江林
Owner BEIJING FEINNO COMM TECH
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products