CN109753354A - Processing method, device and the computer equipment of Streaming Media task based on multithreading - Google Patents

Processing method, device and the computer equipment of Streaming Media task based on multithreading Download PDF

Info

Publication number
CN109753354A
CN109753354A CN201811419023.0A CN201811419023A CN109753354A CN 109753354 A CN109753354 A CN 109753354A CN 201811419023 A CN201811419023 A CN 201811419023A CN 109753354 A CN109753354 A CN 109753354A
Authority
CN
China
Prior art keywords
task
thread
goal
goal task
multithreading
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
CN201811419023.0A
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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201811419023.0A priority Critical patent/CN109753354A/en
Publication of CN109753354A publication Critical patent/CN109753354A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Transfer Between Computers (AREA)

Abstract

The present invention proposes a kind of processing method and processing device of Streaming Media task based on multithreading, which comprises the task execution of receiving stream media task is requested, and includes pending goal task in the task execution request;The mission bit stream in the goal task is extracted, is that corresponding environmental variance is arranged in each thread in the thread pool according to the mission bit stream using the thread creation thread pool being pre-created;According to preset dynamic equilibrium scheduling strategy by the goal task be assigned in the thread pool with the matched thread of the goal task, and the goal task is executed under the environmental variance of its own by the thread.The present invention uses the task processing mode of multithreading, the reasonable assignment of goal task is realized using dynamic equilibrium scheduling strategy, environmental variance uses local variable, provides possibility for the encapsulation use in the library Dll, it improves while the performance and stability of multi-data processing, customer experience is more excellent.

Description

