CN102262564A - Thread pool structure of video monitoring platform system and realizing method - Google Patents

Thread pool structure of video monitoring platform system and realizing method Download PDF

Info

Publication number
CN102262564A
CN102262564A CN 201110234302 CN201110234302A CN102262564A CN 102262564 A CN102262564 A CN 102262564A CN 201110234302 CN201110234302 CN 201110234302 CN 201110234302 A CN201110234302 A CN 201110234302A CN 102262564 A CN102262564 A CN 102262564A
Authority
CN
China
Prior art keywords
thread
task
formation
binding
pool
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
CN 201110234302
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.)
Tianjin Tianxiang Shilian Network Technology Co Ltd
Original Assignee
Tianjin Tianxiang Shilian Network 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 Tianjin Tianxiang Shilian Network Technology Co Ltd filed Critical Tianjin Tianxiang Shilian Network Technology Co Ltd
Priority to CN 201110234302 priority Critical patent/CN102262564A/en
Publication of CN102262564A publication Critical patent/CN102262564A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Closed-Circuit Television Systems (AREA)

Abstract

The invention provides a thread pool structure of a video monitoring platform system and a realizing method. The thread pool structure provided by the invention comprises a managing thread, a task queue, an idle thread queue, a binding task thread queue and an information callback. The method provided by the invention comprises the following steps of: obtaining tasks from the task queue and classifying the tasks according to task types; binding thread tasks and binding the tasks with the thread; adding the thread into the binding task thread queue or applying an idle thread executing task and adding an executing task thread into a busy thread queue; after executing tasks by the thread, returning all tasks back to a thread pool. The method provided by the invention can avoid the instability and expenditure caused by frequently establishing and destroying threads and the error of the up-application does not cause the abnormality of the thread pool; the method provided by the invention constructs a general thread pool system structure so that developers can conveniently and rapidly develop application services which are suitable for large scales and are stably developed in the system; the structure of the thread pool has a high abstractness so that the work is simplified and the work efficiency is improved.

Description

