CN107992370A - VxWorks platform multi-tasks Software framework implementation method - Google Patents

VxWorks platform multi-tasks Software framework implementation method Download PDF

Info

Publication number
CN107992370A
CN107992370A CN201711219549.XA CN201711219549A CN107992370A CN 107992370 A CN107992370 A CN 107992370A CN 201711219549 A CN201711219549 A CN 201711219549A CN 107992370 A CN107992370 A CN 107992370A
Authority
CN
China
Prior art keywords
message
task
main process
receiving
process task
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.)
Granted
Application number
CN201711219549.XA
Other languages
Chinese (zh)
Other versions
CN107992370B (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.)
Shanghai Institute of Electromechanical Engineering
Original Assignee
Shanghai Institute of Electromechanical Engineering
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 Shanghai Institute of Electromechanical Engineering filed Critical Shanghai Institute of Electromechanical Engineering
Priority to CN201711219549.XA priority Critical patent/CN107992370B/en
Publication of CN107992370A publication Critical patent/CN107992370A/en
Application granted granted Critical
Publication of CN107992370B publication Critical patent/CN107992370B/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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0751Error or fault detection not based on redundancy
    • G06F11/0754Error or fault detection not based on redundancy by exceeding limits
    • G06F11/0757Error or fault detection not based on redundancy by exceeding limits by exceeding a time limit, i.e. time-out, e.g. watchdogs

Abstract

The invention discloses a kind of VxWorks platform multi-tasks Software framework implementation method, it comprises the following steps:Step 1, initializes the message queue of main process task module, sets the length of message queue and the size of each message;Step 2, initialize main process task module, establish main process task module and task priority is set, main process task module barrage reception message, when receiving message class message, message content, processing message etc. are obtained from message, when can solve VxWorks platform development large software, the problem of multitask that often occurs is to shared data access conflict.

Description

