Movatterモバイル変換


[0]ホーム

URL:


CN1983191A - Method for setting up scheduling restricted zone in built-in realtime system by global variable - Google Patents

Method for setting up scheduling restricted zone in built-in realtime system by global variable
Download PDF

Info

Publication number
CN1983191A
CN1983191ACN 200510134225CN200510134225ACN1983191ACN 1983191 ACN1983191 ACN 1983191ACN 200510134225CN200510134225CN 200510134225CN 200510134225 ACN200510134225 ACN 200510134225ACN 1983191 ACN1983191 ACN 1983191A
Authority
CN
China
Prior art keywords
variable
global variable
scheduling
global
influenced
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
CN 200510134225
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.)
ZTE Corp
Original Assignee
ZTE 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 ZTE CorpfiledCriticalZTE Corp
Priority to CN 200510134225priorityCriticalpatent/CN1983191A/en
Publication of CN1983191ApublicationCriticalpatent/CN1983191A/en
Pendinglegal-statusCriticalCurrent

Links

Images

Landscapes

Abstract

A method for setting dispatch dead-space in embedded real time system according to global variable includes confirming a global variable in said system, judging whether execution result of system process is to be influenced by variable influenced by global variable or not and positioning two code sections for operating global and local variables if it is, setting two said code sections closely together and locking them to be an integral code section being set as dispatch dead-space.

Description