Processing method, device and the computer equipment of Streaming Media task based on multithreading
Technical field
The present invention relates to computer application technology more particularly to a kind of processing of the Streaming Media task based on multithreading Method, apparatus and computer equipment.
Background technique
Currently, when encapsulating the library dll, the global variable of definition is too many in the treatment process of stream medium data.It is more establishing In the case that a connection receives code stream, when code stream exits all the way, then exits other code stream all the way again, due to Live555 The global variable of the inside is destroyed, and causes to go wrong in library.On the other hand, Scheduling Framework is using global single thread event Query scheduling is directly handled data in repeating query thread, when processing multi-channel video flow data or processing data time It is easy to bring more serious performance issue when too long, occurs phenomena such as Caton, flower screen when such as handling multi-path video stream.In addition, by In the single thread of programming, the reduction of execution efficiency will lead on multicore machine.
Therefore, it in existing technical solution, is at least had the following deficiencies: when executing the processing of Streaming Media task
1, existing server is single thread design, is affected while the performance and stability of multi-data processing;
2, the environmental variance of per thread and task are global, and without independent environmental variance, one of environment becomes Amount is destroyed, and is easy to influence the task execution of other threads;
3, task schedule uses simple poll, causes task to be assigned unbalanced.
Summary of the invention
The present invention provide a kind of Streaming Media task based on multithreading processing method and corresponding device, can reach dynamic Change, differentiation assignment loan examination & approval task, and supports the processing plan of the Streaming Media task based on multithreading described in quick adjust Slightly the case of different risk class to be distributed to different assignment objects, solves in the prior art, can not accomplish difference Change configuration, the poor problem of scalability.
It the computer equipment of the processing method for the Streaming Media task based on multithreading that the present invention also provides a kind of and readable deposits Storage media.
To solve the above problems, the present invention uses the technical solution of following various aspects:
In a first aspect, present aspect provides a kind of processing method of Streaming Media task based on multithreading, which comprises
The task execution of receiving stream media task is requested, and includes pending goal task in the task execution request;
The mission bit stream in the goal task is extracted, utilizes the thread creation line being pre-created according to the mission bit stream Cheng Chi is that corresponding environmental variance is arranged in each thread in the thread pool;
According to preset dynamic equilibrium scheduling strategy by the goal task be assigned in the thread pool with it is described The matched thread of goal task, and the goal task is executed under the environmental variance of its own by the thread.
Specifically, described utilize the thread creation thread pool being pre-created according to the mission bit stream, it is the thread pool In each thread corresponding environmental variance is set, comprising:
It determines maximum thread amount according to CPU core calculation and creates the thread of corresponding number;
The thread pool is created using ThreadPoolExecutor class according to the mission bit stream, wherein The parameter of the constructed fuction of ThreadPoolExecutor class includes at least: the quantity of kernel thread, the maximum thread amount And save the task queue of pending task.
Specifically, described be assigned to the thread for the goal task according to preset dynamic equilibrium scheduling strategy The matched thread of goal task described in Chi Zhongyu, comprising:
The mapping for counting the task that current each thread and each thread are carrying out according to preset task statistical function is closed System, and record the task quantity that each thread is currently executing;
Statistical result according to the task statistical function distributes the goal task to currently performed task quantity Least thread.
Preferably, further includes:
The thread being currently running is interrupted, the status information of the task execution node of interruption and preservation are captured;
New thread is created on new task execution node;
Restore the operation of the new thread using the status information of preservation.
Specifically, further include saturated process strategy in the thread pool, it is described to be dispatched according to preset dynamic equilibrium The goal task is assigned in the thread pool and the matched thread of the goal task by strategy, further includes:
When the quantity of the received goal task is more than the maximum thread amount range and the task queue capacity When, the goal task exceeded is handled using the saturation strategy.
Specifically, the goal task exceeded using the saturation strategy processing, comprising:
When the quantity of the received goal task is more than the maximum thread amount range and the task queue capacity When do not execute new task, direct throw exception prompts the thread pool to expire;
Alternatively, do not execute new task, also not throw exception;
Alternatively, being that the new task currently come in executes by first task replacement in message queue.
Preferably, described that the goal task is assigned to the thread according to preset dynamic equilibrium scheduling strategy The matched thread of goal task described in Chi Zhongyu, further includes:
When the quantity of the received goal task is less than the maximum thread amount range and task queue appearance It is that distributed lock is arranged in the stream medium data in the goal task when amount.
Second aspect, the present invention provide a kind of processing unit of Streaming Media task based on multithreading, comprising:
Receiving module, the task execution for receiving stream media task are requested, comprising wait hold in the task execution request Capable goal task;
Extraction module utilizes wound in advance according to the mission bit stream for extracting the mission bit stream in the goal task The thread creation thread pool built is that corresponding environmental variance is arranged in each thread in the thread pool;
Dispatch module, for the goal task to be assigned to the line according to preset dynamic equilibrium scheduling strategy Cheng Chizhong and the matched thread of the goal task, and execute the target under the environmental variance of its own by the thread and appoint Business.
The third aspect, the present invention provide a kind of computer readable storage medium, which is characterized in that described computer-readable to deposit It is stored with computer program on storage media, base described in any one of first aspect is realized when which is executed by processor In the processing method of the Streaming Media task of multithreading the step of.
Fourth aspect, the present invention provide a kind of computer equipment, which is characterized in that described including memory and processor Computer-readable instruction is stored in memory, when the computer-readable instruction is executed by the processor, so that the place The step of managing the processing method of Streaming Media task of the device execution as described in any one of first aspect claim based on multithreading.
Compared with the existing technology, technical solution of the present invention at least has following advantage:
1, the present invention provides a kind of processing method of Streaming Media task based on multithreading, passes through receiving stream media task Task execution is requested, and includes pending goal task in the task execution request;Extract the task in the goal task Information is each thread setting in the thread pool according to the mission bit stream using the thread creation thread pool being pre-created Corresponding environmental variance;The goal task is assigned in the thread pool according to preset dynamic equilibrium scheduling strategy With the matched thread of the goal task, and the goal task is executed under the environmental variance of its own by the thread.This Invention realizes the mission thread mode for becoming multithreading by single line, and the environmental variance of each thread is no longer global variable, is Dll The encapsulation use in library provides possibility, improves while the performance and stability of multi-data processing, customer experience are more excellent.
2, thread pool and environment group are articulated on server category by the present invention, are increased dynamic equilibrium for server and are dispatched plan Slightly, it is locked for server critical data.The present invention is that each environmental variance increases a thread tag, so that each thread is at it Task is executed under the environmental variance of itself, and increases for task dispatcher and appoints statistical function, for counting holding for each thread The quantity of row task is assigned to suitable thread convenient for the subsequent goal task that will be received.
3, the present invention captures the status information of task execution node of interruption simultaneously by interrupting the thread being currently running It saves;New thread is created on new task execution node;Restore the fortune of the new thread using the status information of preservation Row realizes thread migration.
Detailed description of the invention
Fig. 1 is that the present invention is based on a kind of embodiment flow diagrams of the processing method of the Streaming Media task of multithreading;
The present invention is based on a kind of embodiment flow diagrams of the processing unit of the Streaming Media task of multithreading by Fig. 2;
Fig. 3 is the internal structure block diagram of computer equipment in one embodiment.
The object of the invention is realized, the embodiments will be further described with reference to the accompanying drawings for functional characteristics and advantage.
Specific embodiment
In order to enable those skilled in the art to better understand the solution of the present invention, below in conjunction in the embodiment of the present invention Attached drawing, technical scheme in the embodiment of the invention is clearly and completely described.
In some processes of the description in description and claims of this specification and above-mentioned attached drawing, contain according to Multiple operations that particular order occurs, but it should be clearly understood that these operations can not be what appears in this article suitable according to its Sequence is executed or is executed parallel, and the serial number of operation such as S11, S12 etc. be only used for distinguishing each different operation, serial number It itself does not represent and any executes sequence.In addition, these processes may include more or fewer operations, and these operations can To execute or execute parallel in order.It should be noted that the description such as " first " herein, " second ", is for distinguishing not Same message, equipment, module etc., does not represent sequencing, does not also limit " first " and " second " and be different type.
It will appreciated by the skilled person that unless expressly stated, singular " one " used herein, " one It is a ", " described " and "the" may also comprise plural form.It is to be further understood that being arranged used in specification of the invention Diction " comprising " refer to that there are the feature, integer, step, operation, element and/or component, but it is not excluded that in the presence of or addition Other one or more features, integer, step, operation, element, component and/or their group.It should be understood that when we claim member Part is " connected " or when " coupled " to another element, it can be directly connected or coupled to other elements, or there may also be Intermediary element.In addition, " connection " used herein or " coupling " may include being wirelessly connected or wirelessly coupling.It is used herein to arrange Diction "and/or" includes one or more associated wholes for listing item or any cell and all combinations.
It will appreciated by the skilled person that unless otherwise defined, all terms used herein (including technology art Language and scientific term), there is meaning identical with the general understanding of those of ordinary skill in fields of the present invention.Should also Understand, those terms such as defined in the general dictionary, it should be understood that have in the context of the prior art The consistent meaning of meaning, and unless idealization or meaning too formal otherwise will not be used by specific definitions as here To explain.
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description in which the same or similar labels are throughly indicated same or similar element or has same or like function Element.Obviously, described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.Based on this Embodiment in invention, those skilled in the art's every other implementation obtained without creative efforts Example, shall fall within the protection scope of the present invention.
Referring to Fig. 1, the embodiment of the present invention provides a kind of processing method of Streaming Media task based on multithreading, this method The function of being realized need include user, mobile terminal and server participation, using server holding as the embodiment of the present invention Row main body executes, realizes the function of the method, as shown in Figure 1, the described method comprises the following steps:
The task execution request of S11, receiving stream media task are appointed comprising pending target in task execution request Business.
When the server starts, first judges system hardware cpu nuclear volume and determine maximum thread according to cpu nuclear volume Amount.The maximum thread amount be regulation thread pool at most can only how many thread executing.Ordinary circumstance program line number of passes Two equal to cpu Thread Count can utilize cpu to three times well, and excessive program line number of passes will not only improve performance, Instead can also be impacted because of the frequent switching of cross-thread, specific to need to examine summarys according to the business of thread process, constantly adjustment Thread Count number determines the optimal Thread Count of current system.
In the embodiment of the present invention, the video flowing task execution request includes but is not limited to establish connection request, receive code Stream request and data processing request establish connection, receive code stream and data processing correspondingly, the goal task includes at least.
In the embodiment of the present invention, after server receives the video flowing task execution request, obtains the video flowing and appoint Business executes the goal task in request, includes task quantity, the executive mode of task and execution time in the goal task Mission bit stream.
Mission bit stream in S12, the extraction goal task is created according to the mission bit stream using the thread being pre-created Thread pool is built, is that corresponding environmental variance is arranged in each thread in the thread pool.
In a kind of possible design, preferably once scheme according to the mission bit stream creates thread pool to the present invention:
It determines maximum thread amount according to CPU core calculation and creates the thread of corresponding number;
The thread pool is created using ThreadPoolExecutor class according to the mission bit stream, wherein The parameter of the constructed fuction of ThreadPoolExecutor class includes at least: the quantity of kernel thread, the maximum thread amount And save the task queue of pending task.Wherein, the quantity of the kernel thread is that regulation thread pool has several threads to exist Operation.The maximum thread amount is full in the message queue, can just come into force when cannot adding task.The present invention is implemented In example, the thread of creation corresponding number is determined according to the task quantity in the task message to execute the goal task.
In the embodiment of the present invention, multiple threads and task queue are specifically created when creating the thread pool, described Business queue provides a kind of buffering for storing not handling for task.
In the embodiment of the present invention, concrete scheme is as follows when the thread pool executes the goal task:
(1) judge whether currently running number of threads is more than the kernel thread quantity, if being no more than the core Number of threads then creates a thread and directly executes the goal task;
(2) if the number of threads being currently running is than or equal to the kernel thread quantity, then by the target Task is added in task queue;
(3) if task queue is full, check whether currently running number of threads is less than the maximum thread, such as Fruit is less than then one thread of creation and directly executes the task;
(4) if task queue is full, and currently running number of threads is more than or equal to the maximum thread, then benefit The goal task exceeded with the saturation strategy processing.
It is corresponding to create each independent environmental variance of thread when creating the thread in the embodiment of the present invention.It is described each A independent environmental variance of thread is local variable.When creating the environmental variance, the identification information of corresponding thread is obtained Label such as Thread Id as the environmental variance, and the label is added for the environmental variance, subsequent thread executes specified appoint Appointed task is executed under the corresponding environmental variance of the label according to the label when business.The present invention solve in the prior art, when Code stream exits all the way, then when exiting other code stream all the way, since the global variable inside Live555 is destroyed, causes to encapsulate At the library dll in go wrong.
In a kind of possible design, the present invention specifically creates 1 main thread+N number of sub-line when creating the multiple thread Journey.Wherein, the main thread, which is mainly responsible for, checks whether server needs to close, and records log status information and type information; The sub thread is mainly responsible for the execution for realizing the goal task, connects as equipment accesses, audio video transmission etc..
In the embodiment of the present invention, after server receives task, whether validation task quota transfinites, if task quota is super Limit, server cannot handle current task.If task quota does not transfinite, server can handle current task, then setting point Cloth lock.The present invention protects accessed resource by the way of distributed lock, prevents some resource by multiple thread accesses, when certain A resource is arranged distributed lock for accessed resource, is forbidden other thread accesses by after a thread accesses.
S13, according to preset dynamic equilibrium scheduling strategy by the goal task be assigned in the thread pool with The matched thread of goal task, and the goal task is executed under the environmental variance of its own by the thread.
In the embodiment of the present invention, creates the corresponding dynamic equilibrium scheduling strategy of the thread pool and inter-thread data is shared Management etc..The dynamic equilibrium scheduling strategy is the task quantity that is currently executing according to each thread to new received stream matchmaker The request of body task execution is distributed to suitable thread.Specifically, the dynamic equilibrium scheduling strategy is not simply poll, i.e., it is flat It is assigned in per thread and executes, but dynamic equilibrium is used to dispatch, i.e., carried out according to the number of tasks being carrying out on thread Scheduling, when executing task every time, then task quantity adds 1, and task quantity number subtracts 1 after having executed, and the smallest thread of task quantity connects Accept time Streaming Media task execution request.
The present invention has preset task statistical function.The task statistical function is for counting each thread currently The task quantity of execution, current each goal task are performed by which thread and current execution state.Wherein, work as thread When executing a task, the task quantity then adds 1, and when having executed a task, the task quantity then subtracts 1, number of tasks It measures the smallest thread and receives next Streaming Media task execution request
The task that the present invention is carrying out according to the current each thread of preset task statistical function statistics and each thread Mapping relations, and record the task quantity that each thread is currently executing;Statistical result according to the task statistical function The goal task is distributed to currently performed task minimum number using the preset dynamic equilibrium scheduling strategy Thread.
In a kind of embodiment, the present invention can also interrupt the thread being currently running, and capture the task execution of interruption The status information of node and preservation;New thread is created on new task execution node;It is extensive using the status information of preservation The operation of the multiple new thread, realizes thread migration.
In a kind of embodiment, when the quantity of the received goal task is more than the maximum thread amount range and institute When stating task queue capacity, the goal task exceeded is handled using the saturation strategy.Specifically, when the received target is appointed The quantity of business does not execute new task when being more than the maximum thread amount range and the task queue capacity, directly dishes out different Often, the thread pool is prompted to expire;Alternatively, do not execute new task, also not throw exception;Alternatively, by first in message queue A task replacement is that the new task currently come in executes;Alternatively, calling directly execute to execute the new task currently come in.
In a kind of embodiment, when the quantity of the received goal task be less than the maximum thread amount range and It is that distributed lock is arranged in the stream medium data in the goal task when task queue capacity.
In the embodiment of the present invention, due to using the operational mode of multithreading, in the connection request for receiving client, Client is connected into corresponding distribution to different thread process.Specifically, the client session that the present invention is all by transformation, and Client JA(junction ambient) base class acquisition modes, so that each client is no longer environment parameter of overall importance, but according to different Thread possesses respective environmental variance, improves treatment effeciency.
Referring to FIG. 3, the embodiment of the present invention also provides a kind of processing unit of Streaming Media task based on multithreading, one In kind the present embodiment, including receiving module 11, extraction module 12 and dispatch module 13.Wherein,
Receiving module 11, the task execution for receiving stream media task are requested, in task execution request comprising to The goal task of execution.
When the server starts, first judges system hardware cpu nuclear volume and determine maximum thread according to cpu nuclear volume Amount.The maximum thread amount be regulation thread pool at most can only how many thread executing.Ordinary circumstance program line number of passes Two equal to cpu Thread Count can utilize cpu to three times well, and excessive program line number of passes will not only improve performance, Instead can also be impacted because of the frequent switching of cross-thread, specific to need to examine summarys according to the business of thread process, constantly adjustment Thread Count number determines the optimal Thread Count of current system.
In the embodiment of the present invention, the video flowing task execution request includes but is not limited to establish connection request, receive code Stream request and data processing request establish connection, receive code stream and data processing correspondingly, the goal task includes at least.
In the embodiment of the present invention, after server receives the video flowing task execution request, obtains the video flowing and appoint Business executes the goal task in request, includes task quantity, the executive mode of task and execution time in the goal task Mission bit stream.
Extraction module 12, for extracting the mission bit stream in the goal task, according to the mission bit stream using in advance The thread creation thread pool of creation is that corresponding environmental variance is arranged in each thread in the thread pool.
In a kind of possible design, preferably once scheme according to the mission bit stream creates thread pool to the present invention:
It determines maximum thread amount according to CPU core calculation and creates the thread of corresponding number;
The thread pool is created using ThreadPoolExecutor class according to the mission bit stream, wherein The parameter of the constructed fuction of ThreadPoolExecutor class includes at least: the quantity of kernel thread, the maximum thread amount And save the task queue of pending task.Wherein, the quantity of the kernel thread is that regulation thread pool has several threads to exist Operation.The maximum thread amount is full in the message queue, can just come into force when cannot adding task.The present invention is implemented In example, the thread of creation corresponding number is determined according to the task quantity in the task message to execute the goal task.
In the embodiment of the present invention, multiple threads and task queue are specifically created when creating the thread pool, described Business queue provides a kind of buffering for storing not handling for task.
In the embodiment of the present invention, concrete scheme is as follows when the thread pool executes the goal task:
(5) judge whether currently running number of threads is more than the kernel thread quantity, if being no more than the core Number of threads then creates a thread and directly executes the goal task;
(6) if the number of threads being currently running is than or equal to the kernel thread quantity, then by the target Task is added in task queue;
(7) if task queue is full, check whether currently running number of threads is less than the maximum thread, such as Fruit is less than then one thread of creation and directly executes the task;
(8) if task queue is full, and currently running number of threads is more than or equal to the maximum thread, then benefit The goal task exceeded with the saturation strategy processing.
It is corresponding to create each independent environmental variance of thread when creating the thread in the embodiment of the present invention.It is described each A independent environmental variance of thread is local variable.When creating the environmental variance, the identification information of corresponding thread is obtained Label such as Thread Id as the environmental variance, and the label is added for the environmental variance, subsequent thread executes specified appoint Appointed task is executed under the corresponding environmental variance of the label according to the label when business.The present invention solve in the prior art, when Code stream exits all the way, then when exiting other code stream all the way, since the global variable inside Live555 is destroyed, causes to encapsulate At the library dll in go wrong.
In a kind of possible design, the present invention specifically creates 1 main thread+N number of sub-line when creating the multiple thread Journey.Wherein, the main thread, which is mainly responsible for, checks whether server needs to close, and records log status information and type information; The sub thread is mainly responsible for the execution for realizing the goal task, connects as equipment accesses, audio video transmission etc..
In the embodiment of the present invention, after server receives task, whether validation task quota transfinites, if task quota is super Limit, server cannot handle current task.If task quota does not transfinite, server can handle current task, then setting point Cloth lock.The present invention protects accessed resource by the way of distributed lock, prevents some resource by multiple thread accesses, when certain A resource is arranged distributed lock for accessed resource, is forbidden other thread accesses by after a thread accesses.
Dispatch module 13, it is described for being assigned to the goal task according to preset dynamic equilibrium scheduling strategy With the matched thread of the goal task in thread pool, and the target is executed under the environmental variance of its own by the thread Task.
In the embodiment of the present invention, creates the corresponding dynamic equilibrium scheduling strategy of the thread pool and inter-thread data is shared Management etc..The dynamic equilibrium scheduling strategy is the task quantity that is currently executing according to each thread to new received stream matchmaker The request of body task execution is distributed to suitable thread.Specifically, the dynamic equilibrium scheduling strategy is not simply poll, i.e., it is flat It is assigned in per thread and executes, but dynamic equilibrium is used to dispatch, i.e., carried out according to the number of tasks being carrying out on thread Scheduling, when executing task every time, then task quantity adds 1, and task quantity number subtracts 1 after having executed, and the smallest thread of task quantity connects Accept time Streaming Media task execution request.
The present invention has preset task statistical function.The task statistical function is for counting each thread currently The task quantity of execution, current each goal task are performed by which thread and current execution state.Wherein, work as thread When executing a task, the task quantity then adds 1, and when having executed a task, the task quantity then subtracts 1, number of tasks It measures the smallest thread and receives next Streaming Media task execution request
The task that the present invention is carrying out according to the current each thread of preset task statistical function statistics and each thread Mapping relations, and record the task quantity that each thread is currently executing;Statistical result according to the task statistical function The goal task is distributed to currently performed task minimum number using the preset dynamic equilibrium scheduling strategy Thread.
In a kind of embodiment, the present invention can also interrupt the thread being currently running, and capture the task execution of interruption The status information of node and preservation;New thread is created on new task execution node;It is extensive using the status information of preservation The operation of the multiple new thread, realizes thread migration.
In a kind of embodiment, when the quantity of the received goal task is more than the maximum thread amount range and institute When stating task queue capacity, the goal task exceeded is handled using the saturation strategy.Specifically, when the received target is appointed The quantity of business does not execute new task when being more than the maximum thread amount range and the task queue capacity, directly dishes out different Often, the thread pool is prompted to expire;Alternatively, do not execute new task, also not throw exception;Alternatively, by first in message queue A task replacement is that the new task currently come in executes;Alternatively, calling directly execute to execute the new task currently come in.
In a kind of embodiment, when the quantity of the received goal task be less than the maximum thread amount range and It is that distributed lock is arranged in the stream medium data in the goal task when task queue capacity.
In the embodiment of the present invention, due to using the operational mode of multithreading, in the connection request for receiving client, Client is connected into corresponding distribution to different thread process.Specifically, the client session that the present invention is all by transformation, and Client JA(junction ambient) base class acquisition modes, so that each client is no longer environment parameter of overall importance, but according to different Thread possesses respective environmental variance, improves treatment effeciency.
In another embodiment, the embodiment of the present invention provides a kind of computer readable storage medium, and the computer can Read to be stored with computer program on storage medium, any one of realized when which is executed by processor described in technical solution based on The processing method of the Streaming Media task of multithreading.Wherein, the computer readable storage medium includes but is not limited to any type Disk (including floppy disk, hard disk, CD, CD-ROM and magneto-optic disk), ROM (Read-Only Memory, read-only memory), RAM (Random AcceSS Memory, immediately memory), EPROM (EraSable Programmable Read-Only Memory, Erarable Programmable Read only Memory), EEPROM (Electrically EraSable Programmable Read-Only Memory, Electrically Erasable Programmable Read-Only Memory), flash memory, magnetic card or light card.It is, storage Equipment includes that can be by equipment (for example, computer, mobile phone) with any medium for the form storage or transmission information that can be read Read-only memory, disk or CD etc..
A kind of computer readable storage medium provided in an embodiment of the present invention is, it can be achieved that the task of receiving stream media task is held Row is requested, and includes pending goal task in the task execution request;The mission bit stream in the goal task is extracted, according to It is that corresponding ring is arranged in each thread in the thread pool according to the mission bit stream using the thread creation thread pool being pre-created Border variable;The goal task is assigned in the thread pool and the mesh according to preset dynamic equilibrium scheduling strategy The matched thread of mark task, and the goal task is executed under the environmental variance of its own by the thread.The present invention realizes Become the mission thread mode of multithreading by single line, the environmental variance of each thread is no longer global variable, is the encapsulation in the library Dll Using possibility is provided, improves while the performance and stability of multi-data processing, customer experience are more excellent.
In addition, the present invention provides a kind of computer equipments, as shown in figure 3, the computer in another embodiment Equipment includes the devices such as processor 303, memory 305, input unit 307 and display unit 309.Those skilled in the art can To understand, the structure devices shown in Fig. 3 do not constitute the restriction to all computer equipments, may include more or more than illustrating Few component, or the certain components of combination.Memory 305 can be used for storing application program 301 and each functional module, processor 303 operations are stored in the application program 301 of memory 305, thereby executing the various function application and data processing of equipment.It deposits Reservoir 305 can be built-in storage or external memory, or including both built-in storage and external memory.Built-in storage can wrap Include read-only memory (ROM), programming ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), flash memory or random access memory.External memory may include hard disk, floppy disk, ZIP disk, USB flash disk, tape Deng.Memory disclosed in this invention includes but is not limited to the memory of these types.Memory 305 disclosed in this invention As an example rather than as restriction.
Input unit 307 is used to receive the input of signal, and receives the keyword of user's input.Input unit 307 can Including touch panel and other input equipments.Touch panel collects the touch operation of user on it or nearby and (for example uses Family uses the operations of any suitable object or attachment on touch panel or near touch panel such as finger, stylus), and root According to the corresponding attachment device of preset driven by program;Other input equipments can include but is not limited to physical keyboard, function One of key (such as broadcasting control button, switch key etc.), trace ball, mouse, operating stick etc. are a variety of.Display unit 309 can be used for showing the information of user's input or be supplied to the information of user and the various menus of computer equipment.Display is single The forms such as liquid crystal display, Organic Light Emitting Diode can be used in member 309.Processor 303 is the control centre of computer equipment, benefit With the various pieces of various interfaces and the entire computer of connection, by running or executing the software being stored in memory 303 Program and/or module, and the data being stored in memory are called, perform various functions and handle data.Shown in Fig. 3 One or more processors 303 are able to carry out, realize receiving module 11, extraction module 12 shown in Fig. 3 and dispatch module 13 function.
In one embodiment, the computer equipment includes memory 305 and processor 303, the memory 305 In be stored with computer-readable instruction, when the computer-readable instruction is executed by the processor, so that the processor 303 The step of executing a kind of processing method of the Streaming Media task based on multithreading described in above embodiments.
A kind of computer equipment provided in an embodiment of the present invention, it can be achieved that the task execution of receiving stream media task is requested, It include pending goal task in the task execution request;The mission bit stream in the goal task is extracted, according to described in Mission bit stream is that corresponding environment change is arranged in each thread in the thread pool using the thread creation thread pool being pre-created Amount;The goal task is assigned in the thread pool according to preset dynamic equilibrium scheduling strategy and is appointed with the target It is engaged in matched thread, and executes the goal task under the environmental variance of its own by the thread.The present invention is using multi-thread The task processing mode of journey realizes the reasonable assignment of goal task using dynamic equilibrium scheduling strategy, and environmental variance is using part Variable provides possibility for the encapsulation use in the library Dll, improves while the performance and stability of multi-data processing, Ke Huti It tests more excellent.
Computer readable storage medium provided in an embodiment of the present invention may be implemented the above-mentioned Streaming Media based on multithreading and appoint The embodiment of the processing method of business, concrete function realize the explanation referred in embodiment of the method, and details are not described herein.
Those of ordinary skill in the art will appreciate that realizing all or part of the process in above-described embodiment method, being can be with Relevant hardware is instructed to complete by computer program, which can be stored in a computer-readable storage and be situated between In matter, the program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein, storage medium above-mentioned can be The non-volatile memory mediums such as magnetic disk, CD, read-only memory (Read-Only Memory, ROM) or random storage note Recall body (Random Access Memory, RAM) etc..
Each technical characteristic of embodiment described above can be combined arbitrarily, for simplicity of description, not to above-mentioned reality It applies all possible combination of each technical characteristic in example to be all described, as long as however, the combination of these technical characteristics is not deposited In contradiction, all should be considered as described in this specification.
The embodiments described above only express several embodiments of the present invention, and the description thereof is more specific and detailed, but simultaneously Limitations on the scope of the patent of the present invention therefore cannot be interpreted as.It should be pointed out that for those of ordinary skill in the art For, without departing from the inventive concept of the premise, various modifications and improvements can be made, these belong to guarantor of the invention Protect range.Therefore, the scope of protection of the patent of the invention shall be subject to the appended claims.