The thread pool structure and the implementation method of video monitoring platform system
Technical field
The present invention relates to the technical field of video monitoring, is a kind of thread pool structure and implementation method that is applicable to the multithreading processing environment, the video monitoring platform system of stable operation can be provided specifically.
Background technology
Linux is as the system platform of server, the general application services that all need ask operation in highly reliable 7*24 hour, wherein network communication services has accounted for very big proportion again, and this has just proposed very high requirement to aspects such as the concurrent processing ability of these application systems, stability.Generally,, generally can adopt multithread mode, but this pattern consumption is too many in time or the resource created and destroy on the thread, so adopt the thread pool mode in order to satisfy the requirement of application program on performance.
Thread pool is a kind of multithreading processing form, adds task to formation in the processing procedure, wakes these tasks of thread execution then when demand is arranged up.The thread of thread pool all is a background thread. each thread all uses the storehouse size of configuration, with the priority operation of acquiescence, and is in the multiple thread units. be applicable to threading models such as boss/work, the producer/consumer.
If when all threads of thread pool all have task, thread pool will be created the new thread of some, but the number of thread surpasses maximal value never.
Summary of the invention
The technical problem to be solved in the present invention provides a kind of thread pool structure and implementation method that is applicable to the multithreading processing environment, the video monitoring platform system of stable operation can be provided.
The technical scheme that the present invention takes for the technical matters that exists in the solution known technology is:
The thread pool structure of video monitoring platform of the present invention system, comprise: management thread, the unique thread that can operate thread and thread formation in the thread pool is responsible for all tasks in the Processing tasks formation, destroy thread according to task creation, operate corresponding thread formation; The thread array of pointers is deposited all thread pointers, is convenient to can concentrate when thread pool is destroyed the destruction thread, and employing pointer data mode applies for that a thread promptly puts into a thread, by sequence number (being array index) thread is numbered; Task queue, the interface queue unique with upper layer application is responsible for depositing the task requests of upper layer application, the employing double-linked circular list is realized, use the way to manage of first in first out, a new task at first can be delivered to task queue, and management thread obtains task from task queue then; The idle thread formation, deposit the thread pointer of idle no task, the employing double-linked circular list is realized, use the way to manage of first in first out, management thread at first obtains idle thread according to task from the idle thread formation, and allowing its readjustment of executing the task, this thread is got back in the idle thread formation after executing; The formation of binding task thread, deposit the thread pointer of binding task, the employing double-linked circular list is realized, management thread at first obtains corresponding binding thread according to task from the formation of binding task thread, and allow it carry out task bound readjustment, this thread is got back in the formation of binding task thread after executing, and up to the upper layer application unbind, thread enters the idle thread formation behind the unbind; The message readjustment after thread pool is handled the upper layer application task requests, is notified upper layer application with the result by the message readjustment.
The thread pool implementation method of video monitoring platform system may further comprise the steps:
1) upper layer application is delivered task by the thread pool task interface and is added task queue to;
2) management thread obtains task from task queue;
3) classification is handled according to task type, and binding thread task is with task and thread binding, and add this thread the formation of to binding task thread, apply for that perhaps idle thread executes the task, the thread of will executing the task is carried out the corresponding task readjustment respectively to busy thread formation;
4) return thread pool respectively after above-mentioned two corresponding thread execution tasks;
5) the Processing tasks result is notified to upper layer application by the message readjustment.
All threads that comprise management thread are the hang-up sleep state during free time, just it is waken up when needing.
Advantage and good effect that the present invention has are:
The thread pool structure and the implementation method of video monitoring platform of the present invention system can be avoided frequent instability and the expense that thread brings of creating and destroy; The mistake of upper layer application can not cause that thread pool is unusual; The present invention has made up a general thread pool architecture, can allow the exploitation personnel develop on this individual system quickly and easily and be applicable to the application service that large-scale concurrent is stable; The structure of thread pool has high abstract, and the developer need not be concerned about the concrete processing or the management logic of thread more like this, only needs to be concerned about concrete client requests task processing, thereby has simplified work, has improved work efficiency; The thread pool structure and the implementation method of video monitoring platform of the present invention system are applicable to multiple threading model, for example Boss/Work, the producer/consumer etc.
Description of drawings
Fig. 1 is the synoptic diagram of the thread pool of video monitoring platform of the present invention system.
Embodiment
It is following that the present invention will be described in detail with reference to drawings and Examples.
Fig. 1 is the synoptic diagram of the thread pool of video monitoring platform of the present invention system.
As shown in Figure 1, the thread pool structure of video monitoring platform of the present invention system comprises: management thread, the unique thread that can operate thread and thread formation in the thread pool, be responsible for all tasks in the Processing tasks formation, destroy thread, operate corresponding thread formation according to task creation; The thread array of pointers is deposited all thread pointers, is convenient to can concentrate when thread pool is destroyed the destruction thread, and employing pointer data mode applies for that a thread promptly puts into a thread, by sequence number (being array index) thread is numbered; Task queue, the interface queue unique with upper layer application is responsible for depositing the task requests of upper layer application, the employing double-linked circular list is realized, use the way to manage of first in first out, a new task at first can be delivered to task queue, and management thread obtains task from task queue then; The idle thread formation, deposit the thread pointer of idle no task, the employing double-linked circular list is realized, use the way to manage of first in first out, management thread at first obtains idle thread according to task from the idle thread formation, and allowing its readjustment of executing the task, this thread is got back in the idle thread formation after executing; The formation of binding task thread, deposit the thread pointer of binding task, the employing double-linked circular list is realized, management thread at first obtains corresponding binding thread according to task from the formation of binding task thread, and allow it carry out task bound readjustment, this thread is got back in the formation of binding task thread after executing, and up to the upper layer application unbind, thread enters the idle thread formation behind the unbind; The message readjustment after thread pool is handled the upper layer application task requests, is notified upper layer application with the result by the message readjustment.
The thread pool implementation method of video monitoring platform system may further comprise the steps:
1) upper layer application is delivered task by the thread pool task interface and is added task queue to;
2) management thread obtains task from task queue;
3) classification is handled according to task type, and binding thread task is with task and thread binding, and add this thread the formation of to binding task thread, apply for that perhaps idle thread executes the task, the thread of will executing the task is carried out the corresponding task readjustment respectively to busy thread formation;
4) return thread pool respectively after above-mentioned two corresponding thread execution tasks;
5) the Processing tasks result is notified to upper layer application by the message readjustment.
All threads that comprise management thread are the hang-up sleep state during free time, just it is waken up when needing.
The above, it only is preferred embodiment of the present invention, be not that the present invention is done any pro forma restriction, though the present invention with preferred embodiment openly as above, yet, be not in order to limit the present invention, any those skilled in the art, in not breaking away from the technical solution of the present invention scope, certainly can utilize the technology contents of announcement to make a little change or modification, become the equivalent embodiment of equivalent variations, be the content that does not break away from technical solution of the present invention in every case, according to technical spirit of the present invention to any simple modification that above embodiment did, equivalent variations and modification all belong in the scope of technical solution of the present invention.