VxWorks platform multi-tasks Software framework implementation method
Technical field
It is real more particularly to a kind of VxWorks platform multi-tasks Software frame the present invention relates to a kind of framework implementation method Existing method.
Background technology
VxWorks (VxWorks are the real time operating systems that Wind River System companies of the U.S. release) operation System has the characteristics that real-time is good, stability is strong, reliability is high, is widely used in aerospace, military affairs, electric power in recent years Deng field.But these system structures are complicated, task treating capacity is more, each intermodule communication is complicated, so as to unavoidably need to face One problem:There are collision problem for access in multitask to shared data.It is also more to this solution method, but meeting in various degree There are some shortcomings, some real-times are such as sacrificed using the method for periodic arrangement processing work, being protected using substantial amounts of mutual exclusion can band It is higher etc. to carry out design complexities.Efficiently, economically communicating between task in VxWorks, there have to the performance of whole system to be very big Influence, for above-mentioned phenomenon, combined present invention employs mutual exclusive communication with message queue, propose a kind of the more of VxWorks platform Task software frame, the VxWorks platform multitask communication processing software based on this software frame are good, reliable with real-time Property it is high the characteristics of, and be not required to consider data shared access conflict the problem of, its software complexity, development difficulty and windows Platform is suitable, reduces VxWorks programming development cost, improves development efficiency
The content of the invention
The technical problems to be solved by the invention are to provide a kind of VxWorks platform multi-tasks Software framework implementation method, When it can solve VxWorks platform development large software, often there is the problem of multitask is to shared data access conflict.
The present invention is to solve above-mentioned technical problem by following technical proposals:A kind of VxWorks platform multitask is soft Part framework implementation method, it is characterised in that the VxWorks platform multi-tasks Software framework implementation method comprises the following steps:
Step 1, initializes the message queue of main process task module, sets the length of message queue and each message Size;
Step 2, initializes main process task module, establishes main process task module and sets task priority, main process task Task module barrage reception message, when receiving message class message, obtains message content from message, handles message:Receive number During according to class message, the data of software are updated;When receiving order class message, start corresponding workflow;When receiving timed message, Perform the corresponding work of fixed cycle;
Step 3, initializes network data receiving processing module, establishes and sets network to receive, send socket, establish Network receives task and sets task priority;Network data receiving processing module barrage reception network message, will report after receiving Literary content is packaged into a structure and is sent to main task with message;
Step 4, initializes WatchDog Timer processing module, and WatchDog Timer processing module is seen in foundation;Fixed cycle is lived It is dynamic, a message is sent to main task, content only one, is type of message.
Preferably, the VxWorks platform multi-tasks Software framework implementation method using network data receiving processing module, WatchDog Timer processing module, main process task module, wherein:
Network data receiving processing module is connected with main process task module, it is used to receiving after network data to main process task Task module sends message class message;
WatchDog Timer processing module is connected with main process task module, it is used for transmission timing message;
Main process task module is used to extract message.
Preferably, the step 1 comprises the following steps:
Step 11, establishes the structure of message queue, and the structure of message queue includes type of message, message data Length, message buffer, length of the zone length according to the most long message form of the Software for Design;
Step 12, determines that the maximum of message queue is lined up number, avoids since processing causes new message cannot not in time The problem of joining the team and losing;
Step 13, is lined up number according to the structure of step 11 and the maximum of step 12, establishes main process task task mould The message queue of block.
Preferably, the step 2 comprises the following steps:
Step 2 11, determines the priority of main process task task, and the priority of the priority ratio receiving network data is lower slightly, Ensure that external network data one is surely received;Initiate main process task task;
Step 2 12, in main process task task, when main process task message queue for it is empty when, obstruction waits;
Step 2 13, in main process task task, when receiving message class message, obtains message content from message, handles Message:When receiving data class message, the data of software are updated;When receiving order class message, start corresponding workflow;
Step 2 14, in main process task task, when receiving timed message, performs the corresponding work of fixed cycle, such as fixed cycle Data processing, message send etc. fixed cycle work.
Preferably, the step 3 comprises the following steps:
Step 3 11, establishes and sets network to receive, send socket;The address and port of two socket is set, The demand for receiving the installation warrants software of socks is configured, and is added multicast reception etc. and is set, time-out is set;
Step 3 12, establishes network and receives task and set task priority;
Step 3 13, in network data reception task, does not receive network message, obstruction waits;
Step 3 14, in network data reception task, message content is packaged into a main message queue pair after receiving The structure answered, is sent to main task, wherein structure includes type of message, message length, message content with message with message Deng.
Preferably, step 4 comprises the following steps:
Step 4 11, specifies the cycle of WatchDog Timer, if there are multiple cycles, can use multiple house dogs or The greatest common divisor in several cycles is set;
Step 4 12, house dog cycle arrive, and send a message to main task, content only one, is type of message.
Compared with prior art, the present invention has following beneficial effect:
First, during software multitasking, the data only one of shared data access conflict can be caused, i.e. main process task task Message queue;
2nd, the module in accessing shared data area, wherein network data receiving processing module and WatchDog Timer handle mould It is considerably less that block sends message occupancy CPU (Central Processing Unit, central processing unit);
3rd, preferable real-time, when the message queue of message class message or timing class message feeding main process task task is lined up When, once CPU handled before message, such message can be immediately treated;
4th, the design complexities of software and development cost are relatively low;Due to the initiation of all access to data, all in master Handle to be lined up in the message queue of task module and perform successively, there is no the phenomenon that data are interrupted, Software for Design is not required to consider The problem of data exclusive reference, VxWorks software programming difficulty is suitable with Windows (operating system) platform, reduces software and opens Cost is sent out, improves work efficiency.
Brief description of the drawings
Fig. 1 is the flow chart of the present invention.
Embodiment
Present pre-ferred embodiments are provided below in conjunction with the accompanying drawings, with the technical solution that the present invention will be described in detail.
As shown in Figure 1, VxWorks platform multi-tasks Software framework implementation method of the present invention comprises the following steps:
Step 1, initializes the message queue of main process task module, sets the length of message queue and each message Size;
Step 2, initializes main process task module, establishes main process task module and sets task priority, main process task Task module barrage reception message, when receiving message class message, obtains message content from message, handles message:Receive number During according to class message, the data of software are updated;When receiving order class message, start corresponding workflow;When receiving timed message, The corresponding work of fixed cycle is performed, such as the data processing of fixed cycle, the fixed cycle work such as message transmission;
Step 3, initializes network data receiving processing module, establishes and sets network to receive, send socket, establish Network receives task and sets task priority;Network data receiving processing module barrage reception network message, will report after receiving Literary content is packaged into a structure and is sent to main task with message, and the wherein message of structure includes type of message (message class Message), message length, message content etc.;
Step 4, initializes WatchDog Timer processing module, and WatchDog Timer processing module is seen in foundation;Fixed cycle is lived It is dynamic, a message is sent to main task, content only one, is type of message (timed message).
The step 1 comprises the following steps:
Step 11, establishes the structure of message queue, (message class disappears the structure of message queue including type of message Breath, time class message, that is, receive software after the information software and perform which kind of action, expansible), the length of message data, message Buffering area, length of the zone length according to the most long message form of the Software for Design;
Step 12, determines that the maximum of message queue is lined up number, avoids since processing causes new message cannot not in time The problem of joining the team and losing;
Step 13, is lined up number according to the structure of step 11 and the maximum of step 12, establishes main process task task mould The message queue of block.
The step 2 comprises the following steps:
Step 2 11, determines the priority of main process task task, and the priority of the priority ratio receiving network data is lower slightly, Ensure that external network data one is surely received;Initiate main process task task;
Step 2 12, in main process task task, when main process task message queue for it is empty when, obstruction waits;
Step 2 13, in main process task task, when receiving message class message, obtains message content from message, handles Message:When receiving data class message, the data of software are updated;When receiving order class message, start corresponding workflow;
Step 2 14, in main process task task, when receiving timed message, performs the corresponding work of fixed cycle, such as fixed cycle Data processing, message send etc. fixed cycle work.
The step 3 comprises the following steps:
Step 3 11, establishes and sets network to receive, send socket;The address and port of two socket is set, The demand for receiving the installation warrants software of socks is configured, and can be added multicast reception etc. and be set, time-out setting (used here as Be forever to wait);
Step 3 12, establishes network and receives task and set task priority;
Step 3 13, in network data reception task, does not receive network message, obstruction waits;
Step 3 14, in network data reception task, message content is packaged into a main message queue pair after receiving The structure answered, is sent to main task, wherein structure includes type of message (message class message) with message, message is grown with message Degree, message content etc..
Step 4 comprises the following steps:
Step 4 11, specifies the cycle of WatchDog Timer, if there are multiple cycles, can use multiple house dogs or The greatest common divisor in several cycles sets (such as two cycles:250 milliseconds and 100 milliseconds, then the cycle that can set house dog is 50 milliseconds, the very high house dog of frequency should be avoided);
Step 4 12, house dog cycle arrive, and send a message to main task, content only one, is that type of message is (fixed When message).
VxWorks platform multi-tasks Software framework implementation method of the present invention uses network data receiving processing module, guards the gate Dog timer processing module, main process task module, wherein:
Network data receiving processing module, is connected with main process task module, it is used to receiving after network data to main place Manage task module and send message class message;
WatchDog Timer processing module, is connected with main process task module, it is used for transmission timing message;
Main process task module, it is used to extract message.
Particular embodiments described above, technical problem, technical solution and the beneficial effect of the solution to the present invention carry out It is further described, it should be understood that the foregoing is merely the specific embodiment of the present invention, is not limited to The present invention, within the spirit and principles of the invention, any modification, equivalent substitution, improvement and etc. done, should be included in this Within the protection domain of invention.

