Movatterモバイル変換


[0]ホーム

URL:


CN103473138A - Multi-tasking queue scheduling method based on thread pool - Google Patents

Multi-tasking queue scheduling method based on thread pool
Download PDF

Info

Publication number
CN103473138A
CN103473138ACN2013104281194ACN201310428119ACN103473138ACN 103473138 ACN103473138 ACN 103473138ACN 2013104281194 ACN2013104281194 ACN 2013104281194ACN 201310428119 ACN201310428119 ACN 201310428119ACN 103473138 ACN103473138 ACN 103473138A
Authority
CN
China
Prior art keywords
task
worker thread
thread
queue
tqi
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.)
Pending
Application number
CN2013104281194A
Other languages
Chinese (zh)
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.)
LIUZHOU BOYUAN HUANKE SCIENCE & TECHNOLOGY Co Ltd
Original Assignee
LIUZHOU BOYUAN HUANKE SCIENCE & 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 LIUZHOU BOYUAN HUANKE SCIENCE & TECHNOLOGY Co LtdfiledCriticalLIUZHOU BOYUAN HUANKE SCIENCE & TECHNOLOGY Co Ltd
Priority to CN2013104281194ApriorityCriticalpatent/CN103473138A/en
Publication of CN103473138ApublicationCriticalpatent/CN103473138A/en
Pendinglegal-statusCriticalCurrent

Links

Images

Landscapes

Abstract

The invention discloses a multi-tasking queue scheduling method based on a thread pool. First, a corresponding task queue is created according to task types, and the task queue is not directly associated with work threads in a work thread pool. Then, a task dispatcher is created for receiving a task and dispatching the task to the corresponding task queue according to the type of the task. Finally, when the task is dispatched to the task queue by the task dispatcher, an idle work thread is invoked from the work thread pool to execute the task. After the task is executed, the work thread returns to the work thread pool. The method can adapt to conditions that a large quantity of tasks belonging to different types exist and that all the tasks need to be instantly and orderly processed, one independent work process or thread does not need to be created for each task type, system resources can be greatly and effectively saved, and the work threads in the work thread pool can be created or deleted according to actual conditions, so that the scheduling system adopting the method has great thread count scalability.

Description