Claims (3)

1. the thread pool structure of a video monitoring platform system is characterized in that, comprising: management thread, the unique thread that can operate thread and thread formation in the thread pool, be responsible for all tasks in the Processing tasks formation, destroy thread, operate corresponding thread formation according to task creation; The thread array of pointers is deposited all thread pointers, is convenient to can concentrate when thread pool is destroyed the destruction thread, and employing pointer data mode applies for that a thread promptly puts into a thread, by sequence number (being array index) thread is numbered; Task queue, the interface queue unique with upper layer application is responsible for depositing the task requests of upper layer application, the employing double-linked circular list is realized, use the way to manage of first in first out, a new task at first can be delivered to task queue, and management thread obtains task from task queue then; The idle thread formation, deposit the thread pointer of idle no task, the employing double-linked circular list is realized, use the way to manage of first in first out, management thread at first obtains idle thread according to task from the idle thread formation, and allowing its readjustment of executing the task, this thread is got back in the idle thread formation after executing; The formation of binding task thread, deposit the thread pointer of binding task, the employing double-linked circular list is realized, management thread at first obtains corresponding binding thread according to task from the formation of binding task thread, and allow it carry out task bound readjustment, this thread is got back in the formation of binding task thread after executing, and up to the upper layer application unbind, thread enters the idle thread formation behind the unbind; The message readjustment after thread pool is handled the upper layer application task requests, is notified upper layer application with the result by the message readjustment.
2. thread pool implementation method based on the video monitoring platform system of the described thread pool structure of claim 1 may further comprise the steps:
1) upper layer application is delivered task by the thread pool task interface and is added task queue to;
2) management thread obtains task from task queue;
3) classification is handled according to task type, and binding thread task is with task and thread binding, and add this thread the formation of to binding task thread, apply for that perhaps idle thread executes the task, the thread of will executing the task is carried out the corresponding task readjustment respectively to busy thread formation;
4) return thread pool respectively after above-mentioned two corresponding thread execution tasks;
5) the Processing tasks result is notified to upper layer application by the message readjustment.
3. the thread pool implementation method of video monitoring platform according to claim 2 system is characterized in that: comprising that all threads of management thread are when idle hangs up sleep state, just it is waken up when needing.
CN 201110234302 2011-08-16 2011-08-16 Thread pool structure of video monitoring platform system and realizing method Pending CN102262564A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201110234302 CN102262564A (en) 2011-08-16 2011-08-16 Thread pool structure of video monitoring platform system and realizing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201110234302 CN102262564A (en) 2011-08-16 2011-08-16 Thread pool structure of video monitoring platform system and realizing method

