CN1828543A - Real-time task scheduling method in Java operating system - Google Patents

Real-time task scheduling method in Java operating system Download PDF

Info

Publication number
CN1828543A
CN1828543A CN 200610050256 CN200610050256A CN1828543A CN 1828543 A CN1828543 A CN 1828543A CN 200610050256 CN200610050256 CN 200610050256 CN 200610050256 A CN200610050256 A CN 200610050256A CN 1828543 A CN1828543 A CN 1828543A
Authority
CN
China
Prior art keywords
task
tcb
control block
real
time
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
CN 200610050256
Other languages
Chinese (zh)
Other versions
CN100383743C (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.)
Zhejiang University ZJU
Original Assignee
Zhejiang University ZJU
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang University ZJU filed Critical Zhejiang University ZJU
Priority to CNB2006100502569A priority Critical patent/CN100383743C/en
Publication of CN1828543A publication Critical patent/CN1828543A/en
Application granted granted Critical
Publication of CN100383743C publication Critical patent/CN100383743C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

As an important aspect to response to the real-time task in Java OS, the related method can on one hand ensure the execution of every task as different time to give full play to total system efficiency, on the other hand responses in schedule time and processes request of asynchronous event with high reliability. This invention has important meanings to embedded OS.

Description

Real-time task scheduling method in the Java operating system
Technical field
The present invention relates to the real-time task treatment technology, particularly relate to real-time task scheduling method in a kind of Java operating system.
Background technology
The real-time of operating system is a key character of operating system, is that real-time control computer is soft, the core of hardware system.It is born along with the formation of real-time multi-task computer system software, develops along with the raising of Real-time Multi-task System requirement.The real-time multi-task operating system that with the digital machine is the center has been brought into play important role in industry, traffic, the energy, bank, scientific research and every field such as scientific experimentation, national defence.
Real time operating system is an important branch of operating system.It should belong to the research category of operating system.The real time operating system and the general-purpose operating system have common one side, but at aspects such as function, performance, safe and secret and adaptives capacity to environment, also have the one side of its uniqueness.
Real time operating system is meant to have real-time characteristic, can support the operating system of real-time control system work, and it can organically link together the various device in the system and control them and finish set task.
The top priority of real time operating system is to utilize all available resources to finish real-time control task, secondly just is conceived to improve the service efficiency of computer system.
An important feature of real time operating system is exactly restriction and the requirement that will satisfy the time.In real-time system, time is life, and this and the general-purpose operating system have marked difference.
Except that peer machine, real time operating system all is exactly the operating system of multiprogramming.
The real-time digital control system is the main living environment and the working environment of real time operating system, and the various device of real time operating system control real-time system is finished the work jointly.
Real-time control system belongs to the research category of control system.Say that from function control system can be defined as device that energy or other medium flows etc. is regulated.
Real-time control system is a kind of environmental control system that can receive data, processing processing and result in time can be fed back.
Real-time control system is made of following four major parts:
Digital collection.It is used for collection, reception or the necessary information of input system work, or carries out input;
Processing is handled.It processes processing to the information (result who comprises input) of collection, reception or typing, draws the necessary parameter of control system work or makes decision, and exports then, writes down or show;
Operation control.The information (comprising output signal) that it is exported according to the processing treatment facility takes appropriate measures or moves, with the purpose that reaches control or conform;
Feedback processing.The execution result of its implementation and supervision mechanism, and this result is fed to input or data receiver, so that system further takes measures according to feedback, reach the intended purposes of control.
Summary of the invention
The object of the present invention is to provide real-time task scheduling method in a kind of Java operating system.
The technical scheme that the present invention solves its technical matters employing is as follows:
1) Data Structures
1. task identification number
Task identification number is used for the sign task, plays the effect of task name, and its span is that 0~255, two tasks can not have identical non-zero identification number, but identification number is that zero task can have a plurality of only;
2. the state of real-time task
According to the state of task, the state of real-time task is divided into running status, ready state, suspended state, latence;
Running status: task obtains processor, moves;
Ready state: as long as obtain processor, task can be moved;
Suspended state: for a certain reason, also can't continue to carry out even task obtains processor, only remain after this kind reason cancels, task just has the right that obtains processor;
Latence: before the task creation and cancel later state;
3. the priority of real-time task
The main foundation that can the decision task selectedly put into operation when the state of task was scheduling; The precedence that ready task obtains processor is to be stipulated by the priority of task;
4. task control block (TCB)
Task control block (TCB) is the sign of task, and task system is according to task control block (TCB) and the existence of perception task, and the operand of various task call orders is exactly the task control block (TCB) of task;
Task control block (TCB) is the sole entity that the sign task exists, regained the task controls piece of task when task system after, task has just been cancelled, when setting up a new task, task system distributes the task control block (TCB) of a sky for it, and insert the relevant external characteristic information of this task, at this moment task just is present among the system; Task system is dispatched, is controlled and manage for each task, also all is that the task control block (TCB) according to each task carries out;
5. task control block (TCB) formation
By the task executions situation, according to the priority of task task control block (TCB) is organized into three kinds of task control block (TCB) formations: activity queue, ready queue, empty queue;
2) real-time task scheduling step
When the state that task takes place in the system changes, task priority changes, when Java operating system is given task dispatch with CPU control again, the real-time multi-task scheduler just begins the operation dispatching process, put into operation to select a task, step is as follows:
1. close and interrupt, the scanning ready queue;
If 2. ready queue be empty execution in step 3., otherwise execution in step is 6.;
3. the sign that will not have ready task is sent;
4. send the address of current task controll block;
5. system call;
If 6. 7. the current task in the ready queue hangs up execution in step, otherwise execution in step 8.;
7. get the next task controll block in the ready queue, carry out 3., otherwise carry out 6. if arrived formation;
8. current task control block (TCB) is moved to the tail of same priority, close and interrupt recovering on-the-spot;
9. send the address of current task controll block;
10. open interruption, execute the task.
The beneficial effect that the present invention has is: realize that simply system overhead is little, less system response time, the request of response and processing asynchronous event in the response time of regulation, height reliability, system can in time correctly dispose under the abnormal conditions, guarantees to fulfil a task or most important task.Each task of effective task scheduling assurance can both be carried out by its requirement, give full play to the system effectiveness of whole resources, utilizes the existing configuration of system, and the utilization factor of operating-system resources is improved as far as possible, improves operating system efficient.
Description of drawings
The formation of Fig. 1 task control block (TCB);
Fig. 2 is the real-time task scheduling process flow diagram.
Embodiment
When implementing real-time task scheduling, concrete mode is as follows:
1) Data Structures
1. task identification number
Task identification number is used for the sign task, plays the effect of task name, and its span is that 0~255, two tasks can not have identical non-zero identification number, but identification number is that zero task can have a plurality of only;
2. the state of real-time task
Running status: task obtains processor, moves;
Ready state: as long as obtain processor, task can be moved;
Suspended state: for a certain reason, also can't continue to carry out even task obtains processor, only remain after this kind reason cancels, task just has the right that obtains processor;
Latence: before the task creation and cancel later state;
3. the priority of real-time task
The main foundation that can the decision task selectedly put into operation when the state of task was scheduling; The precedence that ready task obtains processor is to be stipulated by the priority of task;
The priority of task has reflected that it seeks out the eager degree of its execution result, and generally speaking, task dispatch is always selected the highest task run of priority.The task priority scope is 0~255, and wherein 0 priority is for the highest, and different task can have identical priority.When creating a task, must specify its priority.If do not specify, the priority that system just gets current task automatically is the priority of new task;
4. task control block (TCB)
Task control block (TCB) is the sign of task, and task system is according to task control block (TCB) and the existence of perception task, and the operand of various task call orders is exactly the task control block (TCB) of task;
Task control block (TCB) is the sole entity that the sign task exists, regained the task controls piece of task when task system after, task has just been cancelled, when setting up a new task, task system distributes the task control block (TCB) of a sky for it, and insert the relevant external characteristic information of this task, at this moment task just is present among the system; Task system is dispatched, is controlled and manage for each task, also all is that the task control block (TCB) according to each task carries out;
Task control block (TCB) also is the comunication area of user task and operating system exchange message.When user task to system's application system resource, during as stored district, input-output device, need the content that relevant application is asked is inserted among the task control block (TCB).And then submit to system, and system also is the task control block (TCB) of relevant return message being sent into task, and obtains information by task from task control block (TCB) after some application of finishing user's proposition or operation;
The main contents of task control block (TCB) comprise the operation field data of user task, and three parts for information about of the external characteristic information of task itself and management role controll block are as follows:
Field data: the content of each register or totalizer in the preservation user task operation field data, the content of preserving the user task programmable counter;
Task surface information: user task identification number, user task state, user task priority;
Managing control information: task call command word, task and system communication area, task control block (TCB) connective word.
5. task control block (TCB) formation
By the task executions situation, task control block (TCB) is organized into three kinds of task control block (TCB) formations according to the priority of task: activity queue, ready queue, empty queue, as shown in Figure 1.
Number of tasks in the user job is specified by the user, and system's linkage editor comes allocating task controll block space according to number of tasks.
Ready queue: the task control block (TCB) that will be in all tasks of ready, suspended state conspires to create a chain by means of the connective word in the task control block (TCB), each task task control block (TCB) is that the task control block (TCB) of equal priority is then arranged by task creation precedence by low tactic in the high earlier back of the priority of task.
Operation queue: the task control block (TCB) that will be in all tasks of running status conspires to create a chain by means of the connective word in the task control block (TCB), each task task control block (TCB) is that the task control block (TCB) of equal priority is then arranged by task creation precedence by low tactic in the high earlier back of the priority of task.
Empty queue: all idle task controll blocks generally also conspire to create a chain.
The first address of individual queue generally is stored in the job control table of user job.
2) real-time task scheduling step
When the state that task takes place in the system changes, task priority changes, when Java operating system is given task dispatch with CPU control again, the real-time multi-task scheduler just begins the operation dispatching process, puts into operation to select a task.
Task dispatch begins pan from the ready queue first-in-chain(FIC), select the highest task of ready task medium priority to put into operation, because task control block (TCB) is that according to priority height is tactic in the ready queue, therefore first ready task of being swept must have the highest priority.The chance that obtains the processor control is in turn arranged for the ready task that makes equal priority, multitask system has been taked the strategy of round-robin scheduling to them, and the task control block (TCB) that is about to choose the task of putting into operation origin-location from the ready queue moves on to the end of same priority task control block (TCB).Like this, when task dispatch pan next time ready queue, the task control block (TCB) of this task has become last in the same priority task task control block (TCB), thereby also obtains processor at last.
Program scans each task control block (TCB) in the ready queue successively, if find to be in the task of ready state, according to same priority duty cycle dispatching principle, select current active task controll block, scheduler program is responsible for recovering the scene of the task of putting into operation, and this includes off status word, instruction counter and each content of registers etc.
As shown in Figure 2, concrete steps are as follows:
1. close and interrupt, the scanning ready queue
This program is worked under the blockade interruption status.Because task control block (TCB) is the operand of program in the ready queue, information does not allow to carry out changing in the process in scheduling in each controll block, so the program that enters is blocked interruption immediately, can not interrupted in the assurance multi-task scheduling program process.
If 2. ready queue be empty execution in step 3., otherwise execution in step is 6.
Current formation does not wait pending real-time task for empty showing, at this moment should give back the system call device to power, and formation then will be selected the real-time task that will carry out when be sky.
3. the sign that will not have ready task is sent
Do not take care of in real time, send a signal to operating system
4. send the address of current task controll block
Current task control block address is sent to operating system
5. system call
When not having real-time task, just carry out the scheduling of normal work to do by the system call device of operating system.
If 6. 7. the current task in the ready queue hangs up execution in step, otherwise execution in step 8.
Current real-time task is to be in the state hung into, and just inadequate resource can't directly move, and at this moment will go to search real-time task that the next one satisfies condition, if be in ready state, can directly move exactly
7. get the next task controll block in the ready queue, carry out 3. if arrived formation, otherwise carry out 6.
Take out next task, judge it is the task of hanging into once more
8. current task control block (TCB) is moved to the tail of same priority, close and interrupt recovering on-the-spot
Selected current real-time task is executed the task for desiring, and revises its priority, and the scene of interrupting in this preserving there is no need, and it is closed, and does the preparation of executing the task
9. send the address of current task controll block
Send the address of current task controll block to operating system, prepare to carry out
10. open interruption, execute the task
The opens interrupters service, operating system is carried out current real-time task.

