CN102023895A - Singlechip programming method with priority task switching - Google Patents

Singlechip programming method with priority task switching Download PDF

Info

Publication number
CN102023895A
CN102023895A CN2010105713153A CN201010571315A CN102023895A CN 102023895 A CN102023895 A CN 102023895A CN 2010105713153 A CN2010105713153 A CN 2010105713153A CN 201010571315 A CN201010571315 A CN 201010571315A CN 102023895 A CN102023895 A CN 102023895A
Authority
CN
China
Prior art keywords
task
priority
tasks
query
programming method
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN2010105713153A
Other languages
Chinese (zh)
Inventor
雷刚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Yada Electric Co Ltd
Original Assignee
Guangdong Yada Electric Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Yada Electric Co Ltd filed Critical Guangdong Yada Electric Co Ltd
Priority to CN2010105713153A priority Critical patent/CN102023895A/en
Publication of CN102023895A publication Critical patent/CN102023895A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to a singlechip programming method with priority task switching, comprising the following steps: (1) each task in a system is set into the task with a corresponding unique priority, and all tasks in the system act on one stack jointly; (2) all the tasks in the system are stored in a task priority queue; (3) the task priority queue is inquired, the task with the highest priority in the task priority queue is chosen to be executed; (4) after the current task is executed, the tasks in the task priority queue are re-inquired, and the task with the highest priority is executed; and (5) the execution of the current task can not be interrupted by the task with higher priority in the task execution process. According to the invention, the response time of the task with the highest priority is improved, the system is simple, and less resource is occupied.

Description

A kind of mcu programming method with priority tasks switching
Technical field
The present invention relates to a kind of programmed method of single-chip microcomputer, relate in particular to a kind of mcu programming method that priority tasks is switched that has.
Background technology
The programming mode of single-chip microcomputer mainly is single task process operation and real-time multi-task operating system at present.All tasks all are the pipeline system operations in the single task process operation system, and all tasks all are same priority, will produce time-delay to hot job, owing to do not switch between the task, total system only needs a storehouse; All tasks all are that the limit priority mode is operated in the real-time multi-task operating system, all tasks all have different priority, task in the process of implementation, if there is the higher priority task to take place, the higher priority task will be seized execution, because between the task switching is arranged, each task all has an independently storehouse, causes system complex and take resource many.
Summary of the invention
The technical problem to be solved in the present invention provides a kind of response time of improving high-priority task, and system is simple, takies the few mcu programming method with priority tasks switching of resource.
In order to solve the problems of the technologies described above, the present invention takes following technical scheme:
A kind of mcu programming method with priority tasks switching may further comprise the steps:
(1) each task in the system all is arranged to have corresponding unique priority, and all tasks in the system makes storehouse of effect jointly;
(2) all tasks in the system are all left in the task priority formation;
(3) query task priority query selects the limit priority task in the task priority formation to carry out;
(4) current task complete after, the task in the query task priority query again, and the limit priority task carried out.
(5) in the task implementation, the higher priority task can not be interrupted existing task execution.
The priority of each task is maintained fixed in the described step (2).
In the process that described step (3) is executed the task, being in the priority query of task all keeps waiting status.
The present invention is by being arranged to all tasks a shared storehouse, and being in system's operational process in the task queue of task all keeps original task priority, system is oversimplified, and in the process of executing the task, the task of other higher priority keeps waiting status can not seize execution, and it is few to take resource.
Embodiment
For the ease of those skilled in the art's understanding, the invention will be further described below in conjunction with specific embodiment.
A kind of mcu programming method with priority tasks switching may further comprise the steps:
(1) each task in the system all is arranged to have corresponding unique priority, and all tasks in the system makes storehouse of effect jointly;
(2) all tasks in the system are all left in the task priority formation;
(3) query task priority query selects the limit priority task in the task priority formation to carry out;
(4) current task complete after, the task in the query task priority query again, and the limit priority task carried out.
Wherein, the priority of each task is maintained fixed constantly in the step (2), can not revise the original priority of each task, and in the process that step (3) is executed the task, being in the priority query of task all keeps waiting status, all can not seize execution.All tasks are all waken up by incident or clock source.
During concrete the execution, task priority is listed as follows:
?Bit0 Bit1 ?Bit2 。。。
Task names Task A Task B Task C 。。
Priority level 0 1 2 。。
Ready status word 0 1 0 。。
The more little expression priority of priority level data is high more.During beginning, all have task all to leave in the task priority team in the system, because storehouse of the common use of all tasks, therefore, system is simpler, at first selects the highest task of priority level to carry out when executing the task, and other tasks are maintained fixed constant, and in the process of executing the task, other tasks can not be seized execution.After current task was complete, by query task formation again, the limit priority task was carried out in the selection task queue.When ready status word is 1, represent that this task dispatching is pending, after task is complete, remove corresponding ready status word.