Publications (1)

Publication Number Publication Date
CN102262564A true CN102262564A (en) 2011-11-30

Family

ID=45009201

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201110234302 Pending CN102262564A (en) 2011-08-16 2011-08-16 Thread pool structure of video monitoring platform system and realizing method

Country Status (1)

Country Link
CN (1) CN102262564A (en)

Cited By (23)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103164267A (en) * 2013-03-29 2013-06-19 汉柏科技有限公司 Lock-free message queue implementation method
CN103218264A (en) * 2013-03-26 2013-07-24 广东威创视讯科技股份有限公司 Multi-thread finite state machine switching method and multi-thread finite state machine switching device based on thread pool
CN103473129A (en) * 2013-09-18 2013-12-25 柳州市博源环科科技有限公司 Multi-task queue scheduling system with scalable number of threads and implementation method thereof
WO2014082562A1 (en) * 2012-11-29 2014-06-05 Tencent Technology (Shenzhen) Company Limited Method, device, and system for information processing based on distributed buses
CN106095546A (en) * 2016-06-01 2016-11-09 深圳市永兴元科技有限公司 The task management method of cloud computing platform and device
CN106371907A (en) * 2016-08-30 2017-02-01 乐视控股(北京)有限公司 Method and device for executing task
CN106383749A (en) * 2016-09-14 2017-02-08 郑州云海信息技术有限公司 Thread management method and apparatus
CN106502773A (en) * 2016-10-09 2017-03-15 武汉斗鱼网络科技有限公司 There is data asynchronous processing method and the module of synchronous callback information function
CN106547612A (en) * 2016-10-18 2017-03-29 深圳怡化电脑股份有限公司 A kind of multi-task processing method and device
CN106559447A (en) * 2015-09-25 2017-04-05 中兴通讯股份有限公司 The method for processing business and system of JSLEE containers
CN106648646A (en) * 2016-12-13 2017-05-10 深圳市元征软件开发有限公司 Method and device for managing threads
CN106874083A (en) * 2017-01-03 2017-06-20 杭州医学院 A kind of data actuation man-machine interface method for scheduling task
CN107491350A (en) * 2017-09-05 2017-12-19 武汉斗鱼网络科技有限公司 Interface task call method and device
CN107832146A (en) * 2017-10-27 2018-03-23 北京计算机技术及应用研究所 Thread pool task processing method in highly available cluster system
CN107945430A (en) * 2017-11-24 2018-04-20 上海动联信息技术股份有限公司 A kind of two-way concurrent means of communication based on serial ports for being used for intelligent POS machine
CN108616606A (en) * 2018-08-01 2018-10-02 湖南恒茂高科股份有限公司 A kind of Internet of Things communication means and device
CN108810557A (en) * 2017-07-10 2018-11-13 北京视联动力国际信息技术有限公司 A kind of method for processing video frequency, device, electronic equipment and storage medium
CN109388485A (en) * 2018-09-26 2019-02-26 广州虎牙信息科技有限公司 A kind of processing method, device, equipment and the storage medium of task execution thread
CN112035255A (en) * 2020-08-28 2020-12-04 北京浪潮数据技术有限公司 Thread pool resource management task processing method, device, equipment and storage medium
CN112148493A (en) * 2020-09-30 2020-12-29 武汉中科通达高新技术股份有限公司 Streaming media task management method and device and data server
CN113391896A (en) * 2021-06-15 2021-09-14 北京京东振世信息技术有限公司 Task processing method and device, storage medium and electronic equipment
CN113722078A (en) * 2021-11-02 2021-11-30 西安热工研究院有限公司 High-concurrency database access method, system and equipment based on thread pool
CN116578404A (en) * 2023-07-07 2023-08-11 北京趋动智能科技有限公司 Thread management method, thread management device, storage medium and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1588316A (en) * 2004-06-29 2005-03-02 北京大学 Property optimizing method for applying server
CN101599027A (en) * 2009-06-30 2009-12-09 中兴通讯股份有限公司 A kind of thread pool management method and system thereof
CN101739293A (en) * 2009-12-24 2010-06-16 航天恒星科技有限公司 Method for scheduling satellite data product production tasks in parallel based on multithread
CN101738997A (en) * 2009-10-30 2010-06-16 深圳市科陆电子科技股份有限公司 Multithread electric negative control system and control method
WO2011012157A1 (en) * 2009-07-28 2011-02-03 Telefonaktiebolaget L M Ericsson (Publ) Apparatus and method for processing events in a telecommunications network

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1588316A (en) * 2004-06-29 2005-03-02 北京大学 Property optimizing method for applying server
CN101599027A (en) * 2009-06-30 2009-12-09 中兴通讯股份有限公司 A kind of thread pool management method and system thereof
WO2011012157A1 (en) * 2009-07-28 2011-02-03 Telefonaktiebolaget L M Ericsson (Publ) Apparatus and method for processing events in a telecommunications network
CN101738997A (en) * 2009-10-30 2010-06-16 深圳市科陆电子科技股份有限公司 Multithread electric negative control system and control method
CN101739293A (en) * 2009-12-24 2010-06-16 航天恒星科技有限公司 Method for scheduling satellite data product production tasks in parallel based on multithread