The method of scheduling forbidden zone is set in embedded real time system according to global variable
Technical field
The present invention relates to a kind of method that the scheduling forbidden zone is set, relate in particular to a kind of method that the scheduling forbidden zone is set in embedded real time system according to global variable.
Background technology
Along with the enhancing of embedded system function, most systems has all adopted the mode of multi-process now.And as real-time application system, process scheduling has become the part of most critical in the embedded real-time operating system (RTOS-Real-TimeOperating System), because the time that process scheduling consumed has been directly connected to the real-time of real-time system.
The scheduling of process can separated into two parts: the one, carry out the exchange of process " context ", and be called process switching, it belongs to the latter half of process scheduling; First half then is the opportunity that is used for determining process scheduling, is called process scheduling.In the Embedded System Design of current trend, everybody generally is bent on and optimizes the process switching operation.Even and complicated system, also often only can many tens instructions, though speed really can be more slowly, for the more and more faster travelling speed of modern CPU, in fact the difference of this respect can ignore.
Yet process scheduling is just different, and particularly when system became increasingly complex because of the enhancing of function, Yun Hang process number sharply increased simultaneously, and the Real-Time Scheduling strategy uses and makes the process scheduling algorithm become more complicated again, and this will increase the dispatch delay of system.But system call postpones mainly also not lie in this, and is from producing scheduling to require to implement real process scheduling, promptly switches the time of required wait.For real-time system, dispatch request is preferably arranged, just can dispatch immediately, because could satisfy the requirement that realizes high-priority task so better.No matter the request of scheduling is initiatively initiated by current process, still owing to interrupt producing more urgent task, the task of seizing the CPU operation often has higher priority.Yet this is a fine hope just, because can there be " scheduling forbidden zone " in the environment of multi-process.The scheduling forbidden zone is exactly the code segment of forbidding carrying out process switching.
In fact, total system owns the very difficulty that surveys of " scheduling forbidden zones ".For system simply, perhaps can mark off the code snippet of required scheduling protection by veteran system designer.But,, then hardly may as smart mobile phone etc. for complicated embedded system day by day.In order to satisfy the requirement of embedded system real-time, way commonly used at present has two kinds: a kind of is that mode unification with timeslice or timer defines the time restriction that process can not be dispatched; The 2nd, when embedded OS designs, " scheduling forbidden zone " divided roughly.Obviously simple for first kind of strategy, to not carry out process scheduling but can produce when having dispatch request yet, this spirit with the embedded system of saves valuable does not conform to.Second kind of strategy is representative with up-to-date built-in Linux 2.6, seen the weakness of first kind of strategy just, the scheduling forbidden zone divided, and the kernel of operating system is repaired, to realize more accurate Real-Time Scheduling.But in view of the complicacy of system, this division is rough often, and the longest scheduling forbidden zone consuming time, it will determine the real-time performance of our embedded system.Picture built-in Linux 2.6 is exactly to utilize scheduling forbidden zone and " the visit forbidden zone " of symmetric multiprocessor (SMP-Symmetric MultipleProcessor) structure most of characteristics that overlap, and " visit forbidden zone " mechanism that made full use of realizes evading the Real-Time Scheduling of dispatching the forbidden zone.Yet the scheduling forbidden zone also not exclusively overlaps with " visit forbidden zone ", and the inside has comprised unnecessary " visit forbidden zone " composition again.
Summary of the invention
Technical matters to be solved by this invention is to provide a kind of and according to global variable the method for dispatching the forbidden zone is set in embedded real time system, thus the scheduling forbidden zone in the meticulousr division embedded real time system.
In order to solve the problems of the technologies described above, the invention provides and a kind ofly the method for scheduling forbidden zone is set in embedded real time system according to global variable, comprising: (1) determines a global variable in the operating system nucleus of described embedded real time system; (2), determine the variable that this global variable can have influence on according to this global variable; (3) judge whether this variable that influenced by global variable can exert an influence to the execution result of system process; (4), then locate code segment that this global variable is operated and the code segment that this variable that influenced by global variable is operated if this variable that influenced by global variable can exert an influence to the execution result of system process; (5) described two code segments are put together closely, lock, this zone is set is the scheduling forbidden zone as an overall code section.
Described method further comprises the steps: (6) traversal all global variables in the described operating system nucleus, to each global variable repeated execution of steps (2) to (5).
The invention has the advantages that: divide the scheduling forbidden zone of embedded real time system through becoming more meticulous, effectively guarantee the stability of total system design, make that simultaneously the scheduling forbidden zone is short and pithy, thereby make new dispatch request to meet with a response rapidly, greatly improved the real-time performance of system.
Description of drawings
Fig. 1 is according to the described system construction drawing that the scheduling forbidden zone is set of the embodiment of the invention;
Fig. 2 is according to the described method flow diagram that the scheduling forbidden zone is set of the embodiment of the invention.
Embodiment
Below in conjunction with accompanying drawing, embodiments of the invention are elaborated.
Divide the scheduling forbidden zone, will examine the code segment in the embedded OS exactly, the code snippet that does not allow to dispatch is halfway really protected, be placed in the critical section, promptly dispatch in the forbidden zone.As shown in Figure 1, the present invention be provided with the scheduling forbidden zone system specifically comprise:
Variable query module 201 is used for according to global variable, determines the local variable that this global variable can have influence on.Variable judge module 202, be used to judge whether this local variable that influenced by global variable can exert an influence to the execution result of system process, can the execution result of system process not exerted an influence if determine this local variable that influenced by global variable, then abandon tracking this variable.Code segment locatingmodule 203, when this local variable that influenced by global variable can exert an influence to the execution result of system process, the location was to this global variable code segment of operating and the code segment that this local variable that influenced by global variable is operated.Code segment addslock module 204, is used for described two code segments are put together closely, locks as the front/rear lock/unlock of a setting atomic operation of overall code section, this zone is set is the scheduling forbidden zone.Variable spider module 205 is used for traveling through all global variables of described operating system nucleus, and each global variable is offered describedvariable query module 201 successively.
As shown in Figure 2, in practical operation, at first in the operating system nucleus of described embedded real time system, determine a global variable (step 101).Byvariable query module 201, determine the local variable (step 102) that this global variable can have influence on again.Then, judge this local variable that influenced by global variable whether can exert an influence (step 103) byvariable judge module 202 to the execution result of system process.If this local variable that influenced by global variable can not exert an influence to the execution result of system process, then abandon tracking (step 104) to this local variable.If this local variable that influenced by global variable can exert an influence to the execution result of system process, then locate code segment that this global variable is operated and the code segment (step 105) that this local variable that influenced by global variable is operated by code segment locating module 203.Then, addlock module 204 by code segment described two code segments are put together closely, lock, this zone is set is scheduling forbidden zone (step 106) as the front/rear lock/unlock of a setting atomic operation of overall code section.At last, by all global variables in the described operating system nucleus ofvariable spider module 205 traversal, to each global variable repeated execution of steps 102 to step 106 (step 107).
Describedvariable spider module 205 to the traversal of all variablees in the embedded real time system, relates to the statistical work of variable.The overall situation amount of kernel all is a shared resource, and wherein global constant is constant because of its value, can not influence the scheduling forbidden zone, does not therefore consider global constant.For other shared resource in the embedded system, as peripheral port etc., general equally be mapped to a certain memory address with global variable, its value can change because of the state with external unit, so it is worked as global variable treat.Light has process, and the shared resource of not robbed is the problem that can not produce the scheduling forbidden zone.Therefore want the information of statistical system global variable.As for the statistics of global variable, realize by analyzing each embedded source code.Global variable has its unique form in code, according to its characteristics, use code reading and analysis tools such as SourceInsight, can easily they be found out.Various embedded OSs provide manufacturer, consider the dirigibility and the stronger characteristics of specific aim of embedded system, disclose most source codes.
Different operating system often has the method for the interface of the concrete system call of oneself realization, but also all has mark to look in source code.In Linux, the definition of the system call that all upper stratas will be used, all be placed on/this header file of include/asm/unistd.h in, these system calls will be mapped to the list item of subsystem call table in the kernel again, and these list items will point to concrete function code.Code reading analysis instruments such as utilization SourceInsight can be found out process easily with communicating by letter of kernel system.Take the depth-first algorithm, under each process, carried out such search, and with the title of system call, the title of function code section and the form of mutual variable to scheme that involves are recorded under each process tree graph.A process can have a plurality of system calls, and each system call constitutes a branch and hangs under the corresponding process, has formed one tree at last.
Whether in vertical exploration of above-mentioned process and kernel system interaction, whether emphasis will be discovered and seized system call exactly and return, can the variable in the concrete process be exerted an influence, and excavate the local variable that influences this variate-value.After work was finished, these belonged to the variable of each process and belong to the kernel system variable, all will embody to some extent in the process tree of above-mentioned correspondence.These are on the basis of application code reading analysis instrument, are read deeply and analyzed that source code realizes by the system engineer.
Because the operation of process is dynamic, when nobody can produce influence to the execution of process to kernel and decision making.The present invention is the scheduling forbidden zone that will become more meticulous more, allows the code segment that can not seize scheduling power lack as much as possible exactly, thereby responds other real-time task as quickly as possible.As mentioned above,, just will before and after may changing the code of this kernel variable, add that the lock/unlock atomic operation locks, will run in the scheduling forbidden zone to show this code segment if find have kernel variable may the variable of upper layer procedures be exerted an influence.As in Linux, can before this code, adding prempt_disable, can be seized the right of execution of CPU when forbidding its post code operation; And add that behind this code prempt_enable, sign code thereafter can continue to be seized scheduling, to allow CPU respond the task of higher priority.

