Real-time operating system CPU software cooling research report

zhaozj2021-02-08  229

Real-time operating system CPU software cooling research report

Problem Description

With the continuous improvement of the CPU's frequency, high-frequency CPUs operating under real-time operating systems such as IRMX, PSOS, VXWORKS, often need to consider CPU cooling. The method usually used is to cool down by hardware measures such as fan or heat sink, but due to the particularity of the embedded system, certain embedded devices take into account the volume of factors such as volume, housing, and other factors such as the housing. Cooling, In this case, we have to consider the feasibility of software cooling. Of course, the software cooling is a case where the power taken will, and it is of course the best in the case of conditions.

There are currently many cooling software such as cpuidle, but these software are running on non-real-time operating systems such as Win9X, and the real-time operating system will not affect the efficiency of the operating system and the real-time performance of the operating system with similar methods. ? This paper will focus on the results of the above problems.

Research environment

Hardware environment Intel P 233, Intel PIII 700

Software environment IRMX real-time operating system

working principle

The figure above is the power management section of the Intel CPU, Intel provides the following power management modes, Auto Halt, STOP GRANT, SLEEP, Deep Sleep, Deeper Sleep. Other modes except Auto Halt cause the clock to stop. In the clock stop state, the processor will close the listening to SMI #, INIT #, and LINT [1: 0], which is only re-opened when returning to the Normal state, which will have a certain impact on the system, especially real-time system. So this article does not discuss these modes.

This article focuses on the Auto Halt mode, which is also the way most of the cooling software usually adopted.

Auto Halt mode features

The Intel CPU migrates the status to the Auto Halt mode by performing HLT instructions in Normal state. At this point, the CPU inserts the HLT command into the instruction sequence and stops processing the command sequence until SMI #, INT #, Linit [1: 0] (NMI, INTR) or PSB interrupt messages are happen. When the above message is returned to the Normal status processing instruction, continue from the next instruction from the HLT instruction after processing the interrupt code. The processor will decline after entering the Auto Halt mode.

How software achieves cooling

Since most of the time CPU utilization is lower under normal circumstances, the power consumption of the CPU can greatly reduce the power consumption of the CPU as long as the CPU is idle, the CPU is reduced.

In real-time operating systems, usually we will design a minimum priority task to do dead loop processing, and the system will go to this task when idle. We can reach the above purposes as long as we add a HLT instruction to the loop of this task.

Calculation of CPU usage

Calculation method of CPU occupation time: By obtaining the CPU occupancy time T0 T0 in the lowest priority task mentioned above, the calculation formula is cpurate = (T-T0) / T. The CPU usage calculation method of all experiments below is the same.

experimental method

Experiment No. 1

Experimental Environment Intel P233, IRMX

Objective To verify that the calculation results of the CPU usage in the case of non-HALT and HALT have a deviation.

Experimental content

Each 100 milliseconds are transmitted from the high priority task task to the low priority task task2, and the low priority task receives the message after receiving the message, the TIMES subcirculation is controlled by changing the value of Times to control the CPU usage. The CPU occupancy rate value calculated according to the above method is calculated according to the above method, respectively, according to the above method, respectively, according to the method of the same TIMES.

CPU Rate Times No Halt Halt 100 6% 6% 1000 12% 12% 5000 35% 35% 10000 64% 64% 13000 82% 82% 15000 95% 95% Conclusions

There is no deviation in the case of CPU usage in the case of hALT and HALT.

Experimental summary

I have always thought that this problem is Halt and not HALT in software. The maximum change in software. My reason is that when the HLT command is executed, the minimum priority task should not take up the CPU time, so that the CPU usage will have a lot of deviations through its CPU occupancy time.

However, when I did test, it was surprised to find that the calculation of Halt and non-HALT CPU usage did not change. After reflection, I suddenly realized that the original operating system is switched to the statistical trigger condition when the CPU occupied time of the calculation task is a statistical trigger condition. When the task is executing the HLT instruction, the operating system does not perform task context, the operating system naturally believes This time the CPU enters the Auto Halt state is still occupied by the task.

CPU cooling amplitude

experimental method

Experiment No. 2

Experimental Environment Intel PIII 700 CPU with tip, IRMX

Objective To verify the impact of the CPU temperature under different CPU occupancy conditions under different CPU occupancy conditions without HALT and HALT.

Experimental content

The CPU temperature corresponding to different CPU usage is measured.

CPU usage temperature (NO HALT) Celsius temperature (HALT) Celsius 100% 54 54 80% 54 51 60% 54 47 40% 54 45 20% 54 42 10% 54 40 3% 54 38

From the data measured above, the CPU has a significant decline in temperature after executing the HLT instruction. Let's take a look at whether the value measured above and the results derived from the temperature theory are consistent.