Cited By (30)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014082562A1 (en) * 2012-11-29 2014-06-05 Tencent Technology (Shenzhen) Company Limited Method, device, and system for information processing based on distributed buses
CN103218264A (en) * 2013-03-26 2013-07-24 广东威创视讯科技股份有限公司 Multi-thread finite state machine switching method and multi-thread finite state machine switching device based on thread pool
CN103164267A (en) * 2013-03-29 2013-06-19 汉柏科技有限公司 Lock-free message queue implementation method
CN103473129A (en) * 2013-09-18 2013-12-25 柳州市博源环科科技有限公司 Multi-task queue scheduling system with scalable number of threads and implementation method thereof
CN103473129B (en) * 2013-09-18 2017-01-18 深圳前海大数金融服务有限公司 Multi-task queue scheduling system with scalable number of threads and implementation method thereof
CN106559447A (en) * 2015-09-25 2017-04-05 中兴通讯股份有限公司 The method for processing business and system of JSLEE containers
CN106095546A (en) * 2016-06-01 2016-11-09 深圳市永兴元科技有限公司 The task management method of cloud computing platform and device
CN106371907A (en) * 2016-08-30 2017-02-01 乐视控股(北京)有限公司 Method and device for executing task
CN106383749A (en) * 2016-09-14 2017-02-08 郑州云海信息技术有限公司 Thread management method and apparatus
CN106502773A (en) * 2016-10-09 2017-03-15 武汉斗鱼网络科技有限公司 There is data asynchronous processing method and the module of synchronous callback information function
CN106547612B (en) * 2016-10-18 2020-10-20 深圳怡化电脑股份有限公司 Multitasking method and device
CN106547612A (en) * 2016-10-18 2017-03-29 深圳怡化电脑股份有限公司 A kind of multi-task processing method and device
CN106648646A (en) * 2016-12-13 2017-05-10 深圳市元征软件开发有限公司 Method and device for managing threads
CN106874083A (en) * 2017-01-03 2017-06-20 杭州医学院 A kind of data actuation man-machine interface method for scheduling task
CN106874083B (en) * 2017-01-03 2019-06-28 杭州医学院 A kind of data actuation man-machine interface method for scheduling task
CN108810557A (en) * 2017-07-10 2018-11-13 北京视联动力国际信息技术有限公司 A kind of method for processing video frequency, device, electronic equipment and storage medium
CN107491350A (en) * 2017-09-05 2017-12-19 武汉斗鱼网络科技有限公司 Interface task call method and device
CN107491350B (en) * 2017-09-05 2018-08-10 武汉斗鱼网络科技有限公司 Interface task call method and device
CN107832146A (en) * 2017-10-27 2018-03-23 北京计算机技术及应用研究所 Thread pool task processing method in highly available cluster system
CN107945430A (en) * 2017-11-24 2018-04-20 上海动联信息技术股份有限公司 A kind of two-way concurrent means of communication based on serial ports for being used for intelligent POS machine
CN108616606B (en) * 2018-08-01 2021-10-26 湖南恒茂高科股份有限公司 Internet of things communication method and device
CN108616606A (en) * 2018-08-01 2018-10-02 湖南恒茂高科股份有限公司 A kind of Internet of Things communication means and device
CN109388485A (en) * 2018-09-26 2019-02-26 广州虎牙信息科技有限公司 A kind of processing method, device, equipment and the storage medium of task execution thread
CN112035255A (en) * 2020-08-28 2020-12-04 北京浪潮数据技术有限公司 Thread pool resource management task processing method, device, equipment and storage medium
CN112148493A (en) * 2020-09-30 2020-12-29 武汉中科通达高新技术股份有限公司 Streaming media task management method and device and data server
CN113391896A (en) * 2021-06-15 2021-09-14 北京京东振世信息技术有限公司 Task processing method and device, storage medium and electronic equipment
CN113391896B (en) * 2021-06-15 2023-09-22 北京京东振世信息技术有限公司 Task processing method and device, storage medium and electronic equipment
CN113722078A (en) * 2021-11-02 2021-11-30 西安热工研究院有限公司 High-concurrency database access method, system and equipment based on thread pool
CN116578404A (en) * 2023-07-07 2023-08-11 北京趋动智能科技有限公司 Thread management method, thread management device, storage medium and electronic equipment
CN116578404B (en) * 2023-07-07 2024-01-19 北京趋动智能科技有限公司 Thread management method, thread management device, storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
CN102262564A (en) Thread pool structure of video monitoring platform system and realizing method
US20200329091A1 (en) Methods and systems that use feedback to distribute and manage alerts
US8381212B2 (en) Dynamic allocation and partitioning of compute nodes in hierarchical job scheduling
US9396031B2 (en) Distributed UIMA cluster computing (DUCC) facility
CN102890643B (en) Resource scheduling system based on immediate feedback of application effect under display card virtualization
US9336288B2 (en) Workflow controller compatibility
US8140668B2 (en) Pre-scheduling the timelines of virtual machines
CN107025139A (en) A kind of high-performance calculation Scheduling Framework based on cloud computing
CN101694633A (en) Equipment, method and system for dispatching of computer operation
CN104572290A (en) Method and device for controlling message processing threads
CN1550986A (en) Managing input/output interruptions in non-dedicated interruption hardware environments
CN101464810A (en) Service program processing method and server
US11182217B2 (en) Multilayered resource scheduling
CN102902589A (en) Method for managing and scheduling cluster MIS (Many Integrated Core) job
CN102833310A (en) Workflow engine trunking system based on virtualization technology
US20200186594A1 (en) Rule-based action triggering in a provider network
Megino et al. Managing the atlas grid through harvester
CN113424152A (en) Workflow-based scheduling and batching in a multi-tenant distributed system
Bardhan et al. The Anatomy of MapReduce Jobs, Scheduling, and Performance Challenges.
CN104468710A (en) Mixed big data processing system and method
CN102147887A (en) Enterprise electronic commerce information flow management system
CN103514036A (en) Scheduling system and method for event trigger and batch processing
CN108073426A (en) A kind of method of managing software based on cloud computing, apparatus and system
CN103019844B (en) A kind ofly support multithreading to call the method and apparatus of MPI function
CN102681885A (en) Media asset management system capable of separating operations

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C02 Deemed withdrawal of patent application after publication (patent law 2001)
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20111130