CN100426240C - A time processing method of message and embedded multiple task operating system - Google Patents

A time processing method of message and embedded multiple task operating system Download PDF

Info

Publication number
CN100426240C
CN100426240C CNB2006101147530A CN200610114753A CN100426240C CN 100426240 C CN100426240 C CN 100426240C CN B2006101147530 A CNB2006101147530 A CN B2006101147530A CN 200610114753 A CN200610114753 A CN 200610114753A CN 100426240 C CN100426240 C CN 100426240C
Authority
CN
China
Prior art keywords
message
timer
task
time
handling routine
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.)
Expired - Fee Related
Application number
CNB2006101147530A
Other languages
Chinese (zh)
Other versions
CN1952899A (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.)
Vimicro Corp
Original Assignee
Vimicro Corp
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 Vimicro Corp filed Critical Vimicro Corp
Priority to CNB2006101147530A priority Critical patent/CN100426240C/en
Publication of CN1952899A publication Critical patent/CN1952899A/en
Application granted granted Critical
Publication of CN100426240C publication Critical patent/CN100426240C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)
  • Computer And Data Communications (AREA)

Abstract

This invention discloses a message timely process method applied in imbedded multi-task operation system, which comprises the following steps: when task receives information, judging current message needs timely process; if it needs timely process, then starting timer; when timer interval generates, starting timer interval process program; executing relative detail work in timer interval process program. This invention discloses a imbed multi-task operation system structure of this method.

Description

