Program running method and device, equipment and medium
By monitoring and switching processor partitions in ADAS system, and evaluating partition optimization using adaptive switching algorithms and prediction models, the problem that traditional dual-partition startup method cannot meet high security and reliability requirements is solved, and the system is realized in a complex environment safe and reliable operation.
Patent Information
- Application Number
- CN202411337798.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-24
- Publication Date
- 2024-12-31
AI Technical Summary
When the existing ADAS system is running in complex environments, the traditional dual-partition startup method cannot meet the needs of high safety and high reliability. Especially in the context of the development of autonomous driving technology, the safety and reliability requirements of the system are more and more Come higher and higher.
By monitoring the operating status of the second processor in the first processor, and determining whether there is an abnormality in the target partition based on the preset partition flag bits and performance data, switching to the current optimal partition operation determined by the second processor, adopting adaptive Switching algorithms and prediction models to evaluate and optimize the weight coefficients and future operating state of the partition, thereby achieving adaptive switching of partitions.
It improves the security and reliability during system operation, ensures that the system can run safely in abnormal situations, and does not switch to any partition randomly, but to the determined optimal partition, enhancing the reliability of the program.
Smart Images

Figure CN119225858A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of automotive electronic technology, and in particular to a program running method, device, equipment and medium. Background Art
[0002] Existing ADAS (Advanced Driver Assistance System) domain controllers usually use dual-partition startup when running programs, which improves the stability and reliability of the system to a certain extent. However, with the rapid development of autonomous driving technology, the requirements for system safety and reliability are becoming higher and higher.
[0003] On the one hand, autonomous vehicles need to operate in various complex environments and face many uncertainties. For example, severe weather conditions, complex road conditions, and potential network attacks may affect the normal operation of the ADAS system. In this case, the traditional dual-zone startup method may not meet the high safety and high reliability requirements of the autonomous driving system.
[0004] On the other hand, with the continuous advancement of autonomous driving technology, ADAS systems are taking on more and more functions. In addition to traditional driving assistance functions, they also need to have more advanced autonomous driving decision-making, environmental perception, and vehicle control capabilities. The realization of these functions requires more complex software and hardware architectures, and also places higher requirements on the safety and reliability of the system.
[0005] In summary, how to improve the security and reliability during system operation is a problem that needs to be solved. Summary of the invention
[0006] In view of this, the purpose of the present invention is to provide a program running method, device, equipment and medium, which can improve the security and reliability of the system during operation. The specific scheme is as follows:
[0007] In a first aspect, the present application discloses a program running method, applied to a first processor, comprising:
[0008] If it is detected that the second processor for monitoring the running state of the application is in the running state, the application in the corresponding target partition is run according to the preset partition flag; the target partition is any one of the preset number of partitions in the flash memory area;
[0009] monitoring whether a preset target event occurs in the preset partition flag; the preset target event is an event in which the second processor changes the preset partition flag after determining that an abnormality exists in the target partition based on the running state of the application in the target partition;
[0010] If the preset target event occurs in the preset partition flag, the target partition is switched to a current optimal partition other than the target partition determined by the second processor to run the application in the current optimal partition.
[0011] Optionally, the program running method further includes:
[0012] If it is detected that the second processor for monitoring the running state of the application program is in a non-running state, the running program of the second processor is loaded from the flash memory area to run the second processor.
[0013] Optionally, the program running method further includes:
[0014] Performance data reflecting the running status of the application in the target partition is sent to the second processor so that the second processor determines whether there is an abnormality in the target partition based on the performance data; wherein the performance data includes memory usage information, abnormal log data, startup time, running efficiency, error rate and usage rate of the first processor.
[0015] Optionally, if the preset target event occurs in the preset partition flag, switching from the target partition to a current optimal partition other than the target partition determined by the second processor to run an application in the current optimal partition includes:
[0016] If the preset target event occurs in the preset partition flag, power on again and then monitor whether the second processor is currently in a running state;
[0017] If the second processor is currently in a running state, a current flag of the preset partition flag bit is obtained to determine the corresponding current optimal partition based on the current flag; wherein the current flag is a flag obtained by the second processor after determining that an abnormality exists in the target partition and setting the preset partition flag bit to a flag corresponding to the current optimal partition other than the target partition;
[0018] The application program in the current optimal partition is run.
[0019] Optionally, the current optimal partition is a partition determined by the second processor according to a preset screening mechanism; wherein the preset screening mechanism includes:
[0020] Assign weight coefficients to each partition based on its current and historical operating status;
[0021] Input the current operating status and historical operating status of each partition into the prediction model to obtain the prediction result of the future operating status of each partition;
[0022] The current optimal partition is determined based on the weight coefficients of each partition and the prediction results.
[0023] Optionally, the flash memory area is provided with a first partition, a second partition and a third partition, and when there is a need for program upgrade, the first partition and the second partition have a higher priority than the third partition;
[0024] Correspondingly, after running the application in the current optimal partition, the method further includes:
[0025] If the current optimal partition is the first partition, when a program upgrade request is obtained, the application is updated in the second partition, and after the update is completed, the power is restarted to run the application in the second partition;
[0026] If the current optimal partition is the second partition, when a program upgrade request is obtained, the application program is updated in the first partition, and the system is powered on again after the update is completed to run the application program in the first partition.
[0027] Optionally, when the current optimal partition is the third partition, setting the first partition as a default upgrade area;
[0028] Correspondingly, after running the application in the current optimal partition, the method further includes:
[0029] If the current optimal partition is the third partition, when a program upgrade request is obtained, the application program is updated in the first partition, and the system is powered on again after the update is completed to run the application program in the first partition.
[0030] In a second aspect, the present application discloses a program running device, applied to a first processor, comprising:
[0031] A program running module, for running the application in the corresponding target partition according to a preset partition flag if it is detected that the second processor for monitoring the running status of the application is in a running state; the target partition is any one of the preset number of partitions in the flash memory area;
[0032] a flag monitoring module, used to monitor whether a preset target event occurs in the preset partition flag; the preset target event is an event in which the second processor changes the preset partition flag after determining that the target partition is abnormal based on the running status of the application in the target partition;
[0033] A partition switching module is used to switch from the target partition to a current optimal partition other than the target partition determined by the second processor to run an application in the current optimal partition if the preset target event occurs in the preset partition flag.
[0034] In a third aspect, the present application discloses an electronic device, comprising:
[0035] Memory, used to store computer programs;
[0036] The processor is used to execute the computer program to implement the steps of the program running method disclosed above.
[0037] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the steps of the program running method disclosed above are implemented.
[0038] It can be seen that in the present application, if the first processor detects that the second processor used to monitor the running status of the application is in the running state, then the application in the corresponding target partition is run according to the preset partition flag; the target partition is any partition of a preset number of partitions in the flash memory area; the preset partition flag is monitored to see whether a preset target event occurs; the preset target event is an event in which the second processor changes the preset partition flag after determining that the target partition has an abnormality based on the running status of the application in the target partition; if the preset partition flag has the preset target event, switch from the target partition to the current optimal partition other than the target partition determined by the second processor to run the application in the current optimal partition.
[0039] Beneficial effect: After the first processor in the present application is powered on and started, it is first necessary to determine whether the second processor used to monitor the running status of the application is in the running state. If the second processor is monitored to be in the running state, the application in the corresponding target partition is run according to the preset partition flag. It should be pointed out that the present application divides the flash memory area in advance, and the target partition is any one of the preset number of partitions in the flash memory area. The value of the preset partition flag corresponds to each partition one by one. By determining the current preset partition flag, the application in the corresponding partition is run. Further, the preset partition flag is monitored to determine whether a preset target event occurs. It can be understood that since the second processor is already in the running state, the second processor will monitor the running state of the application in the target partition in real time, so as to determine whether the target partition is abnormal based on the running state. If there is an abnormality, the preset partition flag is changed so that the first processor monitors the preset target event. When the preset partition flag has a preset target event, it is switched from the target partition to the current optimal partition other than the target partition determined by the second processor to run the application in the current optimal partition. That is, when an abnormality currently exists in the target partition, the present application can switch it to the current optimal partition, that is, switch it to a partition other than the target partition in the flash memory area, thereby ensuring that the system can run safely even when an abnormality occurs, and it does not randomly switch to any partition, but switches to the current optimal partition determined by the second processor, making the program run more reliable. In this way, through the above solution, the security and reliability of the system operation process are improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0041] Figure 1 A flowchart of a program operation method disclosed in this application;
[0042] Figure 2 A schematic diagram of the operation of a first processor and a second processor disclosed in the present application;
[0043] Figure 3 A flowchart of a specific program operation method disclosed in this application;
[0044] Figure 4 A schematic diagram of the area division of a flash memory area disclosed in the present application;
[0045] Figure 5 This is a schematic diagram of the structure of a program running device disclosed in this application;
[0046] Figure 6 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0047] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0048] Existing ADAS domain controllers usually use a dual-partition startup method when running programs, which improves the stability and reliability of the system to a certain extent. However, with the rapid development of autonomous driving technology, the requirements for system safety and reliability are getting higher and higher, and the traditional dual-partition startup method may not be able to meet the high safety and high reliability requirements of autonomous driving systems. To this end, the embodiments of the present application disclose a program running method, device, equipment and medium, which can improve the safety and reliability of the system during operation.
[0049] See also Figure 1 and Figure 2 As shown, the embodiment of the present application discloses a program running method, which is applied to a first processor, and the method includes:
[0050] Step S11: if the second processor for monitoring the running status of the application is detected to be in the running state, the application in the corresponding target partition is run according to the preset partition flag; the target partition is any partition of the preset number of partitions in the flash memory area.
[0051] In this embodiment, after the first processor is powered on, it is first necessary to determine whether the second processor used to monitor the running status of the application is in the running state. If the second processor is in the running state, the application in the corresponding target partition is run according to the preset partition flag; wherein both the first processor and the second processor can be designed based on MCU (Microcontroller Unit). It should be pointed out that the present application divides the flash memory area in advance, and the target partition is any one of the preset number of partitions in the flash memory area (flash). The value of the preset partition flag corresponds to each partition one by one. The first processor determines the current preset partition flag to run the application in the corresponding partition. Among them, the preset partition flag can also be stored in a memory address in the flash memory area.
[0052] In a specific implementation, the above method further includes: if it is detected that the second processor used to monitor the running status of the application is in a non-running state, the running program of the second processor is loaded from the flash memory area to run the second processor. In this embodiment, if the second processor is in a non-running state, it is necessary to load the running program of the second processor from the flash memory area so that the second processor starts running; that is, before running the program, the present application first needs to ensure that the second processor used to monitor the running status of the application is in a running state. It is understandable that a space can be pre-allocated in the flash memory area to store the running program of the second processor.
[0053] Step S12: monitoring whether a preset target event occurs in the preset partition flag; the preset target event is an event in which the second processor changes the preset partition flag after determining that an abnormality exists in the target partition based on the running status of the application in the target partition.
[0054] In this embodiment, the preset partition flag is monitored to determine whether a preset target event occurs. It can be understood that since the second processor is already in operation, the second processor will monitor the operation status of the application in the target partition in real time, thereby determining whether there is an abnormality in the target partition based on the operation status. If there is an abnormality, the adaptive switching algorithm of the flag will be automatically triggered, that is, the preset partition flag will be changed, so that the first processor will monitor the preset target event.
[0055] In a specific implementation, the method further includes: sending performance data used to reflect the running state of the application in the target partition to the second processor, so that the second processor determines whether the target partition is abnormal based on the performance data; wherein the performance data includes memory usage information, abnormal log data, startup time, operating efficiency, error rate and the usage rate of the first processor. First of all, it should be pointed out that a secure channel based on end-to-end encryption is established between the first processor and the second processor to prevent data from being tampered with. The first processor will send the performance data used to reflect the running state of the application in the target partition to the second processor in real time through the secure channel, so that the second processor determines whether the target partition is abnormal based on the performance data, that is, evaluates the performance and stability of the target partition. wherein the performance data may include but is not limited to memory usage information, abnormal log data, startup time, operating efficiency, error rate and the usage rate of the first processor. For example, if the memory usage information exceeds the maximum available memory, it means that the target partition is abnormal, and for another example, if the error rate is greater than the preset error rate threshold, it means that the target partition is abnormal.
[0056] Step S13: If the preset target event occurs in the preset partition flag, switch from the target partition to the current optimal partition other than the target partition determined by the second processor to run the application in the current optimal partition.
[0057] In this embodiment, when a preset target event occurs in the preset partition flag, the target partition is switched to the current optimal partition other than the target partition determined by the second processor to run the application in the current optimal partition. That is, when an abnormality currently exists in the target partition, the present application can switch it to the current optimal partition, that is, switch to a partition other than the target partition in the flash memory area, thereby ensuring that the system can run safely in the event of an abnormality, and it does not randomly switch to any partition, but switches to the current optimal partition determined by the second processor, making the program run more reliable. In this way, through the above scheme, the security and reliability of the system operation process are improved.
[0058] Specifically, the current optimal partition is the partition determined by the second processor according to a preset screening mechanism; wherein the preset screening mechanism includes: assigning a weight coefficient to each partition according to the current operating status and historical operating status of each partition; inputting the current operating status and historical operating status of each partition into the prediction model to obtain the prediction results of the future operating status of each partition; and determining the current optimal partition based on the weight coefficient and the prediction results of each partition.
[0059] It is understandable that in this embodiment, the second processor will record all the operating status data obtained from the first processor for use in deciding the current optimal partition. Therefore, the second processor will assign a weight coefficient to each partition based on the current operating status and historical operating status of each partition. The operating status is also the multiple performance data mentioned above. For example, partitions with less memory usage, less abnormal log data, lower error rate, faster startup time, and higher operating efficiency will be assigned a larger weight coefficient. It should also be pointed out that the current operating status reflects the current state of the target partition, and the historical operating status reflects the long-term stability of the target partition. Therefore, the weight ratio between the current operating status and the historical operating status can also be determined based on the current consideration indicators. This application can more accurately evaluate the reliability of the partition by comprehensively considering these two factors.
[0060] In addition, this application will also input the current operating status and historical operating status of each partition into the prediction model to obtain the prediction results of the future operating status of each partition. That is, this application will use statistical models and machine learning algorithms to predict the future performance and possible problems of each partition. Among them, the adaptive boosting algorithm (AdaBoost, Adaptive Boosting Algorithm) can be used specifically. The principle of this algorithm is to iteratively train multiple weak classifiers, adjust the sample weights according to the performance of each classifier, and finally combine them into a strong classifier. This method can adapt to changes in data and improve the performance of the model in each iteration, thereby obtaining accurate prediction results.
[0061] Finally, the optimal partition is determined based on the weight coefficients of each partition and the prediction results of the future operating status. In addition, the impact of severe weather conditions, complex road conditions, and potential network attacks on the ADAS system can also be considered during the decision-making process.
[0062] It should also be pointed out that the second processor has the ability of self-learning, and can analyze the operating status of the vehicle and the health of the ADAS system in real time. By learning from each switch, it continuously optimizes the accuracy and efficiency of the adaptive switching algorithm. For example, incremental learning can be used. The incremental learning algorithm can retain old knowledge while learning new knowledge to avoid catastrophic forgetting. This type of algorithm is suitable for constantly changing environments and can continue to learn on the incoming new data while retaining the memory of old data. Incremental learning algorithms are usually implemented using strategies such as regularization, replay, or parameter isolation.
[0063] It can be seen that in the present application, if the first processor detects that the second processor used to monitor the running status of the application is in the running state, then the application in the corresponding target partition is run according to the preset partition flag; the target partition is any partition of a preset number of partitions in the flash memory area; the preset partition flag is monitored to see whether a preset target event occurs; the preset target event is an event in which the second processor changes the preset partition flag after determining that the target partition has an abnormality based on the running status of the application in the target partition; if the preset partition flag has the preset target event, switch from the target partition to the current optimal partition other than the target partition determined by the second processor to run the application in the current optimal partition.
[0064] Beneficial effect: After the first processor in the present application is powered on and started, it is first necessary to determine whether the second processor used to monitor the running status of the application is in the running state. If the second processor is monitored to be in the running state, the application in the corresponding target partition is run according to the preset partition flag. It should be pointed out that the present application divides the flash memory area in advance, and the target partition is any one of the preset number of partitions in the flash memory area. The value of the preset partition flag corresponds to each partition one by one. By determining the current preset partition flag, the application in the corresponding partition is run. Further, the preset partition flag is monitored to determine whether a preset target event occurs. It can be understood that since the second processor is already in the running state, the second processor will monitor the running state of the application in the target partition in real time, so as to determine whether the target partition is abnormal based on the running state. If there is an abnormality, the preset partition flag is changed so that the first processor monitors the preset target event. When the preset partition flag has a preset target event, it is switched from the target partition to the current optimal partition other than the target partition determined by the second processor to run the application in the current optimal partition. That is, when an abnormality currently exists in the target partition, the present application can switch it to the current optimal partition, that is, switch it to a partition other than the target partition in the flash memory area, thereby ensuring that the system can run safely even when an abnormality occurs, and it does not randomly switch to any partition, but switches to the current optimal partition determined by the second processor, making the program run more reliable. In this way, through the above solution, the security and reliability of the system operation process are improved.
[0065] See also Figure 3 As shown, the embodiment of the present application discloses a specific program running method. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution. Specifically, it includes:
[0066] Step S21: if it is detected that the second processor for monitoring the running status of the application is in the running state, the application in the corresponding target partition is run according to the preset partition flag; the target partition is any partition in the preset number of partitions in the flash memory area.
[0067] In this embodiment, the flash memory area can be specifically divided into three partitions for running the application program. In addition, an area for storing a preset partition flag and an area for storing the running program of the second processor can be further divided. The division result of the flash memory area can be specifically as follows: Figure 4 shown.
[0068] Specifically, the flash memory area is provided with a first partition, a second partition and a third partition. When there is a need for a program upgrade, the priority of the first partition and the second partition is higher than that of the third partition. Accordingly, after running the application in the current optimal partition, it also includes: if the current optimal partition is the first partition, when a program upgrade request is obtained, the application is updated in the second partition, and the power is restarted after the update is completed to run the application in the second partition; if the current optimal partition is the second partition, when a program upgrade request is obtained, the application is updated in the first partition, and the power is restarted after the update is completed to run the application in the first partition.
[0069] That is, when there are three partitions, the present application provides a method for system upgrade, wherein the flash memory area is provided with a first partition, a second partition and a third partition, and when there is a need for program upgrade, the first partition and the second partition have a higher priority than the third partition. That is, the present embodiment gives priority to running and upgrading the program in the first partition and the second partition, and if the current optimal partition is the first partition, when a program upgrade request is obtained, the application is updated in the second partition, and then the preset partition flag is modified to the flag corresponding to the second partition, and after the update is completed, the power is restarted to run the application in the second partition. Correspondingly, if the current optimal partition is the second partition, when a program upgrade request is obtained, the application is updated in the first partition, and then the preset partition flag is modified to the flag corresponding to the first partition, and after the update is completed, the power is restarted to run the application in the first partition.
[0070] In a specific embodiment, when the current optimal partition is the third partition, the first partition is set as the default upgrade area; accordingly, after the application in the current optimal partition is run, it also includes: if the current optimal partition is the third partition, when a program upgrade request is obtained, the application is updated in the first partition, and after the update is completed, the power is restarted to run the application in the first partition. That is, when the application in the third partition is run, the default choice is to flash the update program to the first partition, so as to update the application in the first partition, and then restart the power to run the application in the first partition.
[0071] Step S22: monitoring whether a preset target event occurs in the preset partition flag; the preset target event is an event in which the second processor changes the preset partition flag after determining that an abnormality exists in the target partition based on the running status of the application in the target partition.
[0072] Step S23: If the preset target event occurs in the preset partition flag, power on again and then monitor whether the second processor is currently in a running state.
[0073] In this embodiment, if the preset partition flag is changed, the power is turned on again, and then it is necessary to monitor again whether the current second processor is in the running state. That is, each time the first processor is restarted, it is necessary to determine whether the second processor is in the running state before executing the next step.
[0074] Step S24: If the second processor is currently in a running state, the current flag of the preset partition flag is obtained to determine the corresponding current optimal partition based on the current flag; wherein the current flag is the flag obtained by the second processor after determining that there is an abnormality in the target partition, setting the preset partition flag to the flag corresponding to the current optimal partition other than the target partition.
[0075] In this embodiment, when it is determined that the second processor is in a running state, the current flag of the preset partition flag is obtained. It can be understood that before powering on again, since the second processor has set the preset partition flag to the flag corresponding to the current optimal partition other than the target partition after determining that there is an abnormality in the target partition, that is, the preset partition flag has been changed, and therefore it is necessary to determine its current flag in order to determine the corresponding current optimal partition based on the current flag.
[0076] Step S25: running the application in the current optimal partition.
[0077] In this embodiment, the first processor runs the application program in the current optimal partition.
[0078] For more specific processing procedures of the above steps S21 and S22, reference may be made to the corresponding contents disclosed in the above embodiments, which will not be described in detail here.
[0079] It can be seen that in the embodiment of the present application, the flash memory area is specifically divided into three partitions for running applications, and the present application gives priority to running and upgrading programs in the first partition and the second partition. For example, if the current partition is the first partition, the program will cover the second partition during the upgrade, and then rewrite the preset partition flag to the flag corresponding to the second partition. After restarting, the first processor will run the application of the second partition. When running the application in the third partition, the default option is to flash the update program to the first partition. In addition, when the preset partition flag changes, the first processor needs to be powered on again, and after each restart, it is necessary to determine that the second processor is in a running state before executing the next step. In the case of determining that the second processor is in a running state, since the preset partition flag has changed, it is necessary to determine its current flag, so as to determine the corresponding current optimal partition based on the current flag, and then run the application in the current optimal partition. Through the above scheme, the safety and reliability of the ADAS system during operation are improved.
[0080] The following is a detailed description of the above solution using a specific example where the flash memory area is divided into three partitions:
[0081] First, after the first processor is powered on, it is necessary to determine whether the second processor used to monitor the running status of the application is in a running state. If the second processor is in a running state, the application in the corresponding target partition is run according to the preset partition flag. Assuming that the current flag of the preset partition flag is the first partition, the application in the first partition is run.
[0082] During the running of the application, the second processor will monitor the running status of the application in the first partition in real time. Specifically, the first processor will send performance data reflecting the running status of the application in the first partition to the second processor through an end-to-end encrypted secure channel. The second processor determines whether there is an abnormality in the first partition based on the performance data, that is, evaluates the performance and stability of the first partition; the performance data may include but is not limited to memory usage information, abnormal log data, startup time, operating efficiency, error rate and utilization rate of the first processor, etc.
[0083] If the second processor determines that there is an abnormality in the first partition, the adaptive switching algorithm of the flag bit is automatically triggered to change the preset partition flag bit. Specifically, when there is an abnormality in the first partition, the second processor needs to determine the current optimal partition from the remaining second partition and third partition in the flash memory area. In this process, it is necessary to consider the current operating state and historical operating state of each partition, and predict the future operating state of each partition through the prediction model, so as to determine the current optimal partition. For example, this embodiment divides the operating state into three levels (excellent, good, and poor). It is assumed that all performance data are combined to determine that the current operating state of the second partition is excellent and the historical operating state is good, and the current operating state of the third partition is poor and the historical operating state is excellent. From the above content, it can be seen that the current operating state mainly reflects the current state of the partition, and the historical operating state reflects the long-term stability of the partition. Therefore, the weight ratio can be determined based on specific consideration indicators. If the state of the current partition is more considered, a greater weight is assigned to the current operating state. Therefore, in the comparison of the current operating state and the historical operating state of each partition, the second partition is ultimately assigned a greater weight. Furthermore, this solution will also use the prediction model to predict the future operating status based on the current operating status and historical operating status of each partition. Assuming that the predicted future operating status of the second partition is excellent and the future operating status of the third partition is quantity, the second partition will also be selected as the current optimal partition based on the prediction results.
[0084] Therefore, based on the weight coefficient and the prediction result, the second processor finally determines that the second partition is the current optimal partition, and changes the preset partition flag to a flag corresponding to the second partition. After detecting the change of the preset partition flag, the first processor restarts to switch from the first partition to the second partition, and then runs the application in the second partition.
[0085] See also Figure 5 As shown, the embodiment of the present application discloses a program running device, which is applied to a first processor, and the device includes:
[0086] The program running module 11 is used to run the application in the corresponding target partition according to the preset partition flag if it is detected that the second processor for monitoring the running status of the application is in the running state; the target partition is any one of the preset number of partitions in the flash memory area;
[0087] A flag monitoring module 12 is used to monitor whether a preset target event occurs in the preset partition flag; the preset target event is an event in which the second processor changes the preset partition flag after determining that the target partition is abnormal based on the running status of the application in the target partition;
[0088] The partition switching module 13 is used to switch from the target partition to the current optimal partition other than the target partition determined by the second processor to run the application in the current optimal partition if the preset target event occurs in the preset partition flag.
[0089] It can be seen that after the first processor in the present application is powered on and started, it is first necessary to determine whether the second processor used to monitor the running status of the application is in the running state. If the second processor is monitored to be in the running state, the application in the corresponding target partition is run according to the preset partition flag. It should be pointed out that the present application divides the flash memory area in advance, and the target partition is any one of the preset number of partitions in the flash memory area. The value of the preset partition flag corresponds to each partition one by one. By determining the current preset partition flag, the application in the corresponding partition is run. Further, the preset partition flag is monitored to determine whether a preset target event occurs. It can be understood that since the second processor is already in the running state, the second processor will monitor the running state of the application in the target partition in real time, so as to determine whether the target partition is abnormal based on the running state. If there is an abnormality, the preset partition flag is changed so that the first processor monitors the preset target event. When the preset partition flag has a preset target event, it is switched from the target partition to the current optimal partition other than the target partition determined by the second processor to run the application in the current optimal partition. That is, when an abnormality currently exists in the target partition, the present application can switch it to the current optimal partition, that is, switch it to a partition other than the target partition in the flash memory area, thereby ensuring that the system can run safely even when an abnormality occurs, and it does not randomly switch to any partition, but switches to the current optimal partition determined by the second processor, making the program run more reliable. In this way, through the above solution, the security and reliability of the system operation process are improved.
[0090] Since the embodiments of the device part correspond to the embodiments of the method part, the embodiments of the device part refer to the description of the embodiments of the method part, which will not be described here. And, it has the same beneficial effects as the above-mentioned program running method.
[0091] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Specifically, it may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, and the computer program is loaded and executed by the processor 21 to implement the relevant steps in the program running method executed by the electronic device disclosed in any of the aforementioned embodiments.
[0092] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0093] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0094] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon include an operating system 221, a computer program 222 and data 223, etc. The storage method can be temporary storage or permanent storage.
[0095] Among them, the operating system 221 is used to manage and control the hardware devices and computer programs 222 on the electronic device 20, so as to realize the operation and processing of the massive data 223 in the memory 22 by the processor 21, which can be Windows, Unix, Linux, etc. In addition to including a computer program that can be used to complete the program running method executed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks. In addition to data transmitted from an external device received by the electronic device, the data 223 can also include data collected by its own input and output interface 25, etc.
[0096] Furthermore, an embodiment of the present application also discloses a computer-readable storage medium, in which a computer program is stored. When the computer program is loaded and executed by a processor, the program running method steps disclosed in any of the aforementioned embodiments are implemented.
[0097] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0098] Those skilled in the art may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0099] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a compact disc read-only memory (CD-ROM), or any other form of storage medium known in the art.
[0100] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0101] The program running method, device, equipment and storage medium provided by the present invention are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A program running method, characterized in that: Applied to a first processor, comprising: If it is detected that the second processor for monitoring the running state of the application is in the running state, the application in the corresponding target partition is run according to the preset partition flag; the target partition is any one of the preset number of partitions in the flash memory area; monitoring whether a preset target event occurs in the preset partition flag; the preset target event is an event in which the second processor changes the preset partition flag after determining that an abnormality exists in the target partition based on the running state of the application in the target partition; If the preset target event occurs in the preset partition flag, the target partition is switched to a current optimal partition other than the target partition determined by the second processor to run the application in the current optimal partition.
2. The program running method according to claim 1, characterized in that: Also includes: If it is detected that the second processor for monitoring the running state of the application program is in a non-running state, the running program of the second processor is loaded from the flash memory area to run the second processor.
3. The program running method according to claim 1, characterized in that: Also includes: Performance data reflecting the running status of the application in the target partition is sent to the second processor so that the second processor determines whether there is an abnormality in the target partition based on the performance data; wherein the performance data includes memory usage information, abnormal log data, startup time, running efficiency, error rate and usage rate of the first processor.
4. The program running method according to claim 1, characterized in that: If the preset target event occurs in the preset partition flag, switching from the target partition to a current optimal partition other than the target partition determined by the second processor to run the application in the current optimal partition includes: If the preset target event occurs in the preset partition flag, power on again and then monitor whether the second processor is currently in a running state; If the second processor is currently in a running state, a current flag of the preset partition flag bit is obtained to determine the corresponding current optimal partition based on the current flag; wherein the current flag is a flag obtained after the second processor sets the preset partition flag bit to a flag corresponding to the current optimal partition other than the target partition after determining that the target partition is abnormal; The application program in the current optimal partition is run.
5. The program running method according to claim 1, characterized in that: The current optimal partition is a partition determined by the second processor according to a preset screening mechanism; wherein the preset screening mechanism includes: Assign weight coefficients to each partition based on its current and historical operating status; Input the current operating status and historical operating status of each partition into the prediction model to obtain the prediction result of the future operating status of each partition; The current optimal partition is determined based on the weight coefficients of each partition and the prediction results.
6. The program running method according to any one of claims 1 to 5, characterized in that: The flash memory area is provided with a first partition, a second partition and a third partition. When there is a need for program upgrade, the first partition and the second partition have a higher priority than the third partition; Correspondingly, after running the application in the current optimal partition, the method further includes: If the current optimal partition is the first partition, when a program upgrade request is obtained, the application is updated in the second partition, and after the update is completed, the power is restarted to run the application in the second partition; If the current optimal partition is the second partition, when a program upgrade request is obtained, the application program is updated in the first partition, and the system is powered on again after the update is completed to run the application program in the first partition.
7. The program running method according to claim 6, characterized in that: When the current optimal partition is the third partition, setting the first partition as a default upgrade area; Correspondingly, after running the application in the current optimal partition, the method further includes: If the current optimal partition is the third partition, when a program upgrade request is obtained, the application program is updated in the first partition, and the system is powered on again after the update is completed to run the application program in the first partition.
8. A program running device, characterized in that: Applied to a first processor, comprising: A program running module, for running the application in the corresponding target partition according to a preset partition flag if it is detected that the second processor for monitoring the running status of the application is in a running state; the target partition is any one of the preset number of partitions in the flash memory area; a flag monitoring module, used to monitor whether a preset target event occurs in the preset partition flag; the preset target event is an event in which the second processor changes the preset partition flag after determining that the target partition is abnormal based on the running status of the application in the target partition; A partition switching module is used to switch from the target partition to a current optimal partition other than the target partition determined by the second processor to run an application in the current optimal partition if the preset target event occurs in the preset partition flag.
9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the steps of the program running method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: Used to store computer programs; wherein, when the computer program is executed by a processor, the steps of the program running method according to any one of claims 1 to 7 are implemented.
