CN105930219B - A kind of communication means of customized multithreading control - Google Patents

A kind of communication means of customized multithreading control Download PDF

Info

Publication number
CN105930219B
CN105930219B CN201610261157.9A CN201610261157A CN105930219B CN 105930219 B CN105930219 B CN 105930219B CN 201610261157 A CN201610261157 A CN 201610261157A CN 105930219 B CN105930219 B CN 105930219B
Authority
CN
China
Prior art keywords
thread
parameter
father
value
uplink
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.)
Active
Application number
CN201610261157.9A
Other languages
Chinese (zh)
Other versions
CN105930219A (en
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.)
Hangzhou Markov Technology Co ltd
Original Assignee
Zhejiang University of Technology ZJUT
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 Zhejiang University of Technology ZJUT filed Critical Zhejiang University of Technology ZJUT
Priority to CN201610261157.9A priority Critical patent/CN105930219B/en
Publication of CN105930219A publication Critical patent/CN105930219A/en
Application granted granted Critical
Publication of CN105930219B publication Critical patent/CN105930219B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Communication Control (AREA)

Abstract

A kind of communication means of customized multithreading control, includes the following steps: 1) to design an argument structure object for the entrance function of sub thread, embeds service parameter and two command pointer individual events;Embedded service parameter is required for normal service design function, and command pointer individual event is designed by the control management between father and son's thread;2) it defined in father's thread, initialize 2 local variables, address starts sub thread as uplink, down order parameter pointer;3) change local variable value in father's thread, the local variable includes down order parameter, which changes the variation for causing sub thread to execute logic;4) incoming pointer is obtained in sub thread, changes the value of uplink command parameter, which changes the variation for causing code execution logic in father's thread.The consumption of present invention reduction kernel resources, code wrap is more brief, real-time is good.

Description

A kind of communication means of customized multithreading control
Technical field
The invention belongs to the communication means that program communication method more particularly to a kind of multithreading are managed.
Background technique
Multi-thread programming is a kind of software design that the several operation systems such as Windows/Linux/vxWorks are generally supported The design method that a variety of development language platforms such as method and C/C++, Java, C# are supported.In each generic operation system of C/C++ level Management control, data communication between enterprising line journey of uniting, there is similar a concept and mode, for example, mutual exclusion, locking, synchronization and Wait etc..In JAVA since the multithreading API of language level supports that multi-thread design becomes more simple, JAVA Multi-thread control The granularity of management is thicker compared with C/C++, thus flexibility is unlike the latter.
On each type operating system, using C/C++ carry out multithread programming thread management-control method, especially two The synchronization of father and son's cross-thread progress different code sections.It is realized usually using lock mechanism, signal lamp, it can be on the windows The switching and control of code execution flow are carried out using message.But these mechanism generally use kernel objects, external variable, in resource It is not brief enough in consumption, code wrap;The message mechanism of windows be it is non real-time, sometimes will lead to the excessively long time Delay.
Summary of the invention
In order to overcome, the kernel resources consumption of the communication means of existing multithreading control is larger, code wrap is not brief, real The poor deficiency of when property, the present invention provides a kind of consumption of reduction kernel resources, code wrap is more brief, real-time is good certainly The communication means of the multithreading control of definition.
The technical solution adopted by the present invention to solve the technical problems is:
A kind of communication means of customized multithreading control, the communication means include the following steps:
1) an argument structure object is designed for the entrance function of sub thread, embedded service parameter and two orders refer to Needle individual event;Embedded service parameter is required for normal service design function, and command pointer individual event is between father and son's thread Control management designed by;
2) it defined in father's thread, initialize 2 local variables, address is opened as uplink, down order parameter pointer Mover thread;
3) change local variable value in father's thread, the local variable includes down order parameter, which changes Sub thread is caused to execute the variation of logic;
4) incoming pointer is obtained in sub thread, changes the value of uplink command parameter, and value variation causes father's thread Middle code executes the variation of logic.
Further, the step 3), 4) view actual code design needs repeatedly, alternately irregularly carry out.
Further, step 3), 4) in, caused by switching respectively in the order for executing other side's thread before code segment, in advance First initial value is changeed back parameter command.
Further, before carrying out the control to another thread by change bid value in thread, the current command is checked Whether parameter is initial value, is the revaluate that initial value just carries out order, otherwise it is assumed that preceding once to the revaluate of order, there are no draw Play the variation that thread executes flow direction.
Technical concept of the invention are as follows: devise a kind of thread code switching control technology based on command parameter, the party Method is suitable for the several operation systems such as Windows/Linux/vxWorks and realizes in C/C++ level.
Using the command parameter of built-in pointer form in the input parameter of thread function, father's thread can after starting sub thread With setting command value, sub thread executes different code segments according to order;Different command parameters also can be set in sub thread Value executes flow direction to the code segment of father's thread and controls.Its pointer ginseng that function in C/C++ language is substantially really utilized The property that carrying input and output are had both possessed by number.
Stick to ready-made Mutli-thread Programming Technology relative to existing general procedure person, and this method is different from ready-made more Thread synchronization programming mechanism;From system resources consumption, it is light weight method that the technology occupancy resource that this method uses is low;With WINDOWS message mechanism is compared, and this method real-time is good, is delayed low;This method is based on the parameter pointer realization between function, no It is related to definition outside or global variable, code wrap is relatively good.
Beneficial effects of the present invention are mainly manifested in: the consumption of reduction kernel resources, code wrap is more brief, real-time is good It is good.
Detailed description of the invention
Fig. 1 is the schematic diagram of the communication means of customized multithreading control.
Specific embodiment
The invention will be further described below in conjunction with the accompanying drawings.
Referring to Fig.1, a kind of communication means of customized multithreading control, includes the following steps:
1) an argument structure object is designed for the entrance function of sub thread, embedded service parameter and two orders refer to Needle individual event;The former is required for normal service design function, and the latter is designed by the control management between father and son's thread;
Typedef struct
{
Char*downcmd;// downlink control parameter controls sub thread for father's thread
Char*upcmd;// upload control parameter is used for sub-line process control father's thread
Struct*SunWorkPara;
}SUN_THREAD_PARA;
For example, SunWorkPara is that sub thread needed for former business is passed to parameter,
Downcmd/upcmd is the command parameter of character type, they synthesize new sub thread function
Parameter.
2) it defined in father's thread, initialize 2 local variables, address is opened as uplink, down order parameter pointer Mover thread;
3) change (down order parameter) local variable value in father's thread, value variation causes sub thread execution to be patrolled The variation collected;
4) incoming pointer is obtained in sub thread, changes the value of uplink command parameter, and value variation causes father's thread Middle code executes the variation of logic.
The step 3), 4) design of view actual code needs, and repeatedly, alternately can irregularly carry out.
The step 3), 4) in, caused by switching respectively in the order for executing other side's thread before code segment, in advance ginseng Initial value is changeed back in number order.
By changing before bid value carries out the control to another thread in thread, check the current command parameter whether be Initial value is the revaluate that initial value just carries out order, otherwise it is assumed that preceding once to the revaluate of order, there are no cause thread to execute The variation of flow direction.
Example: a method prototype with C Implementation of pseudocode, sub thread is the thread of long-term terminate-and-stay-resident here, wherein Father's thread code