Claims (5)

CN 2005101342252005-12-122005-12-12Method for setting up scheduling restricted zone in built-in realtime system by global variablePendingCN1983191A (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN 200510134225CN1983191A (en)2005-12-122005-12-12Method for setting up scheduling restricted zone in built-in realtime system by global variable

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN 200510134225CN1983191A (en)2005-12-122005-12-12Method for setting up scheduling restricted zone in built-in realtime system by global variable

Publications (1)

Publication NumberPublication Date
CN1983191Atrue CN1983191A (en)2007-06-20

Family

ID=38165746

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN 200510134225PendingCN1983191A (en)2005-12-122005-12-12Method for setting up scheduling restricted zone in built-in realtime system by global variable

Country Status (1)

CountryLink
CN (1)CN1983191A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101807157A (en)*2010-03-302010-08-18南京恩瑞特实业有限公司Defensive programming method based on function access global variables
CN106445656A (en)*2016-09-062017-02-22北京邮电大学Method and device for realizing thread local storage

Cited By (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101807157A (en)*2010-03-302010-08-18南京恩瑞特实业有限公司Defensive programming method based on function access global variables
CN101807157B (en)*2010-03-302012-08-29南京恩瑞特实业有限公司Defensive programming method based on function access global variables
CN106445656A (en)*2016-09-062017-02-22北京邮电大学Method and device for realizing thread local storage
CN106445656B (en)*2016-09-062019-10-11北京邮电大学 A method and device for implementing thread local storage

Similar Documents

PublicationPublication DateTitle
US7996570B1 (en)Usage of keyboard driver in extensible firmware interface for adding new hot keys at firmware level
US7783661B2 (en)Method and apparatus for optimizing queries in a logically partitioned computer system
GB2371884A (en)Queries in an object-oriented computer system
CN102567399B (en)Method and device for accessing database
CN101840352A (en)Method and device for monitoring database connection pool
Li et al.Energy-aware scheduling on multiprocessor platforms
CN105631019A (en)Metadata extension method and device
CN101763288A (en)Method for dynamic hardware and software partitioning by considering hardware pre-configuration factors
CN102129385B (en)Management method capable of dynamically expanding management function of virtual machine
CN1983191A (en)Method for setting up scheduling restricted zone in built-in realtime system by global variable
CN112199217B (en)Software and hardware cooperative thread private data access optimization method
CN1983188A (en)System for setting up scheduling restricted zone in built-in realtime system by global variable
CN103870313A (en)Virtual machine task scheduling method and system
CN1983186A (en)System for setting up scheduling restricted zone in built-in realtime system by process
CN102043925A (en)Novel information flow analysis method
CN1983190A (en)Method for setting up scheduling restricted zone in built-in realtime system
CN1983189A (en)System for setting up scheduling restricted zone in built-in realtime system
CN101901192A (en) A static allocation method of on-chip and off-chip data objects
CN1983187A (en)Method for setting up scheduling restricted zone in built-in realtime system by process
CN114385686A (en)Method and system for realizing complex event processing in distributed stream data processing engine
CN113642836A (en)Callback event processing method and device, computer equipment and storage medium
CN110262724B (en)Menu display method, device and equipment
CN103559085B (en)A kind of embedded system is carried out interrupt and the method for criticality incident management operation
JPH08297573A (en) Object data processor
JP2000222197A (en)Efficient system development method utilizing two templates

Legal Events

DateCodeTitleDescription
C06Publication
PB01Publication
C10Entry into substantive examination
SE01Entry into force of request for substantive examination
C12Rejection of a patent application after its publication
RJ01Rejection of invention patent application after publication

[8]ページ先頭

©2009-2025 Movatter.jp