These and other objects as well as advantages of the invention will become clear by the following description of preferred embodiments of the invention. A number of benefits not recited in this specification will come to the attention of those skilled in the art upon the implementation of the present invention.
Hereinafter, preferred embodiments of a method and a device for disturbing processing time in a real time operating system according to the present invention are described in detail referring to the drawings. It is assumed that any of the methods and the devices for distributing processing time in the real time operating system according to the preferred embodiments 1-3 includes the five steps, which are the first step S1-fifth step S5 shown in
The first processing group A supervises:
The second processing group B supervises:
The real time operating system 10 comprises at least a context switching section 10a, an interrupt supervising section 10b and a service call 10c, and switches the first processing group A and the second processing group B to each other in response to the issuance of a particular service call and interrupt.
In the Step S1, the processing time maximum values Am and Bm necessary from the processing start-up to the processing completion in the first and second processing groups A and B are calculated respectively from logical values and measured data. It is assumed here as follows:
In a similar manner, the partial processing time maximum value An of the first processing group A is calculated from the logical values and the measured data. It is assumed here as follows:
Next, in the Step S2, a time difference between the dead line Ar and the processing time maximum value Am of the first processing group A (Ar−Am) is calculated. Then, in the Step S3, the calculated time difference (Ar−Am) is set as the processing time allowable value Bv of the second processing group B. In the present example, By =Ar−Am=60−46=14 seconds is set as the processing time allowable value Bv of the second processing group B.
After the processing time allowable value Bv is set, the processing starts at Time t0. The update of the processing time allowable value Bv in the Step S4 is implemented when a context is switched to the first processing group A after the processing of the first processing group B is completed and when the processing is shifted to the operating system in response to the issuance of the service call and the like. It corresponds to the Times t2, t3, t5, t7, t9, t10 and t12. These are the timings of updating the processing time allowable value Bv.
In the Step S5, the processing time allowable value Bv is 14 seconds at the Time t0, and longer than three seconds that is the processing time maximum value Bm of the second processing group B. Therefore, the second processing group B is in an interrupt-allowable state.
When the interrupt of the second processing group B is requested at the Time t1, the processing of the second processing group is implemented. When the processing of the second processing group B starts, a measuring timer of the processing time Ta of the first processing group A is temporarily halted, and thereafter a measuring timer of the processing time TB of the second processing group B is activated.
After the processing of the second processing group B is completed, the processing time TB of the second processing group B is calculated from the measuring timer of the second processing group B at the Time t2. In the case where the processing time TB of the second processing group B is three seconds, the processing time allowable value Bv (14 seconds) is reduced by three seconds to be updated to 11 seconds (14−3=11) in the Step S4. Then, the processing time maximum value Bm of the second processing group B and the processing time allowable value Bv are compared to each other in the Step S5. Because the processing time allowable value Bv, that is 11 seconds, is longer than the processing time maximum value Bm of the second processing group B, that is three seconds, the second processing group B is in the interrupt-allowable state, and the processing is shifted to the first processing group A. Further, the temporary termination of the measuring timer of the processing time TA in the first processing group A is released at the Time t2.
Next, the service call is issued from the first processing group A at the Time t3. When the service call is issued, the processing time TA between the Time t0 when the processing of the first processing group A starts and the Time t3 when the service call is issued is calculated based on the measuring timer of the first processing group A. Assuming that the processing time TA between the processing start-up of the first processing group A and the issuance of the service call (t0→t3) is 13 seconds, the partial processing time maximum value An up to the Time t3 is 13 seconds. The processing time TA and the partial processing time maximum value An are thus equal to each other, therefore, the processing time allowable value By is not updated so as to keep 11 seconds.
At the Times t4, t6 and t8, in a manner similar to the processing at the Time t1, the measuring timer of the processing time TA of the first processing group A is temporarily halted, and the measuring timer of the processing time TB of the second processing group B is activated. At the Times t5, t7 and t9, in a manner similar to the processing at the Time t2, the processing time TB is calculated from the measuring timer of the second processing group B, the processing time allowable value Bv is updated, and the updated processing time allowable value Bv and the processing time maximum value Bm are compared to each other. Then, it is judged whether or not the second processing group B is processable, and then the processing is shifted to the first processing group A. During the operation, the processing time allowable value Bv is sequentially updated (reduced by three seconds), and results in 11 seconds→eight seconds→five seconds.
It is assumed that the processing time allowable value By of the second processing group B is two seconds, and the second processing group B is non-processable at the Time t9, in other words, the processing time allowable value Bv, that is two seconds, is lower than the processing time maximum value Bm, that is three seconds.
After that, when the service call is issued from the first processing group A at the Time t10, the measuring timer of the first processing group A calculates the processing time TA. The processing time TA is a length of time necessary from the processing start-up of the first processing group A (Time t0) to the issuance of the service call (Time t10). It is assumed that the processing time TA necessary from the processing start of the first processing group A by the issuance of the service call is 38 seconds. Because the partial processing time maximum value An up to the Time t10 is 40 seconds, the processing time TA (38 seconds) is shorter by two seconds than the partial processing time maximum value An (40 seconds), and the margin is generated in the processing time. Therefore, the processing time allowable value Bv is updated to the value (2+2=4 seconds) obtained by adding the margin (two seconds) to the before-mentioned value (two seconds). Because the updated processing time allowable value Bv, that is four seconds, is longer than the processing time maximum value Bm (three seconds) of the second processing group B (three seconds), the second processing group B is in the interrupt-allowable state. Such switchover processing from a non-processable state to the interrupt-allowable state is executed by allowing the processing of the second processing group B at the Time t11 through changing a state of the system.
After the second processing group B is processed, at the Time t12, the processing time TB of the second processing group B is calculated from the measuring timer of the second processing group B. When the processing time TB of the second processing group B is two seconds, the processing time allowable value Bv is reduced by two seconds to be updated to two seconds in the Step S4, and the processing time maximum value Bm and the processing time allowable value Bv of the second processing group B are compared to each other in the Step S5. Because the processing time allowable value Bv, that is two seconds, is smaller than the processing time maximum value Bm of the second processing group B, that is three seconds (Bm>Bv), the second processing group B is not set in the interrupt-allowable state but is set in an interrupt-prohibited state, and the processing is shifted to the first processing group A.
In the present preferred embodiment, the processing time allowable value Bv of the second processing group B is set as “time” from the dead line Ar and the processing time maximum value Am of the first processing group A (Bv=Ar−Am). Then, while the processing time allowable value Bv is continuously updated, the processing time allowable value Bv and the processing time maximum value Bm of the second processing group B are compared to each other in each update. Herewith, according to the present preferred embodiment, the second processing group B is in the interrupt-allowable state while the completion of the processing of the first processing group A within the dead line Ar of the first processing group A is guaranteed.
In the preferred embodiment 1, the time difference between the dead line Ar and the processing time maximum value Am (Ar−Am) of the first processing group A is set as the processing time allowable value Bv of the second processing group B. On the contrary, in a preferred embodiment 2 of the present invention, “processable number of times”, that is calculated from the time difference (Ar−Am), is set as a processing time allowable value Bc of the second processing group B.
The first processing group A supervises:
The second processing group B supervises:
The real time operating system 10 comprises at least a context switching section 10a, an interrupt supervising section 10b and a service call 10c, and switches the first processing group A and the second processing group B to each other based on the issuance of a particular service call and interrupt.
First, in the Step S1, a maximum value of the processing time necessary from the processing start-up to the processing completion of the first and second processing groups A and B is calculated from logical values and measured data. In the present preferred embodiment, it is assumed that the processing time maximum value Am of the first processing group A is calculated as 46 seconds, and the processing time maximum value Bm of the second processing group B is calculated as three seconds.
Next, in the Step S2, a time difference between the dead line Ar and the processing time maximum value Am of the first processing group A (Ar−Am) is calculated. In the Step S3, the processing time allowable value Bc of the second processing group B is calculated from the time difference (Ar−Am). The processing time allowable value Bc of the second processing group B is obtained when the time difference (Ar−Am) is divided by the processing time maximum value Bm of the second processing group B. In the present example, the processing time allowable value Bc of the second processing group B is (Ar−Am)÷Bm=(60−46 seconds)÷three seconds=4, remainder 2. The quotient, that is four, denotes the processable number of times, and is set as the processing time allowable value Bc.
After the processing time allowable value Bc is set, the processing starts at the Time t10. Here, as an example, it is assumed that the update of the processing time allowable value Bc in the Step S4 is implemented when the context is switched to the first processing group A after the processing of the second processing group B is completed. At the Times t2, t5, t7 and t9, switchover of the context is implemented, and further, it is a timing when the processing time allowable value Bc is updated.
In the Step S5, the processing time allowable value Bc is four at the Time t10, that is not lower than one, and it is judged that the second processing group B is in the interrupt-allowable state. When the interrupt of the second processing group B is requested at the Time t1, the processing in the second processing group B is implemented. After implementation of processing in the second processing group B, the processing time allowable value Bc is reduced by one to be updated to three in the Step S4 because the second processing group B was already processed once at the Time t2. In the Step S5, because the processing time allowable value is not yet zero at the time, the second processing group B is assumed to be in the interrupt-allowable state, and the processing is shifted to the first processing group A.
In a similar manner, the interrupt of the second processing group B is requested at the Times t4 and t6, and the processing time allowable value Bc is updated at the Times t5 and t7. Then, the processing time allowable value Bc is compared respectively in order to confirm if the value is zero, and it is judged that the second processing group B is in the interrupt-allowable state because the value is not zero. The processing is then shifted to the first processing group A.
When the interrupt of the second processing group B is requested at the Time t8, and the processing in the second processing group B is implemented, the processing time allowable value Bv is reduced by one to be updated to zero at the Time t9. Because the processing time allowable value Bc is zero at the time, the second processing group B is not made to be in the interrupt-allowable state but is made to be in the interrupt-prohibited state. Then, the processing is shifted to the first processing group A.
In the present preferred embodiment, the processing time allowable value Bc of the second processing group B is previously calculated as the “processable number of times” based on the dead line Ar and the processing time maximum value Am of the first processing group A and the processing time maximum value Bm of the second processing group B. Thereby, it is possible that the second processing group B is in the interrupt-allowable state while the completion of the processing of the first processing group A is guaranteed within the dead line Ar of the first processing group A.
In the case of the preferred embodiment 2 wherein the processable number of times described above is used as the processing time allowable value, the actual processing time may be shorter than the processing time maximum value depending on a system, for example, in a cache system. More specifically, even though the second processing group B is made to be in the interrupt-allowable state again after the second processing group B is implemented as many times as the processing time allowable value Bc that is previously calculated, the dead line Ar of the first processing group A may be guaranteed. Such a situation is generated when the processable number of times is used as a judgment reference. More specifically, such a situation may be generated because a remainder is possibly generated when the processable number of times is calculated in the formula of (Ar−Am)÷Bm.
In a preferred embodiment 3 of the present invention, therefore, it is judged whether or not the second processing group B is made to be in the interrupt-allowable state again after the processing time allowable value Bc is zero in such a manner that the remainder generated from the formula of (Ar−Am)÷Bm is judged. When it is judged that the interrupt-allowable state is allowed, the second processing group B is made to be in the interrupt-allowable state.
The first processing group A supervises the processing time TA form start-up of the first processing group A and a remaining processing time maximum value Az from the issuance of the service call of the first processing group A to the processing completion of the first processing group A at a dead line Ar, a processing time maximum vale Am thereof and each service call issued during the processing of the first processing group A. The processing time TA is measured by means of, for example, a timer resource. The second processing group B supervises the processing time allowable value Bc and the processing time maximum value Bm of the second processing group B.
The real time operating system 10 comprises at least a context switching section 10a, an interrupt supervising section 10b and a service call 10c, and switches the first processing group A and the second processing group B to each other in response to the issuance of a particular service call and interrupt.
First, in the Step S1, the following values are calculated from the logical values and the measured data in the first and second processing groups A and B. More specifically, the processing time maximum value from the processing start-up to the processing completion and the remaining processing time maximum value Az from the issuance of the service call to the processing completion of the first processing group A are calculated. In the present preferred embodiment, it is assumed that the following values are calculated as follows:
Next, in the Step S2, a time difference between the dead line Ar and the processing time maximum value Am of the first processing group A (Ar−Am) is calculated. In the Step S3, the processing time allowable value Bc of the second processing group B is calculated from the time difference (Ar−Am). The processing time allowable value Bc of the second processing group B is obtained when the time difference (Ar−Am) is divided by the processing time maximum value Bm of the second processing group B. In the present preferred embodiment, (time difference−14)÷(processing time maximum value Bm=3)=4, remainder 2. The quotient, that is four, is set as the processing time allowable value Bc.
After the processing time allowable value Bc is set, the processing starts at the Time t10. In the present example, when the processing time allowable value Bc is one or more, the update of the processing time allowable value Bc in the Step S4 is implemented when the context is switched to the first processing group A after the processing of the second processing group B is completed. At the Times t2, t5, t7, t9 and t12, the context is switched, and further, it is the timing where the processing time allowable value Bc is updated. When the processing time allowable value Bc is zero, the update of the processing time allowable value Bc in the Step S4 is implemented when the processing is shifted to the operating system in response to the issuance of the service call and the like during the processing of the first processing group A. The Times t3 and t10 is a time when the processing is executed in the operating system, and it is a timing where the processing time allowable value Bc is updated.
In the Step S5, the processing time allowable value Bc is four at the Time t0, and it is judged that the second processing group B is in the interrupt-allowable state. When the processing of the first processing group A starts at the Time t0, the measuring timer of the processing time TA of the first processing group A is activated.
When the interrupt of the second processing group B is requested at the time t1, the processing of the second processing group B is executed. After the processing of the second processing group B is implemented, the processing time allowable value Bc is reduced by one to be updated to three in the Step S4 because the second processing group B was already processed once at the Time t2. In the Step S5, because the processing time allowable value is not yet zero at the time, the second processing group B is in the interrupt-allowable state, and the processing is shifted to the first processing group A.
When the service call is issued at the Time t3, the processing time allowable value Bc is not updated because the relevant value is at least one. When the interrupt of the second processing group B is requested at the Times t4 and t6, the processing time allowable value Bc is updated at the Times t5 and t7, and each of the updated values is compared to detect if they are zero. If the processing time allowable value Bc is not zero at either of the timings, the second processing group B is in the interrupt-allowable state, and the processing is shifted to the first processing group A.
When the interrupt of the second processing group B is requested at the Time t8, and the processing of the second processing group B is implemented, the processing time allowable value Bc is reduced by one to be updated to zero at the Time t9. When the processing time allowable value Bc becomes zero, the second processing group B is not in the interrupt-allowable state but is in the interrupt-prohibited state, and the processing is shifted to the first processing group A.
Thereafter, it is assumed that the service call is issued at the Time t10 during the processing of the first processing group A. Because the processing time allowable value Bc is zero at the time, the processing time allowable value Bc is updated. The processing time TA and the dead line Ar are compared to each other so that a remaining time leading up to the dead line is calculated. It is assumed in the present example that the processing time TA when the service call is issued at the Time t10 is 50 seconds. At the time, the remaining processing time maximum value Az is six seconds, and the dead line Ar is 60 seconds. Therefore, (dead line Ar)−(processing time TA)−(remaining processing time maximum value Az)=4 seconds, remainder 4. Because the processing time maximum value Bm of the second processing group B is three seconds, the second processing group B can be inserted again. When the fact is known, the system state is changed from the interrupt-prohibited state to the interrupt-allowable state.
When the system state is changed, the processing of the second processing group B is implemented at the Time t11. After the processing of the second processing group B is implemented, the second processing group B is not in the interrupt-allowable state but in the interrupt-prohibited state at the Time t12, and the processing is shifted to the first processing group A.
According to the present preferred embodiment, the criterion error in the case where the processable number of times is used as the processing time allowable value Bc, is eliminated, and the potential of the second processing group B free of any dead line leading up to completion of the processing can be expanded. As a result, it enables the more detailed control.
Though preferred embodiments of this invention have been described in detail, it will be understood that various modifications may be made therein, and it is intended to cover in the appended claims all such modifications as fall within the true spirit and scope of this invention.
Number | Date | Country | Kind |
---|---|---|---|
2006-134915 | May 2006 | JP | national |