Claims (4)

1. a kind of communication means of customized multithreading control, it is characterised in that: the communication means includes the following steps:
1) an argument structure object is designed for the entrance function of sub thread, embeds service parameter and two command pointer lists ?;Embedded service parameter is required for normal service design function, and command pointer individual event is the control between father and son's thread Designed by tubulation reason;
2) it defined in father's thread, initialize 2 local variables, address is as uplink, down order parameter pointer, promoter Thread;
3) change local variable value in father's thread, the local variable includes down order parameter, and value variation causes The variation of sub thread execution logic;
4) incoming pointer is obtained in sub thread, changes the value of uplink command parameter, and value variation causes generation in father's thread Code executes the variation of logic.
2. a kind of communication means of customized multithreading control as described in claim 1, it is characterised in that: the step 3), 4) view actual code design need, and repeatedly, alternately irregularly carries out.
3. a kind of communication means of customized multithreading control as claimed in claim 1 or 2, it is characterised in that: step 3), 4) in, before code segment caused by switching respectively in the order for executing other side's thread, in advance down order parameter in father's thread Value change back that initial value, the value of uplink command parameter changes back initial value in sub thread.
4. a kind of communication means of customized multithreading control as claimed in claim 1 or 2, it is characterised in that: in thread It is interior carry out the control to father, sub thread by changing uplink, down order parameter value before, check that uplink and downlink command parameter value is No is initial value, is the revaluate that initial value just carries out uplink and downlink command parameter, otherwise it is assumed that preceding once to uplink and downlink command parameter Revaluate, there are no cause operating system execution thread dispatch execution flow direction variation.
CN201610261157.9A 2016-04-22 2016-04-22 A kind of communication means of customized multithreading control Active CN105930219B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610261157.9A CN105930219B (en) 2016-04-22 2016-04-22 A kind of communication means of customized multithreading control

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610261157.9A CN105930219B (en) 2016-04-22 2016-04-22 A kind of communication means of customized multithreading control

