Task allocation method based on thread pool

A task allocation and thread pool technology, applied in the field of multithreading and queues, can solve problems affecting software operation efficiency, unsaturated load of computer or terminal tasks, etc., to achieve the effect of direct task allocation, avoid creation and call, and avoid deadlock

Inactive Publication Date: 2015-09-09
BEIJING JINHER SOFTWARE
View PDF3 Cites 14 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

But, because the central processing unit (CPU) core chip of each computer or terminal is fixed, the thread data of processing task is also fixed, and too much or too little all can not bring into play its maximum performance, and this mode will inevitably cause computer or The terminal task is not saturated or the load is too heavy to affect the operating efficiency of the software

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
  • Task allocation method based on thread pool
  • Task allocation method based on thread pool
  • Task allocation method based on thread pool

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0045] The present invention will be further described in detail below in conjunction with the accompanying drawings, so that those skilled in the art can implement it with reference to the description.

[0046] The invention discloses a task allocation method based on a thread pool, such as figure 1 As shown, the method includes at least:

[0047] Step 1: Create a thread pool and a task pool; these two pools will not be released automatically before the software is closed to avoid resource waste caused by thread creation and switching, and all threads in the thread pool are in a waiting state. The specific examples of creating thread pool and task pool are as follows figure 2 shown.

[0048] Step 2, determining the value n according to the number of cores i of the processor chip; initializing n threads and storing the threads sequentially in the thread pool queue;

[0049] The calculation formula of the quantity value n is: n=i*2+2; (1)

[0050] Wherein, i represents the...

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 present invention provides a task allocation method based on a thread pool. The method comprises: S1, creating a thread pool and a task pool; S2, predetermining a numerical value n, initializing n threads and sequentially storing the threads into a queue of the thread pool; S3, after tasks are received, traversing the thread pool, and if idle threads exist in the thread pool, sequentially calling the idle threads from the thread pool and executing the tasks; and if no idle threads exist in the thread pool, sequentially storing the tasks into a queue of the task pool. The present invention provides a multi-thread task allocation method which can sufficiently utilize existing hardware resources, implements software multi-task parallel execution and can be repeatedly used for each task executor, solves the problems of operation performance, usability and the like of software, and avoids the problem of resource waste caused by creation calling and switching of threads.

Description

technical field [0001] The invention belongs to the field of multithreading and queues, in particular to a task allocation method based on a thread pool. Background technique [0002] With the continuous development of information technology and software industry, the hardware resources carried by it are also developing rapidly at the same time, but people are constantly putting forward higher requirements for the use of software or applications, such as: performance, ease of use, etc. , Only by meeting people's needs can products be more competitive in the market and enterprises can go further. [0003] At present, for the allocation of thread tasks, the method of creating threads randomly or without restriction is generally adopted. But, because the central processing unit (CPU) core chip of each computer or terminal is fixed, the thread data of processing task is also fixed, and too much or too little all can not bring into play its maximum performance, and this mode wil...

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/50
Inventor 李军锋
Owner BEIJING JINHER SOFTWARE
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