Claims (6)

  1. A kind of 1. VxWorks platform multi-tasks Software framework implementation method, it is characterised in that the VxWorks platform multitask Software frame implementation method comprises the following steps:
    Step 1, initializes the message queue of main process task module, sets the length of message queue and the size of each message;
    Step 2, initializes main process task module, establishes main process task module and sets task priority, main process task task Module barrage reception message, when receiving message class message, obtains message content from message, handles message:Receive data class During message, the data of software are updated;When receiving order class message, start corresponding workflow;When receiving timed message, perform The corresponding work of fixed cycle;
    Step 3, initializes network data receiving processing module, establishes and sets network to receive, send socket, establish network Reception task and setting task priority;Network data receiving processing module barrage reception network message, by message after receiving Appearance is packaged into a structure and is sent to main task with message;
    Step 4, initializes WatchDog Timer processing module, and WatchDog Timer processing module is seen in foundation;Fixed cycle activity, A message is sent to main task, content only one, is type of message.
  2. 2. VxWorks platform multi-tasks Software framework implementation method as claimed in claim 1, it is characterised in that described VxWorks platform multi-tasks Software framework implementation method is using network data receiving processing module, WatchDog Timer processing mould Block, main process task module, wherein:
    Network data receiving processing module is connected with main process task module, it is used to receiving after network data to main process task task Module sends message class message;
    WatchDog Timer processing module is connected with main process task module, it is used for transmission timing message;
    Main process task module is used to extract message.
  3. 3. VxWorks platform multi-tasks Software framework implementation method as claimed in claim 1, it is characterised in that the step One comprises the following steps:
    Step 11, establishes the structure of message queue, and the structure of message queue includes type of message, the length of message data Degree, message buffer, length of the zone length according to the most long message form of the Software for Design;
    Step 12, determines that the maximum of message queue is lined up number, avoids since processing causes new message to join the team not in time And the problem of losing;
    Step 13, is lined up number according to the structure of step 11 and the maximum of step 12, establishes main process task module Message queue.
  4. 4. VxWorks platform multi-tasks Software framework implementation method as claimed in claim 1, it is characterised in that the step Two comprise the following steps:
    Step 2 11, determines the priority of main process task task, and the priority of the priority ratio receiving network data is lower slightly, ensures External network data one is surely received;Initiate main process task task;
    Step 2 12, in main process task task, when main process task message queue for it is empty when, obstruction waits;
    Step 2 13, in main process task task, when receiving message class message, obtains message content from message, handles message: When receiving data class message, the data of software are updated;When receiving order class message, start corresponding workflow;
    Step 2 14, in main process task task, when receiving timed message, performs the corresponding work of fixed cycle, such as the number of fixed cycle According to processing, the fixed cycle work such as message is sent.
  5. 5. VxWorks platform multi-tasks Software framework implementation method as claimed in claim 1, it is characterised in that the step Three comprise the following steps:
    Step 3 11, establishes and sets network to receive, send socket;The address and port of two socket is set, is received The demand of the installation warrants software of socks is configured, and is added multicast reception etc. and is set, time-out is set;
    Step 3 12, establishes network and receives task and set task priority;
    Step 3 13, in network data reception task, does not receive network message, obstruction waits;
    Step 3 14, in network data reception task, it is corresponding that message content is packaged into a main message queue after receiving Structure, is sent to main task, wherein structure includes type of message, message length, message content etc. with message with message.
  6. 6. VxWorks platform multi-tasks Software framework implementation method as claimed in claim 1, it is characterised in that step 4 bag Include following steps:
    Step 4 11, specifies the cycle of WatchDog Timer, if there are multiple cycles, can use multiple house dogs or several The greatest common divisor in cycle is set;
    Step 4 12, house dog cycle arrive, and send a message to main task, content only one, is type of message.