Publications (2)

Publication Number Publication Date
CN105930219A CN105930219A (en) 2016-09-07
CN105930219B true CN105930219B (en) 2019-02-05

Family

ID=56837109

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610261157.9A Active CN105930219B (en) 2016-04-22 2016-04-22 A kind of communication means of customized multithreading control

Country Status (1)

Country Link
CN (1) CN105930219B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113485839A (en) * 2021-07-27 2021-10-08 中国银行股份有限公司 Data processing method and system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101833476A (en) * 2010-05-28 2010-09-15 西安交通大学 Independent stack function calling method based on CMP speculation multi-thread mechanism
CN102279774A (en) * 2011-08-22 2011-12-14 中兴通讯股份有限公司 Method and device for realizing multi-thread message interaction by using synchronous function calling mechanism
CN103744643A (en) * 2014-01-10 2014-04-23 浪潮(北京)电子信息产业有限公司 Method and device for structuring a plurality of nodes parallel under multithreaded program
US8819700B2 (en) * 2010-12-22 2014-08-26 Lsi Corporation System and method for synchronous inter-thread communication

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102005001025A1 (en) * 2005-01-07 2006-07-27 Infineon Technologies Ag Multi-thread processor, has switching table receiving internal and external exceptions of specific context, where context parameter sets of exceptions are updated, and switching parameter set is set for flow control of program commands

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101833476A (en) * 2010-05-28 2010-09-15 西安交通大学 Independent stack function calling method based on CMP speculation multi-thread mechanism
US8819700B2 (en) * 2010-12-22 2014-08-26 Lsi Corporation System and method for synchronous inter-thread communication
CN102279774A (en) * 2011-08-22 2011-12-14 中兴通讯股份有限公司 Method and device for realizing multi-thread message interaction by using synchronous function calling mechanism
CN103744643A (en) * 2014-01-10 2014-04-23 浪潮(北京)电子信息产业有限公司 Method and device for structuring a plurality of nodes parallel under multithreaded program

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
POS实时监控软件多线程通信设计及实现;刘艳群,朱庄生;《计算机工程与设计》;20150630;第1401-1406页 *

Also Published As

Publication number Publication date
CN105930219A (en) 2016-09-07

Similar Documents

Publication Publication Date Title
CN110532020B (en) Data processing method, device and system for micro-service arrangement
CN112445575B (en) Multi-cluster resource scheduling method, device and system
CN103744643B (en) The method and device of multi-node parallel framework under a kind of multithread programs
CN103455416A (en) Pressure test method based on Android system intelligent device memory usage and CPU
CN101477463A (en) Software platform and software development platform used for digital television set-top box
CN106020976A (en) Method and apparatus for offloading out of memory processing process to user space
CN110647278A (en) Method and device for controlling plug-in display, computing equipment and storage medium
CN105930219B (en) A kind of communication means of customized multithreading control
CN110489376A (en) The in-orbit reconstruct frame system of the whole star hardware of satellite and reconstructing method
CN109634652A (en) A kind of method, apparatus of data processing, computer storage medium and terminal
CN103401731B (en) Manual test and automatic test environment changing method and system
CN110347494A (en) Context information management method, apparatus, system and computer readable storage medium
CN107329738A (en) Component update method and device
CN103605526A (en) Template componentized code generating method based on chain-of-responsibility pattern
CN103019819A (en) Dynamic link library uniform scheduling method based on plug-in mechanism
CN115658278B (en) Micro-task scheduler supporting high concurrency protocol interaction
WO2023185390A1 (en) Base station version downloading method, network management server, base station, device and medium
CN113138774A (en) Gradation issuing method, gradation issuing apparatus, electronic device, gradation issuing medium, and program product
CN103902360A (en) Service scheduling method and timing server
CN117170842A (en) Thread pool management architecture and thread pool management method
CN116243930A (en) Multi-version parallel environment design method and construction system
CN108334374A (en) The method and apparatus of component dynamic load and execution
CN109144486A (en) A kind of workflow implementation method statelessly changed
CN105700913A (en) Method for creation and parallel operation of lightweight bare chip codes
US20240045733A1 (en) Method and apparatus for deploying deep learning system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20220128

Address after: 310000 5-1006, No. 501, No. 2 street, Baiyang street, Qiantang new area, Hangzhou, Zhejiang Province

Patentee after: Hangzhou Markov Technology Co.,Ltd.

Address before: The city Zhaohui six districts Chao Wang Road Hangzhou City, Zhejiang province 310014 18

Patentee before: ZHEJIANG University OF TECHNOLOGY

TR01 Transfer of patent right