Claims (1)

1. real-time task scheduling method in the Java operating system is characterized in that:
1) Data Structures
1. task identification number
Task identification number is used for the sign task, plays the effect of task name, and its span is that 0~255, two tasks can not have identical non-zero identification number, but identification number is that zero task can have a plurality of only;
2. the state of real-time task
According to the state of task, the state of real-time task is divided into running status, ready state, suspended state, latence;
Running status: task obtains processor, moves;
Ready state: as long as obtain processor, task can be moved;
Suspended state: for a certain reason, also can't continue to carry out even task obtains processor, only remain after this kind reason cancels, task just has the right that obtains processor;
Latence: before the task creation and cancel later state;
3. the priority of real-time task
The main foundation that can the decision task selectedly put into operation when the state of task was scheduling; The precedence that ready task obtains processor is to be stipulated by the priority of task;
4. task control block (TCB)
Task control block (TCB) is the sign of task, and task system is according to task control block (TCB) and the existence of perception task, and the operand of various task call orders is exactly the task control block (TCB) of task;
Task control block (TCB) is the sole entity that the sign task exists, regained the task controls piece of task when task system after, task has just been cancelled, when setting up a new task, task system distributes the task control block (TCB) of a sky for it, and insert the relevant external characteristic information of this task, at this moment task just is present among the system; Task system is dispatched, is controlled and manage for each task, also all is that the task control block (TCB) according to each task carries out;
5. task control block (TCB) formation
By the task executions situation, according to the priority of task task control block (TCB) is organized into three kinds of task control block (TCB) formations: activity queue, ready queue, empty queue;
2) real-time task scheduling step
When the state that task takes place in the system changes, task priority changes, when Java operating system is given task dispatch with CPU control again, the real-time multi-task scheduler just begins the operation dispatching process, put into operation to select a task, step is as follows:
1. close and interrupt, the scanning ready queue;
If 2. ready queue be empty execution in step 3., otherwise execution in step is 6.;
3. the sign that will not have ready task is sent;
4. send the address of current task controll block;
5. system call;
If 6. 7. the current task in the ready queue hangs up execution in step, otherwise execution in step 8.;
7. get the next task controll block in the ready queue, carry out 3., otherwise carry out 6. if arrived formation;
8. current task control block (TCB) is moved to the tail of same priority, close and interrupt recovering on-the-spot;
9. send the address of current task controll block;
10. open interruption, execute the task.
CNB2006100502569A 2006-04-07 2006-04-07 Real-time task scheduling method in Java operating system Expired - Fee Related CN100383743C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2006100502569A CN100383743C (en) 2006-04-07 2006-04-07 Real-time task scheduling method in Java operating system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2006100502569A CN100383743C (en) 2006-04-07 2006-04-07 Real-time task scheduling method in Java operating system