CN201711219549.XA 2017-11-28 2017-11-28 VxWorks platform multitask software framework implementation method Active CN107992370B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711219549.XA CN107992370B (en) 2017-11-28 2017-11-28 VxWorks platform multitask software framework implementation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711219549.XA CN107992370B (en) 2017-11-28 2017-11-28 VxWorks platform multitask software framework implementation method

Publications (2)

Publication Number Publication Date
CN107992370A true CN107992370A (en) 2018-05-04
CN107992370B CN107992370B (en) 2021-01-22

Family

ID=62033817

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711219549.XA Active CN107992370B (en) 2017-11-28 2017-11-28 VxWorks platform multitask software framework implementation method

Country Status (1)

Country Link
CN (1) CN107992370B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109413064A (en) * 2018-10-24 2019-03-01 同方电子科技有限公司 Application layer protocol message processing method between Single NIC VxWorks system and more hosts
CN109634532A (en) * 2018-12-19 2019-04-16 湖南源科创新科技有限公司 The method of more VxWorks host share and access storage mediums
CN109992388A (en) * 2019-04-08 2019-07-09 中国核动力研究设计院 One kind being used for npp safety grade device software multiple task management system
CN110764935A (en) * 2019-10-28 2020-02-07 天津津航计算技术研究所 Method for efficiently transferring messages among tasks based on real-time operating system
CN112114982A (en) * 2020-09-09 2020-12-22 天津津航计算技术研究所 Management method for shared memory among multiple tasks based on VxWorks system
CN113608883A (en) * 2021-06-21 2021-11-05 天津津航计算技术研究所 Packaging method based on VxWorks real-time operating system
CN115396387A (en) * 2022-08-30 2022-11-25 上海航天电子通讯设备研究所 Data recording method, device, equipment and storage medium based on VxWorks message queue

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101266556A (en) * 2008-05-09 2008-09-17 北京泰得思达科技发展有限公司 Multitask scheduling system
US20120192147A1 (en) * 2011-01-25 2012-07-26 Argen Wong Develop real time software without an RTOS
CN104199730A (en) * 2014-08-29 2014-12-10 浪潮集团有限公司 Single-thread multi-task processing method based on synchronous I/O multiplexing mechanism
CN106873545A (en) * 2015-12-14 2017-06-20 重庆森坦科技有限公司 A kind of real-time multiprocessors system based on FPGA

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101266556A (en) * 2008-05-09 2008-09-17 北京泰得思达科技发展有限公司 Multitask scheduling system
US20120192147A1 (en) * 2011-01-25 2012-07-26 Argen Wong Develop real time software without an RTOS
CN104199730A (en) * 2014-08-29 2014-12-10 浪潮集团有限公司 Single-thread multi-task processing method based on synchronous I/O multiplexing mechanism
CN106873545A (en) * 2015-12-14 2017-06-20 重庆森坦科技有限公司 A kind of real-time multiprocessors system based on FPGA

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
朱峰 周吉超 赵起超: "一种基于VxWorks的导弹火控系统软件实时多任务设计方法", 《数字技术与应用》 *