Claims (10)

1. a kind of processing method of the Streaming Media task based on multithreading, which is characterized in that the described method includes:
The task execution of receiving stream media task is requested, and includes pending goal task in the task execution request;
The mission bit stream in the goal task is extracted, utilizes the thread creation thread being pre-created according to the mission bit stream Pond is that corresponding environmental variance is arranged in each thread in the thread pool;
The goal task is assigned in the thread pool and the target according to preset dynamic equilibrium scheduling strategy The matched thread of task, and the goal task is executed under the environmental variance of its own by the thread.
2. the processing method of the Streaming Media task according to claim 1 based on multithreading, which is characterized in that the foundation The mission bit stream is that corresponding environment is arranged in each thread in the thread pool using the thread creation thread pool being pre-created Variable, comprising:
It determines maximum thread amount according to CPU core calculation and creates the thread of corresponding number;
The thread pool is created using ThreadPoolExecutor class according to the mission bit stream, wherein The parameter of the constructed fuction of ThreadPoolExecutor class includes at least: the quantity of kernel thread, the maximum thread amount And save the task queue of pending task.
3. the processing method of the Streaming Media task according to claim 1 based on multithreading, which is characterized in that the foundation The goal task is assigned in the thread pool by preset dynamic equilibrium scheduling strategy to be matched with the goal task Thread, comprising:
The mapping relations for the task that current each thread and each thread are carrying out are counted according to preset task statistical function, and Record the task quantity that each thread is currently executing;
Statistical result according to the task statistical function distributes the goal task to currently performed task minimum number Thread.
4. the processing method of the Streaming Media task according to claim 1 based on multithreading, which is characterized in that further include:
The thread being currently running is interrupted, the status information of the task execution node of interruption and preservation are captured;
New thread is created on new task execution node;
Restore the operation of the new thread using the status information of preservation.
5. the processing method of the Streaming Media task according to claim 1 based on multithreading, which is characterized in that the thread It further include saturated process strategy in pond, it is described to be assigned to the goal task according to preset dynamic equilibrium scheduling strategy In the thread pool with the matched thread of the goal task, further includes:
When the quantity of the received goal task is more than the maximum thread amount range and the task queue capacity, benefit The goal task exceeded with the saturation strategy processing.
6. the processing method of the Streaming Media task according to claim 5 based on multithreading, which is characterized in that the utilization The goal task that the saturation strategy processing exceeds, comprising:
Not when the quantity of the received goal task is more than the maximum thread amount range and the task queue capacity New task is executed, direct throw exception prompts the thread pool to expire;
Alternatively, do not execute new task, also not throw exception;
Alternatively, being that the new task currently come in executes by first task replacement in message queue.
7. the processing method of the Streaming Media task according to claim 5 based on multithreading, which is characterized in that the foundation The goal task is assigned in the thread pool by preset dynamic equilibrium scheduling strategy to be matched with the goal task Thread, further includes:
When the quantity of the received goal task is less than the maximum thread amount range and the task queue capacity, For the stream medium data in the goal task, distributed lock is set.
8. a kind of processing unit of the Streaming Media task based on multithreading characterized by comprising
Receiving module, the task execution for receiving stream media task are requested, comprising pending in the task execution request Goal task;
Extraction module is pre-created for extracting the mission bit stream in the goal task according to mission bit stream utilization Thread creation thread pool is that corresponding environmental variance is arranged in each thread in the thread pool;
Dispatch module, for the goal task to be assigned to the thread pool according to preset dynamic equilibrium scheduling strategy In with the matched thread of the goal task, and the goal task is executed under the environmental variance of its own by the thread.
9. a kind of computer readable storage medium, which is characterized in that be stored with computer on the computer readable storage medium Program, the computer program realize the Streaming Media described in any one of claims 1 to 7 based on multithreading when being executed by processor The step of processing method of task.
10. a kind of computer equipment, which is characterized in that including memory and processor, be stored with computer in the memory Readable instruction, when the computer-readable instruction is executed by the processor so that the processor execute as claim 1 to The step of processing method of Streaming Media task described in any one of 7 claims based on multithreading.
CN201811419023.0A 2018-11-26 2018-11-26 Processing method, device and the computer equipment of Streaming Media task based on multithreading Pending CN109753354A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811419023.0A CN109753354A (en) 2018-11-26 2018-11-26 Processing method, device and the computer equipment of Streaming Media task based on multithreading

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811419023.0A CN109753354A (en) 2018-11-26 2018-11-26 Processing method, device and the computer equipment of Streaming Media task based on multithreading