Publications (2)

Publication Number Publication Date
CN1828543A true CN1828543A (en) 2006-09-06
CN100383743C CN100383743C (en) 2008-04-23

Family

ID=36946954

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2006100502569A Expired - Fee Related CN100383743C (en) 2006-04-07 2006-04-07 Real-time task scheduling method in Java operating system

Country Status (1)

Country Link
CN (1) CN100383743C (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101908002A (en) * 2010-08-17 2010-12-08 中兴通讯股份有限公司 Task path switching method and device
CN101465792B (en) * 2007-12-18 2011-05-25 北京北方微电子基地设备工艺研究中心有限责任公司 Method and apparatus for scheduling data
CN102866917A (en) * 2012-09-27 2013-01-09 深圳市金宏威技术股份有限公司 Method and system for real-time cold fire processing based on Linux platform
CN104021041A (en) * 2014-06-12 2014-09-03 山西江河海融科技有限公司 Method for scheduling computer in multi-task operation environment state
CN105573825A (en) * 2014-10-11 2016-05-11 华为技术有限公司 Cross-operating system inter-task synchronization method and device
CN106775988A (en) * 2016-12-30 2017-05-31 广东欧珀移动通信有限公司 A kind of data processing method and equipment

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2740469B2 (en) * 1995-05-31 1998-04-15 日本電気アイシーマイコンシステム株式会社 Task management method
US6834385B2 (en) * 2001-01-04 2004-12-21 International Business Machines Corporation System and method for utilizing dispatch queues in a multiprocessor data processing system
CN100485605C (en) * 2001-09-24 2009-05-06 中兴通讯股份有限公司 Realizing method for multiple task real-time operation system
CN1317640C (en) * 2004-08-31 2007-05-23 华为技术有限公司 Multi-task application software module management method in real-time operating system environment
JP2005202976A (en) * 2005-02-15 2005-07-28 Mitsubishi Electric Corp Electronic apparatus

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101465792B (en) * 2007-12-18 2011-05-25 北京北方微电子基地设备工艺研究中心有限责任公司 Method and apparatus for scheduling data
CN101908002A (en) * 2010-08-17 2010-12-08 中兴通讯股份有限公司 Task path switching method and device
CN102866917A (en) * 2012-09-27 2013-01-09 深圳市金宏威技术股份有限公司 Method and system for real-time cold fire processing based on Linux platform
CN102866917B (en) * 2012-09-27 2015-08-19 深圳市金宏威技术股份有限公司 A kind of cold fiery real-time processing method based on Linux platform and system
CN104021041A (en) * 2014-06-12 2014-09-03 山西江河海融科技有限公司 Method for scheduling computer in multi-task operation environment state
CN104021041B (en) * 2014-06-12 2017-02-22 山西江河海融科技有限公司 Method for scheduling computer in multi-task operation environment state
CN105573825A (en) * 2014-10-11 2016-05-11 华为技术有限公司 Cross-operating system inter-task synchronization method and device
CN106775988A (en) * 2016-12-30 2017-05-31 广东欧珀移动通信有限公司 A kind of data processing method and equipment

Also Published As

Publication number Publication date
CN100383743C (en) 2008-04-23

Similar Documents

Publication Publication Date Title
CN1828541A (en) Implementation method for timing task in Java operating system
CN100346307C (en) Method of real time task regulation in Java operation system
CN100342342C (en) Java virtual machine implementation method supporting multi-process
CN1117319C (en) Method and apparatus for altering thread priorities in multithreaded processor
CN1188794C (en) Coprocessor with multiple logic interface
CN1308826C (en) System and method for CPI scheduling in SMT processor
JP5324934B2 (en) Information processing apparatus and information processing method
CN1112636C (en) Method and apparatus for selecting thread switch events in multithreaded processor
CN1308825C (en) System and method for CPI load balancing in SMT processors
CN1828543A (en) Real-time task scheduling method in Java operating system
CN100347675C (en) Property optimizing method for applying server
CN1908903A (en) System and method for executing job step, and computer product
CN1008484B (en) Processor i/o and interrupt filters
CN101894047A (en) Kernel virtual machine scheduling policy-based implementation method
CN1316074A (en) Interrupt/software-controlled thread processing
CN101051282A (en) Method for realizing multiple operation system synergistic working
CN1516419A (en) Syste mand method for processing customer computer request on host computer network
CN1264078A (en) Computer for executing multiple operation systems
CN102779075A (en) Method, device and system for scheduling in multiprocessor nuclear system
CN1818875A (en) Grouped hard realtime task dispatching method of built-in operation system
CN1752896A (en) Power source management method of embedded equipment under operation system cooperation and its system
CN1885282A (en) Multi-processor system
CN1317640C (en) Multi-task application software module management method in real-time operating system environment
CN1855067A (en) Task hung-state monitoring method in realtime operation system
CN1423456A (en) Sharing route realizing and sheduling method

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: 20080423

Termination date: 20120407