According to the temperature theory, the relationship between the CPU power E, the thermal resistance R and the temperature T is the relationship between the three

T-T0 = E × R, T0 is the initial temperature

The CPU usage R is in general and power cons facts, and the CPU is partially working in Halt, and the environmental temperature is affected, so the CPU will definitely exist an initial temperature, ie the temperature at R = 0.

In the case of thermal resistance, we can set R = K (T-T0), or T = R / K T0 according to the above.

Where R = 1 / K

Bring r = 100, t = 54 and r = 10, t = 40 into the above formula, K = 6.4, T0 = 38.4

The temperature table corresponding to the theoretical value

CPU usage temperature (HALT) degrees Celsius error 100% 54.0 0 80% 50.9 0.1 60% 47.8 -0.8 40% 44.6 0.4 20% 41.5 0.5 10% 40.0 0 3% 38.8 -0.8 0% 38.4 -

Since the error range of the thermometer I use is within 1 degrees Celsius, the above test results are in line with the results of theoretical derivation.

in conclusion

After executing the HLT instruction, the CPU temperature and the CPU usage are proportional, and the CPU heat is inversely proportional. Under the same heat dissipation conditions, the higher the CPU usage, the higher the CPU temperature; the same CPU usage, the more thermal resistance However, the less heat dissipation is, the greater the CPU temperature rise.

Influence of system real-time performance

experimental method

Experiment No. 3

Experimental Environment Intel P233, IRMX

Objective To verify that the software real-time is affected under different CPU usage under different CPU occupancy conditions.

Experimental content

The calculation of the CPU usage and the method of obtaining the same experiment 1. The system clock after the computer starts the computer clock after the Pentium CPU is obtained, and the computer is started with the computer clock number sysclkcounter. In the high priority task of the experiment, the CMOSTIMETASK interrupt task calculates the difference between the SysClkCounter and the last interrupt when the interrupt is entered, and the time interval of the two interrupt tasks is obtained. CMOS interrupt occurs every ten milliseconds. Calculate the number of system clocks of NO HALT and HALT to the CMOS interrupt interval at different CPU usage. Because the CMOS interrupt itself has a certain error, the effective number of sysclkcounter interval is only 20,000, which is about 1 millisecond.

Sysclkcounter Interval CPU Rate No Halt Halt 3% 1100000 1100000 10% 1100000 1100000 30% 1100000 1100000 50% 1100000 1100000 80% 1100000 1100000 90% 1100000 1100000

Experiment No. 4

Experimental Environment Intel P233, IRMX

Objective To verify that the software real-time under different interrupt frequency conditions is affected under different interrupt frequency conditions without HALT and HALT.

Experimental content

Test the number of system clocks of the CMOS interrupt interval under different data traffic by non-send UDP packets to the system.

Because the CMOS interrupt itself has a certain error, the effective number of sysclkcounter interval is only 20,000, which is about 1 millisecond.

UDP packets transmitted per 100 milliseconds (UDP packet length) CPU usage (NO HALT) CPU usage (HALT) 10 millisecond system clock number, accurate to 100,000 (no halt) 10 millisecond system clock number, accurate Between 100,000 (HALT) network card number 0 - 3% 3% 1100000 1100000 20 1 10 4% 4% 1100000 1100000 110 50 10 27% 27% 1300000 1300000 200 100 10 56% 56% 1800000 1800000 320 150 10 90% 90% 2300000 2300000 370

experiment analysis

If the reader is careful, it will find that when the number of network cards is increased, the CMOS interrupt interval has a large change. I couldn't understand it when I first saw this result, because the priority of CMOS interrupted is the system I do. The highest (higher than the NIC interruption), how can the NIC interruption have such a big impact compared to the high-priority CMOS interruption? Later I found that in the software system I do, all interrupts are closed when the response network card is interrupted, including the CMOS interrupt than it prioritize, this is to prevent the stack in the stack in order to prevent the interrupt, causing the system. collapse. Then this is not difficult to understand why the NIC interruption will have this impact on CMOS interruption.

However, there is no difference in NO HALT and HALT in the same effect.

in conclusion

The execution of the HLT instruction does not affect the real-time performance of the software system.

Research summary

Through the above experiment, we can follow the conclusions, the CPU has a proportion of the CPU temperature and the CPU usage, and the CPU thermal block is inversely proportional. The higher the CPU temperature, the higher the CPU temperature; the same CPU Under the conditions of occupancy, the more thermal resistance, the less heat dissipation, the greater the CPU temperature rise.

The CPU performs HLT instructions that have no effect on the real-time operating system.

转载请注明原文地址:https://www.9cbs.com/read-1785.html

New Post(0)