Multitask array dispatching method based on thread pool
Technical field
The invention belongs to the computer engineering design field, related to a kind of multitask array dispatching method designed based on the worker thread pond.
Background technology
RTOS (Realtime operation system, real time operating system) is basis and the development platform of embedded application software, is a reliability and credible very high real-time kernel.RTOS wires up the resources such as CPU time, interruption, I/O, timer, leave API (the Application Program Interface of a standard of user for, and, according to the priority of each task, reasonably between different task, distribute CPU time application programming interfaces).
RTOS usually is arranged in embedded system and completes in real time various functions, and these embedded systems have that real-time is fine, system bulk is little usually, resource-constrained and there is no the characteristics such as graphical interfaces.Typical RTOS has: Vxworks, pSOS, Nucleus, eCos, uC/OS-II etc.
GUI (Graphic User Interface, graphical user interface) system realizes man-machine interaction in the mode of figure, scheduling mechanism is the core of GUI system, and driving and each application program of management GUI system, realize the shared use of each application program to cpu resource.High performance GUI scheduling mechanism not only takies cpu resource seldom, and can respond fast user's request.
Above-mentioned GUI scheduling mechanism does not refer to the task scheduling of operating system nucleus aspect, and refers to the scheduling mechanism between each application program with interface display.For example, start just enters the standby module, off-hook just enters dial module, off-hook is not pressed function key with regard to entered function menu module, thereby from function menu, select camera to enter photo module, if incoming call is now arranged, enter the voice call module, return to again photo module after the talk-through on-hook.
The GUI that current typical GUI system is Windows operating system, in embedded system, more common GUI system is Qtopia and MiniGUI.Below introduce respectively above-mentioned three GUI systems.
1.Windows CE (Control System, control system)
Windows CE is embedded OS, and complete gui interface and dispatching system is provided, almost completely consistent on interface with the Windows of PC version.
2.MiniGUI
MiniGUI, for the graphical interfaces back-up system of embedded device, cross operating system, belongs to a kind of " embedded graphic middleware " software product.In the development course of nearly 8 years, MiniGUI from one be only little technology in order to develop at the Linux Chinese display, develop into a mbedded GUI back-up system cross operating system, perfect.MiniGUI most desirably platform is (SuSE) Linux OS, also can support the RTOS such as uCOSII.
3.Qtopia
Qtopia is developed by Qt/Embedded, is the Qt version of embedded system.Because the GUI that Qt is the project such as KDE to be used supports storehouse, therefore there are many X Window programs based on Qt to be transplanted to easily on the Qtopia version.Qtopia is a C++ function library, and the control collection style that it provides has been continued to use the PC style.
The shortcoming of above-mentioned GUI system of the prior art is: the thread scheduling that the scheduling of above-mentioned GUI system is used kernel to provide fully, whether each application program is no matter need interface display to have thread independently to receive the scheduling of operating system.The operating system powerful based on bottom is done support, although the design of each application program has great dirigibility,, each application program is too heavy to the dependence of underlying operating system, usually need the support of the operating system of hardware and software platform, such as Windows or (SuSE) Linux OS.
The resource overhead of above-mentioned GUI system is huge, and the application demand of can not adaptive functions clear and definite low profile edge system is not generally supported the operating system of RTOS as bottom.In addition, for Embedded Application, also do not need complicated GUI system, too complicated GUI in fact can reduce the simplicity of user's operation.
Be a kind of slack relationships between each application program of above-mentioned GUI system, may occur two following problems while causing realizing a plurality of application program:
If 1 a plurality of application programs that will realize are as different function of application modules, requiring does not have too many connecting each other between these function of application modules.Once between these function of application modules, complicated contact be arranged, these function of application modules will inevitably produce conflict to the resource of system and the demand of equipment (such as Camera, internal memory), implement and are difficult to safeguard;
If 2 a plurality of application programs that will realize are as a single utility program functional module, bring huge maintenance difficulties can to a plurality of programmers' co-development, will cause a plurality of programmers to go to develop same module or a programmer completes a large-scale module.
And so shortcoming or deficiency appear in said system, be exactly mainly improper the causing of logical design of its dispatching method, therefore, we need the more rational multitask array dispatching method of a kind of logical design.
Summary of the invention
The queue data structure that provides a kind of worker thread pond built-in based on operating system and development language to provide and the multitask array dispatching method that designs are provided for the deficiencies in the prior art.This dispatching method is specially adapted to have a large amount of dissimilar tasks, and all tasks all need the sight that can immediately also process in order.The characteristics of this method are that it has good process or Thread Count scalability; Because it does not need for each task type creates the independently progress of work or a thread, so it can save system resource greatly.
To achieve these goals, the present invention has taked following technical scheme:
A kind of multitask array dispatching method based on thread pool comprises the following steps:
(1) be the task queue that every kind of task type creates a correspondence, and be designated as respectively TQ1, TQ2 ..., TQn;
(2) create one or two above task distributors, the reception task also distributes in corresponding task queue according to task type;
(3) initial work thread pool, the worker thread of idle condition enters sleep state;
(4), when the task distributor receives the task Ti of a certain type, find its corresponding task queue TQi, and judge whether the pending task of this task queue is empty;
(5) if the pending task of this task queue TQi is empty, task Ti is put in this task queue TQi, and carries out following operation:
A. search the worker thread of idle condition in the worker thread pond, if in the worker thread pond without the worker thread of idle condition, create a new worker thread, and it joined in the worker thread pond;
B. with the worker thread of the idle condition that finds or the newly-built worker thread Ti that executes the task;
(6) if the pending task of this task queue TQi is not empty, task Ti is placed on to the end of task queue TQi, wait task is carried out;
(7) after worker thread executes a task Ti, search the queue TQi that Ti is corresponding, then carry out following operation:
A. task Ti is removed from TQi;
If b. TQi is not empty, continue to carry out the task of team's head;
If c. TQi is empty, stop carrying out, worker thread returns the worker thread pond.
As of the present invention, further illustrate, above-described task distributor is independently process or a thread.
As of the present invention, further illustrate, above-described worker thread pond creates more than one worker thread, and worker thread is not directly related with task queue.
As of the present invention, further illustrate, above-described pending task comprises does not execute the task and is carrying out but uncompleted task.
As of the present invention, further illustrate, after above-described worker thread returns the worker thread pond, the worker thread pond will be destroyed this worker thread or this worker thread be distributed to other task queues and execute the task.
Advantage of the present invention:
1. in the present invention, create a plurality of task queues arranged, like this method just go for having a large amount of dissimilar tasks and all tasks all need can be immediately and the sight of processing in order.
2. in the present invention, the worker thread in task queue and worker thread pond does not have direct correlation, therefore, does not need, for each task type creates the independently progress of work or a thread, can effectively save greatly system resource.
3. in the present invention, the worker thread in the worker thread pond can create or destroy according to actual conditions, makes like this and adopts the dispatching system of this method to have good process or Thread Count scalability.
4. reasonable, feasible, the easy realization of logical design of the present invention.
The accompanying drawing explanation
Fig. 1 is the schematic diagram of dispatching method of the present invention.
Fig. 2 is the logical design process flow diagram of the task distributor in the present invention.
Fig. 3 is the logical design process flow diagram of the worker thread in the present invention.
Embodiment
Below in conjunction with drawings and Examples, the present invention is further described.
Embodiment:
As Figure 1-3, a kind of multitask array dispatching method based on thread pool comprises the following steps:
(1) be the task queue that every kind of task type creates a correspondence, and be designated as respectively TQ1, TQ2 ..., TQn;
(2) create one or two above task distributors, the reception task also distributes in corresponding task queue according to task type; Described task distributor is independently process or a thread;
(3) initial work thread pool, the worker thread of idle condition enters sleep state; Described worker thread pond creates more than one worker thread, and worker thread is not directly related with task queue;
(4), when the task distributor receives the task Ti of a certain type, find its corresponding task queue TQi, and judge whether the pending task of this task queue is empty; Described pending task comprises does not execute the task and is carrying out but uncompleted task;
(5) if the pending task of this task queue TQi is empty, task Ti is put in this task queue TQi, and carries out following operation:
A. search the worker thread of idle condition in the worker thread pond, if in the worker thread pond without the worker thread of idle condition, create a new worker thread, and it joined in the worker thread pond;
B. with the worker thread of the idle condition that finds or the newly-built worker thread Ti that executes the task;
(6) if the pending task of this task queue TQi is not empty, task Ti is placed on to the end of task queue TQi, wait task is carried out;
(7) after worker thread executes a task Ti, search the queue TQi that Ti is corresponding, then carry out following operation:
A. task Ti is removed from TQi;
If b. TQi is not empty, continue to carry out the task of team's head;
If c. TQi is empty, stop carrying out, worker thread returns the worker thread pond; After described worker thread returns the worker thread pond, the worker thread pond will be destroyed this worker thread or this worker thread be distributed to other task queues and execute the task.
The method goes for having a large amount of dissimilar tasks and all tasks all need the sight that can immediately also process in order, and do not need, for each task type creates the independently progress of work or a thread, can effectively save greatly system resource.