Claims (3)

1. one kind has the mcu programming method that priority tasks is switched, and may further comprise the steps:
(1) each task in the system all is arranged to have corresponding unique priority, and all tasks in the system makes storehouse of effect jointly;
(2) all tasks in the system are all left in the task priority formation;
(3) query task priority query selects the limit priority task in the task priority formation to carry out;
(4) current task complete after, the task in the query task priority query again, and the limit priority task carried out;
(5) in the task implementation, the higher priority task can not be interrupted existing task execution.
2. the mcu programming method with priority tasks switching according to claim 1, it is characterized in that: the priority of each task is maintained fixed in the described step (2).
3. the mcu programming method with priority tasks switching according to claim 2, it is characterized in that: in the process that described step (3) is executed the task, being in the priority query of task all keeps waiting status.
CN2010105713153A 2010-11-25 2010-11-25 Singlechip programming method with priority task switching Pending CN102023895A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2010105713153A CN102023895A (en) 2010-11-25 2010-11-25 Singlechip programming method with priority task switching

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2010105713153A CN102023895A (en) 2010-11-25 2010-11-25 Singlechip programming method with priority task switching

Publications (1)

Publication Number Publication Date
CN102023895A true CN102023895A (en) 2011-04-20

Family

ID=43865217

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2010105713153A Pending CN102023895A (en) 2010-11-25 2010-11-25 Singlechip programming method with priority task switching

Country Status (1)

Country Link
CN (1) CN102023895A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105786605A (en) * 2016-03-02 2016-07-20 中国科学院自动化研究所 Task management method and system in robot
CN108255589A (en) * 2017-08-29 2018-07-06 平安科技(深圳)有限公司 Method for scheduling task and server
CN109308212A (en) * 2017-07-26 2019-02-05 上海华为技术有限公司 A kind of task processing method, task processor and task processing equipment
CN112318484A (en) * 2020-12-15 2021-02-05 苏州光格设备有限公司 Task scheduling method for track inspection robot

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101290509A (en) * 2007-04-19 2008-10-22 中兴通讯股份有限公司 Embedded system low-power consumption real time task scheduling method

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101290509A (en) * 2007-04-19 2008-10-22 中兴通讯股份有限公司 Embedded system low-power consumption real time task scheduling method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王保进; 李明树; 王志刚: "Alpha OSEK:一个基于OSEK/VDX标准实现的嵌入式实时操作系统", 《计算机工程与应用》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105786605A (en) * 2016-03-02 2016-07-20 中国科学院自动化研究所 Task management method and system in robot
CN109308212A (en) * 2017-07-26 2019-02-05 上海华为技术有限公司 A kind of task processing method, task processor and task processing equipment
CN108255589A (en) * 2017-08-29 2018-07-06 平安科技(深圳)有限公司 Method for scheduling task and server
CN112318484A (en) * 2020-12-15 2021-02-05 苏州光格设备有限公司 Task scheduling method for track inspection robot

Similar Documents

Publication Publication Date Title
US9880875B2 (en) Apparatus and method for hardware-based task scheduling
CN104915256B (en) A kind of the Real-Time Scheduling implementation method and its system of task
CN104536827B (en) A kind of data dispatching method and device
CN101719080B (en) Multi-core timer implementing method and system
CN103679388B (en) Production scheduling method and production scheduling system
CN102043675A (en) Thread pool management method based on task quantity of task processing request
CN102023895A (en) Singlechip programming method with priority task switching
WO2018126771A1 (en) Storage controller and io request processing method
CN102222022A (en) Real-time task scheduling method based on multicore processor
CN110221907B (en) Real-time task scheduling method based on EDF algorithm and fuzzy set
CN109739332B (en) Multi-task general energy consumption optimization method
CN103823719A (en) Distributed cloud computing system and distributed cloud computing method for executable program
CN102855156A (en) Interrupt controller and interrupt controlling method
CN101290591B (en) Embedded operating system task switching method and unit
CN104461471A (en) Unified instruction scheduling and register allocating method on clustering VLIW processor
CN104572279A (en) Node binding-supporting virtual machine dynamic scheduling method
CN105629873A (en) Hybrid task scheduling method suitable for numerical control system
CN103309734A (en) Embedded task scheduling method based on priority grouping
CN108563494A (en) A kind of thread scheduling system and method for adaptive dynamic adjustment
CN103677959B (en) A kind of virtual machine cluster migration method and system based on multicast
CN102141938B (en) Method and device for adjusting software load in multithreaded system
CN106648834B (en) Virtual machine scheduling method based on batch packaging problem
CN103955356B (en) General-purpose register bank distribution method and device in multithreaded processor
CN102004665B (en) Task concurrent processing method in workflow system
CN114896295B (en) Data desensitization method, desensitization device and desensitization system in big data scene

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C12 Rejection of a patent application after its publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20110420