Cited By (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109413064A (en) * 2018-10-24 2019-03-01 同方电子科技有限公司 Application layer protocol message processing method between Single NIC VxWorks system and more hosts
CN109413064B (en) * 2018-10-24 2021-04-27 同方电子科技有限公司 Application layer protocol message processing method between single network card VxWorks system and multiple hosts
CN109634532A (en) * 2018-12-19 2019-04-16 湖南源科创新科技有限公司 The method of more VxWorks host share and access storage mediums
CN109992388B (en) * 2019-04-08 2021-04-13 中核控制系统工程有限公司 Multi-task management system for safety-level equipment software of nuclear power plant
CN109992388A (en) * 2019-04-08 2019-07-09 中国核动力研究设计院 One kind being used for npp safety grade device software multiple task management system
CN110764935A (en) * 2019-10-28 2020-02-07 天津津航计算技术研究所 Method for efficiently transferring messages among tasks based on real-time operating system
CN110764935B (en) * 2019-10-28 2023-07-14 天津津航计算技术研究所 Method for efficiently transmitting messages between tasks based on real-time operating system
CN112114982A (en) * 2020-09-09 2020-12-22 天津津航计算技术研究所 Management method for shared memory among multiple tasks based on VxWorks system
CN112114982B (en) * 2020-09-09 2022-03-08 天津津航计算技术研究所 Management method for shared memory among multiple tasks based on VxWorks system
CN113608883A (en) * 2021-06-21 2021-11-05 天津津航计算技术研究所 Packaging method based on VxWorks real-time operating system
CN113608883B (en) * 2021-06-21 2024-02-13 天津津航计算技术研究所 Encapsulation method based on VxWorks real-time operating system
CN115396387A (en) * 2022-08-30 2022-11-25 上海航天电子通讯设备研究所 Data recording method, device, equipment and storage medium based on VxWorks message queue
CN115396387B (en) * 2022-08-30 2024-04-12 上海航天电子通讯设备研究所 Data recording method, device, equipment and storage medium based on VxWorks message queue

Also Published As

Publication number Publication date
CN107992370B (en) 2021-01-22

Similar Documents

Publication Publication Date Title
CN107992370A (en) VxWorks platform multi-tasks Software framework implementation method
CN102377814B (en) Remote assistance service method aiming at embedded operation system
CN104216768B (en) Data processing method and device
CN110139271A (en) A kind of method, system and device that smart home device batch configuration networks
CN204350029U (en) Data interaction system
CN105187327A (en) Distributed message queue middleware
CN103532876A (en) Processing method and system of data stream
CN102916833B (en) Remote debugging method, remote debugging system and debugging target equipment
CN111556062B (en) Network security isolation device with one-way import function and method
CN106302090A (en) A kind of message treatment method, Apparatus and system
CN106789099A (en) High-speed isolated network method and terminal based on PCIE
CN106850770A (en) High-efficiency transmission method and device based on cloud computing service
CN106648922A (en) Data collecting method based on XMPP
CN105245579B (en) A kind of distribution network system mass data Communication processing method and system
CN103701788A (en) Cross-platform flexible bus communication device and flexible bus
CN105471718A (en) Realization method of full duplex message queue
CN109714135A (en) A kind of data pack transmission method and device
CN103984544A (en) Method for preventing tasks from being simultaneously executed
CN102693434B (en) Communication apparatus and method for interface layer of radio frequency identification device
CN106791685A (en) A kind of remote audio-video transmission method and device
CN112738847A (en) Narrow-band satellite communication system and method
CN105656801B (en) A kind of concurrency control method and device
CN102857499A (en) Expandable intelligent protocol conversion method based on embedded platform
CN106576100B (en) TCP network agent configuration method and device
CN107707489B (en) Embedded device data exchange method based on streaming data

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
GR01 Patent grant
GR01 Patent grant