Claims (5)

CN2013104281194A2013-09-182013-09-18Multi-tasking queue scheduling method based on thread poolPendingCN103473138A (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN2013104281194ACN103473138A (en)2013-09-182013-09-18Multi-tasking queue scheduling method based on thread pool

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN2013104281194ACN103473138A (en)2013-09-182013-09-18Multi-tasking queue scheduling method based on thread pool

Publications (1)

Publication NumberPublication Date
CN103473138Atrue CN103473138A (en)2013-12-25

Family

ID=49798006

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN2013104281194APendingCN103473138A (en)2013-09-182013-09-18Multi-tasking queue scheduling method based on thread pool

Country Status (1)

CountryLink
CN (1)CN103473138A (en)

Cited By (23)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN103761157A (en)*2014-01-212014-04-30国家电网公司Method for implementing system fault-tolerant mechanism on basis of multitask patrol strategy
CN104111877A (en)*2014-07-292014-10-22广东能龙教育股份有限公司 A thread resource dynamic allocation system and method based on a thread allocation engine
CN104199730A (en)*2014-08-292014-12-10浪潮集团有限公司Single-thread multi-task processing method based on synchronous I/O multiplexing mechanism
CN106095546A (en)*2016-06-012016-11-09深圳市永兴元科技有限公司The task management method of cloud computing platform and device
CN106407197A (en)*2015-07-282017-02-15北京京东尚科信息技术有限公司Data traversing method and device
CN106598726A (en)*2016-11-042017-04-26厦门安胜网络科技有限公司Multi-task management system and distributed deployment method thereof
CN106844589A (en)*2017-01-102017-06-13深圳市爱立峰科技有限公司The asynchronous storage method of database data and system
CN107688907A (en)*2017-09-052018-02-13江苏电力信息技术有限公司A kind of goods and materials sampling observation method based on queue layered shaping mechanism
CN108241524A (en)*2016-12-262018-07-03北京视联动力国际信息技术有限公司A kind of task executing method and system
CN108881150A (en)*2017-12-292018-11-23北京安天网络安全技术有限公司A kind of processing method of Detection task, device, electronic equipment and storage medium
CN109271240A (en)*2018-08-052019-01-25温州职业技术学院A kind of process scheduling method based on multicore processing
CN109582455A (en)*2018-12-032019-04-05恒生电子股份有限公司Multithreading task processing method, device and storage medium
CN109614506A (en)*2018-11-052019-04-12厦门市美亚柏科信息股份有限公司A kind of method, apparatus and storage medium importing picture library based on rocksdb re-scheduling data
CN110750339A (en)*2018-07-232020-02-04杭州海康威视系统技术有限公司 A thread scheduling method, device and electronic device
CN110795222A (en)*2019-10-252020-02-14北京浪潮数据技术有限公司Multithreading task scheduling method, device, equipment and readable medium
CN110990132A (en)*2019-11-012020-04-10浙江大搜车软件技术有限公司Asynchronous task processing method and device, computer equipment and storage medium
CN111552546A (en)*2020-04-162020-08-18贝壳技术有限公司Task implementation method and device based on multithreading and storage medium
CN111597019A (en)*2020-04-222020-08-28深圳中兴网信科技有限公司Call request processing method, device, terminal and computer readable storage medium
CN112445615A (en)*2020-11-122021-03-05广州海鹚网络科技有限公司Thread scheduling system, computer equipment and storage medium
CN112817762A (en)*2021-01-292021-05-18中汽创智科技有限公司Dispatching system based on adaptive automobile open system architecture standard and dispatching method thereof
CN113495780A (en)*2020-04-072021-10-12Oppo广东移动通信有限公司Task scheduling method and device, storage medium and electronic equipment
CN115344364A (en)*2022-07-252022-11-15中瓴智行(成都)科技有限公司 A task scheduling management method, device and electronic equipment
CN115883627A (en)*2022-11-222023-03-31山东鲁软数字科技有限公司Embedded data transmission method and system

Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US6892331B2 (en)*2002-01-172005-05-10International Business Machines CorporationMethod and system for error detection in a managed application environment
CN101290619A (en)*2007-04-202008-10-22西北民族大学 Content-based intelligent robot search method for Thangka image search engine on Tibetan website
CN102122252A (en)*2011-03-142011-07-13华中科技大学Method for designing thread pool capable of ensuring temporal succession
CN102902573A (en)*2012-09-202013-01-30北京搜狐新媒体信息技术有限公司Task processing method and device based on shared resources
CN101599027B (en)*2009-06-302013-02-13中兴通讯股份有限公司Thread pool management method and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US6892331B2 (en)*2002-01-172005-05-10International Business Machines CorporationMethod and system for error detection in a managed application environment
CN101290619A (en)*2007-04-202008-10-22西北民族大学 Content-based intelligent robot search method for Thangka image search engine on Tibetan website
CN101599027B (en)*2009-06-302013-02-13中兴通讯股份有限公司Thread pool management method and system
CN102122252A (en)*2011-03-142011-07-13华中科技大学Method for designing thread pool capable of ensuring temporal succession
CN102902573A (en)*2012-09-202013-01-30北京搜狐新媒体信息技术有限公司Task processing method and device based on shared resources

Cited By (33)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN103761157A (en)*2014-01-212014-04-30国家电网公司Method for implementing system fault-tolerant mechanism on basis of multitask patrol strategy
CN104111877A (en)*2014-07-292014-10-22广东能龙教育股份有限公司 A thread resource dynamic allocation system and method based on a thread allocation engine
CN104199730B (en)*2014-08-292018-04-13浪潮集团有限公司A kind of single thread multi-task processing method based on synchronous i/o multiplexing mechanism
CN104199730A (en)*2014-08-292014-12-10浪潮集团有限公司Single-thread multi-task processing method based on synchronous I/O multiplexing mechanism
CN106407197A (en)*2015-07-282017-02-15北京京东尚科信息技术有限公司Data traversing method and device
CN106407197B (en)*2015-07-282020-06-30北京京东尚科信息技术有限公司Method and device for traversing data
CN106095546A (en)*2016-06-012016-11-09深圳市永兴元科技有限公司The task management method of cloud computing platform and device
CN106598726A (en)*2016-11-042017-04-26厦门安胜网络科技有限公司Multi-task management system and distributed deployment method thereof
CN108241524A (en)*2016-12-262018-07-03北京视联动力国际信息技术有限公司A kind of task executing method and system
CN108241524B (en)*2016-12-262019-04-02视联动力信息技术股份有限公司A kind of task executing method and system
CN106844589A (en)*2017-01-102017-06-13深圳市爱立峰科技有限公司The asynchronous storage method of database data and system
CN107688907A (en)*2017-09-052018-02-13江苏电力信息技术有限公司A kind of goods and materials sampling observation method based on queue layered shaping mechanism
CN107688907B (en)*2017-09-052022-01-18江苏电力信息技术有限公司Material sampling inspection method based on queue layering processing mechanism
CN108881150B (en)*2017-12-292021-03-23北京安天网络安全技术有限公司Detection task processing method and device, electronic equipment and storage medium
CN108881150A (en)*2017-12-292018-11-23北京安天网络安全技术有限公司A kind of processing method of Detection task, device, electronic equipment and storage medium
CN110750339B (en)*2018-07-232022-04-26杭州海康威视系统技术有限公司 A thread scheduling method, device and electronic device
CN110750339A (en)*2018-07-232020-02-04杭州海康威视系统技术有限公司 A thread scheduling method, device and electronic device
CN109271240A (en)*2018-08-052019-01-25温州职业技术学院A kind of process scheduling method based on multicore processing
CN109614506A (en)*2018-11-052019-04-12厦门市美亚柏科信息股份有限公司A kind of method, apparatus and storage medium importing picture library based on rocksdb re-scheduling data
CN109582455B (en)*2018-12-032021-06-18恒生电子股份有限公司Multithreading task processing method and device and storage medium
CN109582455A (en)*2018-12-032019-04-05恒生电子股份有限公司Multithreading task processing method, device and storage medium
CN110795222A (en)*2019-10-252020-02-14北京浪潮数据技术有限公司Multithreading task scheduling method, device, equipment and readable medium
CN110795222B (en)*2019-10-252022-03-22北京浪潮数据技术有限公司Multithreading task scheduling method, device, equipment and readable medium
CN110990132B (en)*2019-11-012023-03-10浙江大搜车软件技术有限公司Asynchronous task processing method and device, computer equipment and storage medium
CN110990132A (en)*2019-11-012020-04-10浙江大搜车软件技术有限公司Asynchronous task processing method and device, computer equipment and storage medium
CN113495780A (en)*2020-04-072021-10-12Oppo广东移动通信有限公司Task scheduling method and device, storage medium and electronic equipment
CN111552546A (en)*2020-04-162020-08-18贝壳技术有限公司Task implementation method and device based on multithreading and storage medium
CN111597019A (en)*2020-04-222020-08-28深圳中兴网信科技有限公司Call request processing method, device, terminal and computer readable storage medium
CN112445615A (en)*2020-11-122021-03-05广州海鹚网络科技有限公司Thread scheduling system, computer equipment and storage medium
CN112445615B (en)*2020-11-122025-01-28广州海鹚网络科技有限公司 A thread scheduling system, computer device and storage medium
CN112817762A (en)*2021-01-292021-05-18中汽创智科技有限公司Dispatching system based on adaptive automobile open system architecture standard and dispatching method thereof
CN115344364A (en)*2022-07-252022-11-15中瓴智行(成都)科技有限公司 A task scheduling management method, device and electronic equipment
CN115883627A (en)*2022-11-222023-03-31山东鲁软数字科技有限公司Embedded data transmission method and system

Similar Documents

PublicationPublication DateTitle
CN103473138A (en)Multi-tasking queue scheduling method based on thread pool
CN103473129B (en)Multi-task queue scheduling system with scalable number of threads and implementation method thereof
CN103984598B (en)method and system for thread scheduling
EP2819009B1 (en)Task scheduling for highly concurrent analytical and transaction workloads
CN102023844B (en)Parallel processor and thread processing method thereof
US9104500B1 (en)Lock-free job scheduler for multi-processor systems
CN101464810A (en)Service program processing method and server
CN101226487A (en)Method for implementing inner core level thread library based on built-in Linux operating system
EP3211525B1 (en)Cpu/gpu synchronization mechanism
CN103473135B (en)The processing method of spin lock LHP phenomenon under virtualized environment
CN102375761A (en)Business management method, device and equipment
CN106062716B (en)The method, apparatus and single task system of multitask are realized in single task system
CN107562685B (en)Method for data interaction between multi-core processor cores based on delay compensation
CN112732416B (en)Parallel data processing method and parallel processor for effectively eliminating data access delay
US10831539B2 (en)Hardware thread switching for scheduling policy in a processor
CN102736595A (en)Unified platform of intelligent power distribution terminal based on 32 bit microprocessor and real time operating system (RTOS)
CN105204933A (en)Multitask switching execution method based on single process, multitask switching execution system based on single process and processor
CN105187327A (en)Distributed message queue middleware
CN103617071A (en)Method and device for improving calculating ability of virtual machine in resource monopolizing and exclusive mode
Jia et al.Skyloft: A General High-Efficient Scheduling Framework in User Space
CN117539598A (en)Task processing method and device, electronic equipment and storage medium
CN101266556A (en)Multitask scheduling system
CN101604259B (en)Method for synchronously scheduling a plurality of processes based on embedded system
Qaralleh et al.HcM-FreeRTOS: hardware-centric FreeRTOS for ARM multicore
CN101349975A (en)Method for implementing interrupt bottom semi-section mechanism and embedded system thereof

Legal Events

DateCodeTitleDescription
C06Publication
PB01Publication
C10Entry into substantive examination
SE01Entry into force of request for substantive examination
C02Deemed withdrawal of patent application after publication (patent law 2001)
WD01Invention patent application deemed withdrawn after publication

Application publication date:20131225


[8]ページ先頭

©2009-2025 Movatter.jp