Timely disposal route of a kind of message and embedded multiple task operating system
Technical field
The present invention relates to embedded multiple task operating system, relate in particular to the method for in embedded multiple task operating system, the message of task reception in time being handled.
Background technology
In a lot of embedded OSs, system all is multitask (or crying a multi-process) system, and the scheduling mode that adopts is a preemptive type.Switching between each task and executable operations all are based on message mechanism.That is to say, after a task A receives a piece of news, resolve this message content, and begin to carry out the corresponding concrete operations of this message; After this message was complete, task A waited for reception a piece of news down, and carried out corresponding the operation according to the command content of the following a piece of news that receives, and ended task after task A receives and handles entire message.But carry out in the specific operation process of message at task A, may be interrupted by priority higher task B or interrupt routine, at this moment, task A will be stopped and carry out current message, and task A is hung up by system; Like this, just very difficult assurance task A is performed in the regular hour and finishes.Particularly when task A receives important message, often need timely processing, to guarantee the deadline of this message, if in the important messages implementation, task A is interrupted by priority higher task or interrupt handling routine, and then this important messages of task A will be interrupted execution, can continue to carry out after the task of other that can only wait for that priority is high or interrupt handling routine are complete, so important messages is difficult to guarantee in the regular hour complete.
In the prior art, in some embedded systems in order to guarantee a certain task executions time, directly use timer, the operation that will finish each bar message of this task has been placed directly in the timer interrupt handling routine to be carried out, will produce at set intervals once after timer starts and interrupt, the timer interrupt handling routine can be performed once at set intervals.Adopt this mode, when task is finished, in the time of need handling without any message, timer also produces the continuation cycle and interrupts, but the timer interrupt handling routine is not carried out any concrete operation in fact in this case, these interruptions are nonsensical, can cause resource waste.
Summary of the invention
The invention provides the timely disposal route of a kind of message, in order to solve the problem that can not guarantee message or task executions time and waste system resource that exists in the prior art.
The inventive method comprises and is applied to embedded multiple task operating system, comprising: preestablish the type of message that needs are in time handled in system;
After task receives message, judge according to type of message whether needs are in time handled for the message of current reception, in time handle if desired, then start timer; After timer interrupts producing, in the timer interrupt handling routine, carry out the concrete operations corresponding, and after described concrete operations are finished, close described timer automatically by described timer interrupt handling routine with this message;
Do not need timely processing if judge the message of current reception, then carry out conventional Message Processing flow process.
According to said method of the present invention, the associative operation that different types of messages need be carried out is packaged into respective function in advance, is stored in the system; Need in time to handle if judge the message of current reception, carry out the following step:
Match the respective function of current message, the address information of respective function is passed to described timer interrupt handling routine;
Start described timer, after timer interrupts producing, according to the described respective function of described function address information and executing, finish the concrete operations relevant with current message by the timer interrupt handling routine.
According to said method of the present invention, the time interval of described timer can be provided with.
According to said method of the present invention, preestablish the priority that needs the different types of messages in time handled, and the time interval of the setting timer corresponding with different priorities;
When the message of judging current reception needs in time to handle, determine its corresponding priorities according to type of message, the priority time corresponding that the time interval of described timer is set to and determines back at interval starts described timer.
According to said method of the present invention, after current Message Processing finished, described task waited for that receiving next message handles, and finishes up to task.
The present invention provides a kind of embedded multiple task operating system in addition, comprises several task executing units, timer and storage unit, and each task executing units comprises:
The message sink module receives and sends to the message of this task, and is transmitted to the message judge module;
The message judge module is used to judge whether the message of current reception needs timely processing, in time handles if desired, then sends message to interruption processing module; Otherwise, send a message to the common message processing module;
Interruption processing module is used to start timer, and after timer interrupts producing, starts the timer interrupt handling routine that is stored in the described storage unit, carries out the concrete operations relevant with this message in the timer interrupt handling routine;
The common message processing module is carried out conventional Message Processing flow process.
Also store the function corresponding in the described storage unit with different types of messages, the associative operation that the corresponding message of encapsulation need be carried out in each function, described interruption processing module comprises:
Matched sub-block matches the respective function of current message;
Transmit submodule, the address information of respective function is passed to the timer interrupt handling routine of storing in the described storage unit;
Interrupt submodule, start timer, after timer interrupts producing, carry out the timer interrupt handling routine,, finish the relevant concrete operations of current message according to described function address information and executing respective function.
Beneficial effect of the present invention is as follows:
Adopt the present invention, after task receives message, whether the message of judging current reception needs timely processing, in time handle if desired, then start timer, after timer interrupts producing, start timer and carry out interrupt handling routine, in the timer interrupt handling routine, carry out the concrete work corresponding with this message, after the concrete work corresponding with message is finished, the automatic timeing closing device of timer interrupt handling routine.Because in a single day the timer interrupt handling routine is performed, and will be finished, the centre can not interrupted by any task or interrupt handling routine, therefore can guarantee the execution time of message.When a task comprises a plurality of message,, then just can guarantee the whole task executions time if each message all adopts method of the present invention in time to handle.In other words, when needs guarantee that a task executions is during the time, can in advance the various type of messages that this task comprised all be set at needs in time handles, after task receives message, will start timer, produce and interrupt, carry out the concrete operations of message correspondence by the interrupt handling routine of timer.If in the task only some message need guarantee its execution time, then this type message sets is in time handled for needing, the concrete operations of being carried out this type message correspondence by the interrupt handling routine of timer get final product.Like this, adopt the inventive method, make task itself possess the characteristic of certain interrupt routine, not only can guarantee the execution time of a certain section work in whole task or the task, and task or corresponding moral conduct complete after, the automatic timeing closing device of interrupt routine has been avoided timer owing to periodically start the problem that useless interruption causes system resource waste that produces.
Description of drawings
Fig. 1 is a method embodiment process flow diagram provided by the invention;
Fig. 2 is an embedded multitask system structural representation provided by the invention.
Embodiment
The invention provides the timely disposal route of a kind of message, be applied to embedded multiple task operating system, comprising:
After task receives message, judge whether the message of current reception needs timely processing, in time handle if desired, then start timer, after timer interrupts producing, carry out the timer interrupt handling routine, in the timer interrupt handling routine, carry out the concrete work corresponding with this message.
Below in conjunction with accompanying drawing, the inventive method is described in detail.
Referring to Fig. 1, be the inventive method embodiment process flow diagram, comprise following concrete steps:
After step S101, the system start-up, in system, create a task, store the respective function that in advance that the different types of messages of task is relevant action is packaged in the system;
Step S102, being created of task begin to start;
After step S103, the task start that is created, wait for that the user sends message;
Step S104, judge whether to receive the message of the task of sending to,, then go to step S103, continue to wait for the arrival of news if do not receive message; If received message, execution in step S105 then;
Whether step S105, the message of judging current reception are to need the message in time handled, if, execution in step S106 then; Otherwise, execution in step S108;
Whether the message of judging current reception is that specifically determination methods for example when needing the message of processing in time: the type of message that preestablishes the message correspondence that need in time handle in system;
After task receives message, judge according to type of message whether needs are in time handled for the message of current reception;
Step S106, match the respective function of current message, the respective function address information is passed to the timer interrupt handling routine; And startup timer; Continue step S107;
Step S107, when the time interval that timer is set arrives (for example, the time interval of setting timer is 1 millisecond), produce timer and interrupt; Start the timer interrupt handling routine,, finish the concrete work of this message correspondence according to the function address information and executing respective function of transmitting, after the concrete work corresponding with message is finished, the automatic timeing closing device of timer interrupt handling routine; Continue step S109;
Step S108, the conventional Message Processing flow process of execution continue step S109;
The Message Processing flow process of described routine when promptly current task is not interrupted, is directly carried out the concrete operations of this message correspondence; In the message implementation, can be interrupted by the higher task of priority;
Step S109, judge whether current task is finished,, judge that then current task finishes, finish current task if handled the last item message of current task; Otherwise, go to step S103, continue to wait for that the user sends message, repeat above flow process.
In concrete the application, can be provided with respectively at different tasks and need the type of message of processing in time, when needs guarantee the execution time of a vital task, can in advance the various type of messages that this task comprised all be set at needs in time handles, after task receives each message, above-mentioned flow process according to the embodiment of the invention all can start timer generation interruption, is carried out the concrete operations of message correspondence by the interrupt handling routine of timer; If in the current task only some message need guarantee its execution time, then this kind needs are guaranteed that the type of message of the message correspondence of execution time is set at and need in time handles, receive the message of this type when task after, carry out the concrete operations of this type message correspondence by the interrupt handling routine of timer, thereby realize the execution time of a certain section work in the assurance task.
According to the said method that this embodiment provides, the time interval of timer can be provided with.
For example: preestablish the priority that needs the different types of messages in time handled, and the time interval of the setting timer corresponding with different priorities; When the message of judging current reception needs in time to handle, determine its corresponding priorities according to type of message, restart timer behind the priority time corresponding interval that the time interval of timer is set to and determines.
As shown in table 1 below:
Table 1
Type of message Priority Timer time at interval
Type A 1 grade 1 millisecond
Type B 2 grades 2 milliseconds
Type C 3 grades 3 milliseconds
As shown in Table 1, the message priority of type A is the highest, and timer produces and interrupts after timer starts 1 millisecond, carries out the timer interrupt handling routine, carries out the concrete operations of this message correspondence in interrupt handling routine.In like manner, for the type B that receives and the message of Type C, also need to start the timer generation and interrupt, only timer time is a little longer at interval, is producing interruption after 2 milliseconds and after 3 milliseconds respectively.
According to said method provided by the invention, the invention provides a kind of embedded multiple task operating system 10 that possesses corresponding function, its structural representation comprises several task executing units 101, timer 102 and storage unit 103 as shown in Figure 2, and each task executing units 101 comprises:
Message sink module 1011 receives and sends to the message of this task, and is transmitted to message judge module 1012;
Message judge module 1012 is used to judge whether the message of current reception needs timely processing, in time handles if desired, then sends message to interruption processing module 1013; Otherwise, send a message to common message processing module 1014;
Interruption processing module 1013 starts timer, when the timer time that is provided with arrives at interval, starts the timer interrupt handling routine of storage in the storage unit 103, carries out the concrete work corresponding with this message in the timer interrupt handling routine;
Common message processing module 1014 is directly carried out the concrete work of this message correspondence.
Can also store the function corresponding in the storage unit 103, the related work content of the corresponding message of encapsulation in each function with different types of messages;
Interruption processing module 1013 can also comprise:
Matched sub-block 10131 matches the respective function of current message;
Transmit submodule 10132, the respective function address information is passed to the timer interrupt handling routine of storage in the storage unit 103;
Interrupt submodule 10133, start timer, after timer interrupts producing, carry out the timer interrupt handling routine,, finish the concrete work of message correspondence according to function address information and executing respective function.
In sum, adopt the present invention, after task receives message, whether the message of judging current reception needs timely processing, in time handles if desired, then starts timer, after interrupting producing, timer carries out the timer interrupt handling routine, in the timer interrupt handling routine, carry out the concrete work corresponding with this message, after the concrete work corresponding with message is finished, the automatic timeing closing device of timer interrupt handling routine.Because in a single day the timer interrupt handling routine is performed, and will be finished, the centre can not interrupted, so interrupt handling routine can guarantee the execution time of message.When a task comprises a plurality of message,, then just can guarantee the whole task executions time if each message all adopts method of the present invention in time to handle.If in the task only some message need guarantee its execution time, then this type message sets is in time handled for needing, the concrete operations of being carried out this type message correspondence by the interrupt handling routine of timer get final product.Like this, adopt the inventive method, make task itself possess the characteristic of certain interrupt routine, not only can guarantee the execution time of a certain section work in whole task or the task, and task or corresponding moral conduct complete after, the automatic timeing closing device of interrupt routine has been avoided timer owing to periodically start the problem that useless interruption causes system resource waste that produces.
Obviously, those skilled in the art can carry out various changes and modification to the present invention and not break away from the spirit and scope of the present invention.Like this, if of the present invention these are revised and modification belongs within the scope of claim of the present invention and equivalent technologies thereof, then the present invention also is intended to comprise these changes and modification interior.

Claims (7)

1, the timely disposal route of a kind of message is applied to embedded multiple task operating system, it is characterized in that, comprising: preestablish the type of message that needs are in time handled in system;
After task receives message, judge according to type of message whether needs are in time handled for the message of current reception, in time handle if desired, then start timer; After timer interrupts producing, in the timer interrupt handling routine, carry out the concrete operations corresponding, and after described concrete operations are finished, close described timer automatically by described timer interrupt handling routine with this message;
Do not need timely processing if judge the message of current reception, then carry out conventional Message Processing flow process.
2, the method for claim 1 is characterized in that, the associative operation that different types of messages need be carried out is packaged into respective function in advance, is stored in the system; Need in time to handle if judge the message of current reception, carry out the following step:
Match the respective function of current message, the address information of respective function is passed to described timer interrupt handling routine;
Start described timer, after timer interrupts producing, according to the described respective function of described function address information and executing, finish the concrete operations relevant with current message by the timer interrupt handling routine.
3, the method for claim 1 is characterized in that, the time interval of described timer can be provided with.
4, method as claimed in claim 3 is characterized in that, preestablishes the priority that needs the different types of messages in time handled, and the time interval of the setting timer corresponding with different priorities;
When the message of judging current reception needs in time to handle, determine its corresponding priorities according to type of message, the priority time corresponding that the time interval of described timer is set to and determines back at interval starts described timer.
5, method as claimed in claim 4 is characterized in that, after current Message Processing finished, described task waited for that receiving next message handles, and finishes up to task.
6, a kind of embedded multiple task operating system comprises several task executing units, timer and storage unit, it is characterized in that, each task executing units comprises:
The message sink module receives and sends to the message of this task, and is transmitted to the message judge module;
The message judge module is used to judge whether the message of current reception needs timely processing, in time handles if desired, then sends message to interruption processing module; Otherwise, send a message to the common message processing module;
Interruption processing module is used to start timer, and after timer interrupts producing, starts the timer interrupt handling routine that is stored in the described storage unit, carries out the concrete operations relevant with this message in the timer interrupt handling routine;
The common message processing module is carried out conventional Message Processing flow process.
7, embedded multiple task operating system as claimed in claim 6, it is characterized in that, also store the function corresponding in the described storage unit with different types of messages, the associative operation that the corresponding message of encapsulation need be carried out in each function, described interruption processing module comprises:
Matched sub-block matches the respective function of current message;
Transmit submodule, the address information of respective function is passed to the timer interrupt handling routine of storing in the described storage unit;
Interrupt submodule, start timer, after timer interrupts producing, carry out the timer interrupt handling routine,, finish the relevant concrete operations of current message according to described function address information and executing respective function.
CNB2006101147530A 2006-11-22 2006-11-22 A time processing method of message and embedded multiple task operating system Expired - Fee Related CN100426240C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2006101147530A CN100426240C (en) 2006-11-22 2006-11-22 A time processing method of message and embedded multiple task operating system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2006101147530A CN100426240C (en) 2006-11-22 2006-11-22 A time processing method of message and embedded multiple task operating system