Publications (1)

Publication Number Publication Date
CN109753354A true CN109753354A (en) 2019-05-14

Family

ID=66403306

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811419023.0A Pending CN109753354A (en) 2018-11-26 2018-11-26 Processing method, device and the computer equipment of Streaming Media task based on multithreading

Country Status (1)

Country Link
CN (1) CN109753354A (en)

Cited By (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110413390A (en) * 2019-07-24 2019-11-05 深圳市盟天科技有限公司 Thread task processing method, device, server and storage medium
CN110569470A (en) * 2019-09-09 2019-12-13 北京字节跳动网络技术有限公司 User matching method and device, readable medium and electronic equipment
CN110765082A (en) * 2019-09-06 2020-02-07 深圳平安通信科技有限公司 Hadoop file processing method and device, storage medium and server
CN110908784A (en) * 2019-11-12 2020-03-24 苏州智加科技有限公司 Image labeling method, device, equipment and storage medium
CN111078377A (en) * 2019-11-29 2020-04-28 广州易方信息科技股份有限公司 Thread working method
CN111124651A (en) * 2019-12-27 2020-05-08 中通服公众信息产业股份有限公司 Method for multithreading concurrent scheduling in distributed environment
CN111464331A (en) * 2020-03-03 2020-07-28 深圳市计通智能技术有限公司 Control method and system for thread creation and terminal equipment
CN111475305A (en) * 2020-05-06 2020-07-31 智博云信息科技(广州)有限公司 Big data processing method and system based on cloud platform multithreading
CN111625329A (en) * 2020-05-18 2020-09-04 北京达佳互联信息技术有限公司 Task allocation method and device, electronic equipment, server and storage medium
CN111737026A (en) * 2020-05-28 2020-10-02 苏州浪潮智能科技有限公司 Multithreading message processing method based on lookup operation
CN111782293A (en) * 2020-06-28 2020-10-16 珠海豹趣科技有限公司 Task processing method and device, electronic equipment and readable storage medium
CN112288198A (en) * 2019-07-22 2021-01-29 北京车和家信息技术有限公司 Task processing system and method
CN112328388A (en) * 2020-09-17 2021-02-05 北京中数科技术有限公司 Parallel computing method and system fusing multithreading and distributed technology
CN113032018A (en) * 2019-12-25 2021-06-25 上海博泰悦臻电子设备制造有限公司 Improved method for reading command and related device
CN113238843A (en) * 2021-05-13 2021-08-10 北京京东振世信息技术有限公司 Task execution method, device, equipment and storage medium
CN113254367A (en) * 2020-02-11 2021-08-13 合肥杰发科技有限公司 iAP1 protocol-based command processing method, electronic device and storage medium
CN113760632A (en) * 2020-08-10 2021-12-07 北京沃东天骏信息技术有限公司 Thread pool performance monitoring method, device, equipment and storage medium
CN113760540A (en) * 2021-07-29 2021-12-07 苏州浪潮智能科技有限公司 Task processing method and related device
CN113973093A (en) * 2020-07-24 2022-01-25 中移(苏州)软件技术有限公司 Data transmission method and device, electronic equipment and readable storage medium
CN114691375A (en) * 2022-06-02 2022-07-01 青岛展诚科技有限公司 Integrated circuit resistance extraction method based on parallel algorithm

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20050065087A (en) * 2003-12-24 2005-06-29 한국전자통신연구원 Apparatus for managing streamer process for media streaming and method thereof
US20100153957A1 (en) * 2008-12-16 2010-06-17 Sensormatic Electronics Corporation System and method for managing thread use in a thread pool
CN108270732A (en) * 2016-12-30 2018-07-10 北京视联动力国际信息技术有限公司 A kind of Streaming Media processing method and system
CN108647134A (en) * 2018-05-04 2018-10-12 北京物资学院 A kind of task monitoring, tracking and recognition methods towards multicore architecture
CN108762900A (en) * 2018-05-21 2018-11-06 平安科技(深圳)有限公司 High frequency method for scheduling task, system, computer equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20050065087A (en) * 2003-12-24 2005-06-29 한국전자통신연구원 Apparatus for managing streamer process for media streaming and method thereof
US20100153957A1 (en) * 2008-12-16 2010-06-17 Sensormatic Electronics Corporation System and method for managing thread use in a thread pool
CN108270732A (en) * 2016-12-30 2018-07-10 北京视联动力国际信息技术有限公司 A kind of Streaming Media processing method and system
CN108647134A (en) * 2018-05-04 2018-10-12 北京物资学院 A kind of task monitoring, tracking and recognition methods towards multicore architecture
CN108762900A (en) * 2018-05-21 2018-11-06 平安科技(深圳)有限公司 High frequency method for scheduling task, system, computer equipment and storage medium

Cited By (30)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112288198A (en) * 2019-07-22 2021-01-29 北京车和家信息技术有限公司 Task processing system and method
CN110413390A (en) * 2019-07-24 2019-11-05 深圳市盟天科技有限公司 Thread task processing method, device, server and storage medium
CN110765082A (en) * 2019-09-06 2020-02-07 深圳平安通信科技有限公司 Hadoop file processing method and device, storage medium and server
CN110765082B (en) * 2019-09-06 2023-11-24 深圳平安通信科技有限公司 Hadoop file processing method and device, storage medium and server
CN110569470A (en) * 2019-09-09 2019-12-13 北京字节跳动网络技术有限公司 User matching method and device, readable medium and electronic equipment
CN110569470B (en) * 2019-09-09 2022-03-11 北京字节跳动网络技术有限公司 User matching method and device, readable medium and electronic equipment
CN110908784A (en) * 2019-11-12 2020-03-24 苏州智加科技有限公司 Image labeling method, device, equipment and storage medium
CN110908784B (en) * 2019-11-12 2022-09-20 苏州智加科技有限公司 Image labeling method, device, equipment and storage medium
CN111078377A (en) * 2019-11-29 2020-04-28 广州易方信息科技股份有限公司 Thread working method
CN113032018A (en) * 2019-12-25 2021-06-25 上海博泰悦臻电子设备制造有限公司 Improved method for reading command and related device
CN113032018B (en) * 2019-12-25 2024-03-01 博泰车联网科技(上海)股份有限公司 Improved method for read command and related device
CN111124651A (en) * 2019-12-27 2020-05-08 中通服公众信息产业股份有限公司 Method for multithreading concurrent scheduling in distributed environment
CN111124651B (en) * 2019-12-27 2023-05-23 中通服公众信息产业股份有限公司 Method for concurrently scheduling multiple threads in distributed environment
CN113254367A (en) * 2020-02-11 2021-08-13 合肥杰发科技有限公司 iAP1 protocol-based command processing method, electronic device and storage medium
CN111464331A (en) * 2020-03-03 2020-07-28 深圳市计通智能技术有限公司 Control method and system for thread creation and terminal equipment
CN111475305A (en) * 2020-05-06 2020-07-31 智博云信息科技(广州)有限公司 Big data processing method and system based on cloud platform multithreading
CN111475305B (en) * 2020-05-06 2020-11-17 睿智合创(北京)科技有限公司 Big data processing method and system based on cloud platform multithreading
CN111625329A (en) * 2020-05-18 2020-09-04 北京达佳互联信息技术有限公司 Task allocation method and device, electronic equipment, server and storage medium
CN111737026A (en) * 2020-05-28 2020-10-02 苏州浪潮智能科技有限公司 Multithreading message processing method based on lookup operation
WO2021238261A1 (en) * 2020-05-28 2021-12-02 苏州浪潮智能科技有限公司 Multi-thread message processing method based on lookup operation
CN111782293A (en) * 2020-06-28 2020-10-16 珠海豹趣科技有限公司 Task processing method and device, electronic equipment and readable storage medium
CN113973093A (en) * 2020-07-24 2022-01-25 中移(苏州)软件技术有限公司 Data transmission method and device, electronic equipment and readable storage medium
CN113973093B (en) * 2020-07-24 2023-10-13 中移(苏州)软件技术有限公司 Data transmission method and device, electronic equipment and readable storage medium
CN113760632A (en) * 2020-08-10 2021-12-07 北京沃东天骏信息技术有限公司 Thread pool performance monitoring method, device, equipment and storage medium
CN112328388A (en) * 2020-09-17 2021-02-05 北京中数科技术有限公司 Parallel computing method and system fusing multithreading and distributed technology
CN113238843A (en) * 2021-05-13 2021-08-10 北京京东振世信息技术有限公司 Task execution method, device, equipment and storage medium
CN113760540A (en) * 2021-07-29 2021-12-07 苏州浪潮智能科技有限公司 Task processing method and related device
CN113760540B (en) * 2021-07-29 2023-08-25 苏州浪潮智能科技有限公司 Task processing method and related device
CN114691375A (en) * 2022-06-02 2022-07-01 青岛展诚科技有限公司 Integrated circuit resistance extraction method based on parallel algorithm
CN114691375B (en) * 2022-06-02 2022-08-26 青岛展诚科技有限公司 Integrated circuit resistance extraction method based on parallel algorithm

Similar Documents

Publication Publication Date Title
CN109753354A (en) Processing method, device and the computer equipment of Streaming Media task based on multithreading
Ucar et al. Simmer: discrete-event simulation for R
CN105224445B (en) Distributed tracking system
CN101084488B (en) Method and system for debugging multithreading procedure in a multicore architecture
US9639446B2 (en) Trace monitoring
CN106980492B (en) For the device of calculating, system, method, machine readable storage medium and equipment
CN109471727A (en) A kind of task processing method, apparatus and system
US7810094B1 (en) Distributed task scheduling for symmetric multiprocessing environments
CN101719852A (en) Method and device for monitoring performance of middle piece
US20060259823A1 (en) Determining operating context of an executed instruction
CN110287009A (en) A kind of working node selection method, device, storage medium and server
US8205202B1 (en) Management of processing threads
CN112766907A (en) Service data processing method and device and server
US9785311B2 (en) Dynamically organizing applications based on a calendar event
CN103765415A (en) Parallel generation of topics from documents
CN104182278B (en) A kind of method and apparatus for judging computer hardware resource busy extent
CN109074286A (en) Control to the application for using system resource
CN112231274B (en) Log summarizing method and device, electronic equipment and storage medium
CN102112940A (en) Method and apparatus for monitoring performance of power delivery control system
CN108268546A (en) A kind of method and device for optimizing database
KR20160096313A (en) Apparatus and method for monitoring analysis application for analyzing big data
CN107508787B (en) A kind of task executing method, apparatus and system
WO2005006205A1 (en) A method of efficient performance monitoring for symmetric multi-threading systems
CN109359109A (en) A kind of data processing method and system calculated based on distributed stream
CN107180525A (en) Bluetooth control method, device, system and the relevant device of a kind of physical equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination