CN102541642A - Task management method for enhancing real-time performance - Google Patents
Task management method for enhancing real-time performance Download PDFInfo
- Publication number
- CN102541642A CN102541642A CN2011104504329A CN201110450432A CN102541642A CN 102541642 A CN102541642 A CN 102541642A CN 2011104504329 A CN2011104504329 A CN 2011104504329A CN 201110450432 A CN201110450432 A CN 201110450432A CN 102541642 A CN102541642 A CN 102541642A
- Authority
- CN
- China
- Prior art keywords
- task
- queue
- real
- rtems
- priority
- 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
Links
Images
Abstract
A task management method for enhancing real-time performance of a RTEMS (real-time executive for multiprocessor system) includes steps: A, scheduling a certain task by sending semaphore; B, setting up a co-task prior task ready queue, arranging a task to the co-task prior task ready queue if the task is supposed to be put into the ready array according to the state value of the semaphore of the task, and otherwise, forcedly occupying processor resources and performing the task; C, occupying the threshold of an appointed priority level of the task and judging whether the task is allowed to be occupied or not according to the threshold; D, when the task is added to the co-task prior task ready queue, judging the priority level of the task according to the semaphore of the task and the occupied threshold, and positioning an insertion position in the co-task prior task ready queue to form an ordered task block array.
Description
Technical field
The present invention relates to real-time system operating system nucleus design field, be specifically related to a kind of task management method that in the RTEMS real time operating system, strengthens real-time performance.
Background technology
The demand of As real-time system is more and more, and scale is increasing, and traditional small-scale SCM system can not satisfy the needs towards extensive real-time control system.Real-time system is when the scale change is big; Also there are a lot of design factors and real-time, time determinacy to produce contradiction; Must on the basis of existing real time operating system, make more optimization; Could let the more stable of total system, have stronger time determinacy, let application developer have greater flexibility.
RTEMS is as a kind of real time operating system of increasing income, and the advantage of itself is a lot, if but be applied in the real-time system of High Accuracy Control, also have many shortcomings at present.Mainly show following some: 1. task scheduling adopts the mode based on priority scheduling, as long as high-priority task is in ready attitude, the task of low priority is just seized at once.2. when the task scale was bigger, in the time of resource of multitask contention, the time delay fluctuation was bigger, can't satisfy deterministic demand of hard real-time system time.As the task of All factors being equal, preference will be give to level ready after, the dispatching algorithm that can adopt timeslice disorderly to change is dispatched.And the operation order of uncontrollable All factors being equal, preference will be give to level task.4. the design of dispatching algorithm is more single, if trigger the operation of certain task according to semaphore, needs to carry out a series of system call, and is more consuming time, and can't execute appointed task.
Summary of the invention
In view of the defective in the existing RTEMS real time operating system, the object of the present invention is to provide a kind of task management method that in the RTEMS real time operating system, strengthens real-time performance, it is characterized in that comprising the steps:
A, dispatch some tasks through the mode of sending semaphore, the mode of scheduling has two kinds: a kind of is that this task is put into ready queue, and wait is scheduled; Another kind is to execute this task;
B, said ready queue are set to the same priority task queue, if confirm that according to the state value of the semaphore of said a certain task it should be placed into ready queue, then should said a certain task be discharged to the same priority task queue; Otherwise then force to seize processor resource and carry out this task;
C, seize threshold values for said a certain task assigned priority; Priority surpasses this task of seizing threshold values and can seize said a certain task; Priority then is not allowed to seize this said a certain task less than this task of seizing threshold values; System dispatches before the calculating, seizes threshold values through comparison, and the task that determines whether to carry out is switched;
D, when said a certain task is added in the said same priority task queue; According to its semaphore and seize threshold values and judge priority level under it; And in said same priority task queue, locate the insertion position, block formation thereby form an orderly task.
Further; The task management method that in the RTEMS real time operating system, strengthens real-time performance of the present invention; It is characterized in that in said step B definition same priority task queue secondary data structure is counted the task in the same priority task queue; And when system changes task status and task priority, according to this secondary data structure carry out ready queue task oneself increase or from reducing.
Further, the task management method that in the RTEMS real time operating system, strengthens real-time performance of the present invention is characterized in that in said step B, the optional position that can add said a certain task to the same priority task queue through system call.
Further; The task management method that in the RTEMS real time operating system, strengthens real-time performance of the present invention, the said system call that it is characterized in that comprises to the operation of same priority task queue: the successor node that current task is moved to appointed task ID; Perhaps current task is moved to any appointment node.
Further, the task management method that in the RTEMS real time operating system, strengthens real-time performance of the present invention is characterized in that in said step C, can change through system call and seize threshold values.
Further, the task management method that in the RTEMS real time operating system, strengthens real-time performance of the present invention is characterized in that in said step D, and the location new task adopts the supplementary structure of multilinked list to realize location fast in the same priority task queue.
The task management method that in the RTEMS real time operating system, strengthens real-time performance of the present invention is through a series of task management operation; The real-time of raising system; The time determinacy of increase system, minimizing system occur the situation that real-time performance fluctuates widely greatly becoming along with the task scale.
Description of drawings
Fig. 1 is the present invention strengthens the task management method of real-time performance in the RTEMS real time operating system a process flow diagram.
Embodiment
For making above-mentioned purpose of the present invention, feature and advantage more obviously understandable, the present invention is done further detailed explanation below in conjunction with accompanying drawing and embodiment.
Fig. 1 is the present invention strengthens the task management method of real-time performance in the RTEMS real time operating system a process flow diagram, comprises the steps:
A, dispatch some tasks through the mode of sending semaphore, the mode of scheduling has two kinds: a kind of is that this task is put into ready queue, and wait is scheduled; Another kind is to execute this task;
Steps A modelled signal amount triggers task scheduling mechanism, in RTEMS operating system, realizes as follows:
(1) two kinds of operational codes of definition signal amount response.
In RTEMS 4.9.0 sound code file; Be specifically designed among the file options.h of define operation code global variable; Option_set adds task operating status word sign respectively for the operational code set: RTEMS_PREEMPT_ready and RTEMS_FORCE, correspondence directly gets into ready queue and directly seizes two kinds of operational codes.
(2) realize that semaphore triggers task scheduling.
In obtaining the processing function of semaphore, wherein there are two to import parameter into, one is option_set, another is an object ID; The parameter of expression signal amount operation and the ID of semaphore in the RTEMS system.In the method, as judging the condition and the task ID (object ID is general among the RTEMS) of whether dispatching.In function body; Judge that according to the value of importing parameter option_set into statement is provided with function flow process branch: if import parameter value into is RTEMS_PREEMPT_ready; The task change state that imports into as object ID is a ready state; Task is placed in the ready queue, and next system judges whether that the task of being higher than current priority is in ready state, determines whether can be necessary to seize; If import parameter value into is RTEMS_FORCE, and the priority of importing into as object ID of task is set to the highest, and the compulsory execution task is switched.
B, said ready queue are set to the same priority task queue, if confirm that according to the state value of the semaphore of said a certain task it should be placed into ready queue, so just should said a certain task be discharged to the same priority task queue; Otherwise then force to seize processor resource and carry out this task;
The operation of step B same priority task ready queue, realize with following steps in RTEMS operating system:
(1) definition same priority task ready queue secondary data structure; Task in the same priority task queue is counted; And when system changed task status and changes task priority, the task of carrying out ready queue according to this secondary data structure was from increasing or from reducing.
In RTEMS 4.9.0 sound code file thread.h file, add ready_number in the definition of T hread_Control_struct structure of task control block structure, the number of the task among sign All factors being equal, preference will be give to the level formation * ready.
(2) to the operation of secondary data structure
At the task initialization function ready_number is initially 0; Remove in the ready power function _ Thread_Ready of task (), task arousal function function _ Thread_Resume () and task status and to realize among power function _ Thread_Clear_state () that ready_number does oneself and increases operation, at task suspension power function _ Threadre_Suspend () and the interim state of task power function _ Thread_Set_transient () is set and does from reducing.
When system changes task status and changes task priority; Directly carry out the operation of the task deletion of ready queue according to the value of ready_number; If this value is zero; The proof current priority does not have ready task, the task of being needs acquisition processor resource that global variable _ Thread_Heir points to; If this value greater than zero, is not then carried out task and switched, the member ready->next of current task control is the task of needing to obtain processor resource.
(3) increase the optional position that the system call realization is added current task to * ready formation.
It is to * ready queue operation that native system calls.Mode has two kinds, first kind of successor node that current task is moved to appointed task ID; Second kind is that which node is current task moved to.The optional position that can add said a certain task to the same priority task queue through system call.
C, seize threshold values for said a certain task assigned priority; Priority surpasses this task of seizing threshold values and can seize said a certain task; Priority then is not allowed to seize this said a certain task less than this task of seizing threshold values; System dispatches before the calculating, seizes threshold values through comparison, and the task that determines whether to carry out is switched;
Step C is provided with and seizes threshold values, in RTEMS operating system, realizes with following steps:
(1) the threshold values data field is seized in definition.
In RTEMS 4.9.0 sound code file thread.h file, add door in the substantial definition Thread_Control_struct structure of task control block (TCB) structure, identify the threshold values of seizing of current task.And in the task initialization function, be initialized as 255.
(2) upgrade task initialization the time and seize the threshold values data field.
Parameter need increase and imports parameter into during the function system of creation task called, and the task preemption threshold values is set to the parameter designated value.Can change through system call and to seize threshold values.
(3) realization is to the function of shielding of task preemption
When judging whether task is switched, relatively whether current task, is then carried out task and is switched if set up greater than seizing threshold values; If be false, then do not carry out task and switch.
D, when said a certain task is added in the said same priority task queue; According to its semaphore and seize threshold values and judge priority level under it; And in said same priority task queue, locate the insertion position, block formation thereby form an orderly task.
Step D realizes the anti-shake algorithm design of multitask contention resource, in the same priority task queue, adopts the supplementary structure of multilinked list to realize location new task fast.In RTEMS operating system, realize with following steps:
(1) task priority is divided into 16 grades
System is divided into 16 grades with 256 task priorities, if task is the contender of resource, then system can be linked to it in the corresponding grade according to the magnitude relationship of priority.
(2) 16 grade tasks of system assignment secondary data structure management
16 linked list heads of Task Distribution, the data division of each chained list node is the priority of each node.
(3) operation of task application resource agreement
When task application resource was blocked, according to the priority and 16 divide operations of task, grade set the tasks.Under confirming after the grade, do the remainder operation operation and confirm that the first half at chained list still is latter half of with 8 again, further confirm to be added on the particular location that blocks chained list according to the mode of inquiry.
In the multitask applied environment, not use in the RTEMS of the present invention system, the task of a plurality of All factors being equal, preference will be give to levels is all ready, and system can only be according to dispatching when front sequence, and its sequencing is out of contior; When high-priority task was ready, system can seize at once; If the same resource of multitask application, system will travel through 32 nodes under worst case.
After having used system of the present invention, a plurality of All factors being equal, preference will be give to the level task ready, the application developer can be placed into the optional position of ready queue with task through system call, thereby dispatches with any specified order; If there is high-priority task ready, system only can seize when this task is seized threshold values greater than it; If the same resource of multitask application, system will travel through 8 nodes under worst case.
Through above statement, the present invention passes through real-time system dispatching method more flexibly, has improved the real-time of system.
Should be noted that at last: above embodiment is only in order to technical scheme of the present invention to be described but not to its restriction; Although with reference to preferred embodiment the present invention has been carried out detailed explanation, the those of ordinary skill in affiliated field is to be understood that: still can specific embodiments of the invention make amendment or the part technical characterictic is equal to replacement; And not breaking away from the spirit of technical scheme of the present invention, it all should be encompassed in the middle of the technical scheme scope that the present invention asks for protection.
Claims (6)
1. a task management method that in the RTEMS real time operating system, strengthens real-time performance is characterized in that comprising the steps:
A, dispatch some tasks through the mode of sending semaphore, the mode of scheduling has two kinds: a kind of is that this task is put into ready queue, and wait is scheduled; Another kind is to execute this task;
B, said ready queue are set to the same priority task queue, if confirm that according to the state value of the semaphore of said a certain task it should be placed into ready queue, then is discharged to the same priority task queue with this task; Otherwise then force to seize processor resource and carry out this task;
C, seize threshold values for said a certain task assigned priority; Priority surpasses this task of seizing threshold values and can seize said a certain task; Priority then is not allowed to seize this said a certain task less than this task of seizing threshold values; System dispatches before the calculating, seizes threshold values through comparison, and the task that determines whether to carry out is switched;
D, when said a certain task is added in the said same priority task queue; According to its semaphore and seize threshold values and judge priority level under it; And in said same priority task queue, locate the insertion position, block formation thereby form an orderly task.
2. the task management method that in the RTEMS real time operating system, strengthens real-time performance according to claim 1; It is characterized in that in said step B; Definition same priority task queue secondary data structure; Task in the same priority task queue is counted, and when changing task status with task priority in system, according to this secondary data structure carry out ready queue task oneself increase or from reducing.
3. the task management method that in the RTEMS real time operating system, strengthens real-time performance according to claim 1 is characterized in that in said step B, the optional position of adding said a certain task to the same priority task queue through system call.
4. the task management method that in the RTEMS real time operating system, strengthens real-time performance according to claim 3, the said system call that it is characterized in that comprises to the operation of same priority task queue: the successor node that current task is moved to appointed task ID; Perhaps current task is moved to any appointment node.
5. the task management method that in the RTEMS real time operating system, strengthens real-time performance according to claim 1 is characterized in that in said step C, can change through system call and seize threshold values.
6. the task management method that in the RTEMS real time operating system, strengthens real-time performance according to claim 1 is characterized in that in said step D, in the same priority task queue, adopts the supplementary structure of multilinked list to realize location new task fast.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN 201110450432 CN102541642B (en) | 2011-12-30 | 2011-12-30 | Task management method for enhancing real-time performance |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN 201110450432 CN102541642B (en) | 2011-12-30 | 2011-12-30 | Task management method for enhancing real-time performance |
Publications (2)
Publication Number | Publication Date |
---|---|
CN102541642A true CN102541642A (en) | 2012-07-04 |
CN102541642B CN102541642B (en) | 2013-12-18 |
Family
ID=46348598
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN 201110450432 Expired - Fee Related CN102541642B (en) | 2011-12-30 | 2011-12-30 | Task management method for enhancing real-time performance |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102541642B (en) |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103885427A (en) * | 2014-03-31 | 2014-06-25 | 珠海万力达电气股份有限公司 | Embedded type microcomputer protection method based on RTEMS operation system |
CN104035818A (en) * | 2013-03-04 | 2014-09-10 | 腾讯科技(深圳)有限公司 | Multiple-task scheduling method and device |
WO2015081502A1 (en) * | 2013-12-03 | 2015-06-11 | 北京东土科技股份有限公司 | Network service flow-based dynamic control transmission method and apparatus |
CN104794077A (en) * | 2015-04-07 | 2015-07-22 | 无锡天脉聚源传媒科技有限公司 | Link list storage method and system |
CN105022668A (en) * | 2015-04-29 | 2015-11-04 | 腾讯科技(深圳)有限公司 | Job scheduling method and system |
CN106201695A (en) * | 2016-07-15 | 2016-12-07 | 郑州飞机装备有限责任公司 | It is applicable to the multi-task scheduling method of embedded software system |
CN110231993A (en) * | 2019-06-19 | 2019-09-13 | 爱驰汽车有限公司 | Battery management method, device, electronic equipment, storage medium |
CN111506397A (en) * | 2020-01-21 | 2020-08-07 | 广东工业大学 | Monotonic rate priority scheduling method based on linux real-time operating system |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2002025439A1 (en) * | 2000-09-22 | 2002-03-28 | Sony Corporation | Arithmetic processing system and arithmetic processing control method, task managemnt system and task management method, and storage medium |
US6912712B1 (en) * | 1999-10-11 | 2005-06-28 | Samsung Electronics Co., Ltd. | Real time control system for multitasking digital signal processor using ready queue |
CN101290585A (en) * | 2007-04-19 | 2008-10-22 | 中兴通讯股份有限公司 | Embedded system real time task scheduling method |
CN101290588A (en) * | 2008-03-07 | 2008-10-22 | 重庆邮电大学 | Micro-embedded real time task scheduling device and scheduling method |
-
2011
- 2011-12-30 CN CN 201110450432 patent/CN102541642B/en not_active Expired - Fee Related
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6912712B1 (en) * | 1999-10-11 | 2005-06-28 | Samsung Electronics Co., Ltd. | Real time control system for multitasking digital signal processor using ready queue |
WO2002025439A1 (en) * | 2000-09-22 | 2002-03-28 | Sony Corporation | Arithmetic processing system and arithmetic processing control method, task managemnt system and task management method, and storage medium |
CN101290585A (en) * | 2007-04-19 | 2008-10-22 | 中兴通讯股份有限公司 | Embedded system real time task scheduling method |
CN101290588A (en) * | 2008-03-07 | 2008-10-22 | 重庆邮电大学 | Micro-embedded real time task scheduling device and scheduling method |
Cited By (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104035818A (en) * | 2013-03-04 | 2014-09-10 | 腾讯科技(深圳)有限公司 | Multiple-task scheduling method and device |
WO2015081502A1 (en) * | 2013-12-03 | 2015-06-11 | 北京东土科技股份有限公司 | Network service flow-based dynamic control transmission method and apparatus |
CN103885427A (en) * | 2014-03-31 | 2014-06-25 | 珠海万力达电气股份有限公司 | Embedded type microcomputer protection method based on RTEMS operation system |
CN103885427B (en) * | 2014-03-31 | 2016-03-16 | 珠海万力达电气自动化有限公司 | A kind of embedded computer guard method based on RTEMS operating system |
CN104794077A (en) * | 2015-04-07 | 2015-07-22 | 无锡天脉聚源传媒科技有限公司 | Link list storage method and system |
CN105022668A (en) * | 2015-04-29 | 2015-11-04 | 腾讯科技(深圳)有限公司 | Job scheduling method and system |
CN105022668B (en) * | 2015-04-29 | 2020-11-06 | 腾讯科技(深圳)有限公司 | Job scheduling method and system |
CN106201695A (en) * | 2016-07-15 | 2016-12-07 | 郑州飞机装备有限责任公司 | It is applicable to the multi-task scheduling method of embedded software system |
CN110231993A (en) * | 2019-06-19 | 2019-09-13 | 爱驰汽车有限公司 | Battery management method, device, electronic equipment, storage medium |
CN111506397A (en) * | 2020-01-21 | 2020-08-07 | 广东工业大学 | Monotonic rate priority scheduling method based on linux real-time operating system |
CN111506397B (en) * | 2020-01-21 | 2023-04-28 | 广东工业大学 | Monotonic rate priority scheduling method based on linux real-time operating system |
Also Published As
Publication number | Publication date |
---|---|
CN102541642B (en) | 2013-12-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102541642B (en) | Task management method for enhancing real-time performance | |
CN106802826B (en) | Service processing method and device based on thread pool | |
Van Tilborg et al. | Foundations of real-time computing: Scheduling and resource management | |
Ramos-Thuel et al. | On-line scheduling of hard deadline aperiodic tasks in fixed-priority systems | |
Saksena et al. | Scalable real-time system design using preemption thresholds | |
US7451447B1 (en) | Method, computer program and apparatus for operating system dynamic event management and task scheduling using function calls | |
EP3008594B1 (en) | Assigning and scheduling threads for multiple prioritized queues | |
CN103778016B (en) | Multiline procedure processor | |
CN110096353B (en) | Task scheduling method and device | |
CN101258469B (en) | Information processing device | |
CN109684060B (en) | Mixed scheduling method for multiple types of time-critical tasks | |
CN105373425A (en) | Method and device for performance optimization of embedded Linux system | |
US20050066149A1 (en) | Method and system for multithreaded processing using errands | |
Omar et al. | Comparative analysis of the essential CPU scheduling algorithms | |
CN111597044A (en) | Task scheduling method and device, storage medium and electronic equipment | |
CN109669767B (en) | Task packaging and scheduling method and system for multi-type context dependence | |
Casini et al. | Addressing analysis and partitioning issues for the Waters 2019 challenge | |
Marau et al. | Performing flexible control on low-cost microcontrollers using a minimal real-time kernel | |
Horowitz | A run-time execution model for referential integrity maintenance | |
KR100981017B1 (en) | Method for re-defining priority and managing ready queue in system having static task define function and system for executing the method | |
Garg | Real-time linux kernel scheduler | |
CN107480071B (en) | Cache data migration method and device | |
CN113225269B (en) | Container-based workflow scheduling method, device and system and storage medium | |
Zouaoui et al. | CPU scheduling algorithms: Case & comparative study | |
Wellings et al. | Asynchronous event handling and real-time threads in the real-time specification for Java |
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 | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20131218 Termination date: 20181230 |
|
CF01 | Termination of patent right due to non-payment of annual fee |