Publications (2)

Publication Number Publication Date
CN1952899A CN1952899A (en) 2007-04-25
CN100426240C true CN100426240C (en) 2008-10-15

Family

ID=38059252

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2006101147530A Expired - Fee Related CN100426240C (en) 2006-11-22 2006-11-22 A time processing method of message and embedded multiple task operating system

Country Status (1)

Country Link
CN (1) CN100426240C (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102156662A (en) * 2011-02-14 2011-08-17 大唐移动通信设备有限公司 Method and equipment for processing data
GB2514126A (en) * 2013-05-14 2014-11-19 Ibm Interruption of chip component managing tasks
CN105718326B (en) * 2016-01-27 2018-12-11 惠州市德赛西威汽车电子股份有限公司 The restorability test method of embedded system
CN105718375B (en) * 2016-01-27 2018-09-25 惠州市德赛西威汽车电子股份有限公司 The restorability measure of embedded system
CN112199170A (en) * 2020-09-07 2021-01-08 广州致远电子有限公司 Timing processing method, device and equipment of real-time operating system and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1441570A (en) * 2002-02-28 2003-09-10 深圳市中兴通讯股份有限公司上海第二研究所 Timing method of timer in embedded real-time operation system
US20030172221A1 (en) * 2002-03-01 2003-09-11 Mcneil Donald H. Ultra-modular processor in lattice topology
JP2005250949A (en) * 2004-03-05 2005-09-15 Sony Corp Information processor and its virtual input method
CN1755614A (en) * 2004-09-29 2006-04-05 华为技术有限公司 Timer realizing method
CN1828481A (en) * 2006-03-10 2006-09-06 浙江大学 Energy-saving switching method for waiting overtime judge of flush type system outer apparatus

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1441570A (en) * 2002-02-28 2003-09-10 深圳市中兴通讯股份有限公司上海第二研究所 Timing method of timer in embedded real-time operation system
US20030172221A1 (en) * 2002-03-01 2003-09-11 Mcneil Donald H. Ultra-modular processor in lattice topology
JP2005250949A (en) * 2004-03-05 2005-09-15 Sony Corp Information processor and its virtual input method
CN1755614A (en) * 2004-09-29 2006-04-05 华为技术有限公司 Timer realizing method
CN1828481A (en) * 2006-03-10 2006-09-06 浙江大学 Energy-saving switching method for waiting overtime judge of flush type system outer apparatus

Also Published As

Publication number Publication date
CN1952899A (en) 2007-04-25

Similar Documents

Publication Publication Date Title
CN100426240C (en) A time processing method of message and embedded multiple task operating system
CN101266553B (en) Multitask management process based on embedded system
CN100488265C (en) Concurrent method for treating calling events
CN106293919A (en) The built-in tasks dispatching device of a kind of Time Triggered and method
CN103092682A (en) Asynchronous network application program processing method
CN102073572B (en) For method for supervising and the system of polycaryon processor
CN104536835B (en) Self-adapting task scheduling method in a kind of Hot Spare real-time control system
CN109558227B (en) Monotonic rate task scheduling method based on task execution budget
CN102025562A (en) Path detection method and device
CN102096603A (en) Task decomposition control method in MapReduce system and scheduling node equipment
CN102455940A (en) Processing method and system of timers and asynchronous events
WO1999014915A8 (en) Process scheduling in computer network
CN102110022A (en) Sensor network embedded operation system based on priority scheduling
CN105204857A (en) Design method of embedded control system capable of accurately scheduling a plurality of time slices based on polling mode
CN101398772A (en) Network data interrupt treating method and device
CN100501682C (en) synchronous prosecution method for digital family network multiple-task synchronous prosecution device
CN101841476A (en) Message processing method, device and network equipment
CN101695045A (en) Method and device for realizing Ethernet messaging
CN108509257B (en) Message processing method and device based on multithreading
CN103034480A (en) Embedded system timer realizing method
CN112068940A (en) Real-time task scheduling method, device, scheduling system and storage medium
CN102129475A (en) Conflict avoidance method and system for solving limited system resources
CN101917687A (en) Message sending method and message centre
CN102573073A (en) Resource allocation method and system for physical layer of terminal
CN101976206A (en) Interrupt handling method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C17 Cessation of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20081015

Termination date: 20121122