Method and system for dynamic configuration and hot update of ultramicro kernel operating system

By collecting and processing system status parameters in real time in the ultramicro kernel operating system and dynamically adjusting configuration parameters, the problem that traditional systems cannot respond to environmental changes quickly is solved, and the system is flexible configuration and efficient management is realized, and resource utilization and performance are improved.

CN120492152APending Publication Date: 2025-08-15CHINA SOUTHERN POWER GRID COMPANY
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510557096.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-29
Publication Date
2025-08-15

AI Technical Summary

Technical Problem

Traditional operating systems cannot respond quickly to environmental changes in the smart grid, lack flexibility and real-time, and it is difficult to achieve efficient management of high-frequency events and dynamic configurations.

Method used

By collecting system status parameters in real time in the ultramicro kernel operating system, calculating moving averages and standard deviations, determining abnormal state parameters, and adjusting the configuration parameters of the system module based on these parameters, optimizing CPU usage and I/O operation frequency, and performing dynamic configuration and thermal updates.

Benefits of technology

It realizes flexible configuration and thermal updates of the ultra-micro kernel operating system, improves the system's response capabilities and resource utilization, and ensures optimization and upgrades without interrupting services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120492152A_ABST
    Figure CN120492152A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a dynamic configuration and hot update method and system for an ultramicro kernel operating system. The method comprises the following steps: if system state parameters exceed a preset parameter threshold value, acquiring target system state parameters exceeding the preset parameter threshold value, and adding timestamps to obtain a system state parameter data set; calculating a moving average value and a standard deviation, and determining an abnormal system state parameter according to the target system state parameter, the moving average value and the standard deviation; and determining the configuration parameter adjustment amount of the system module corresponding to the abnormal system state parameter, and adjusting the configuration parameter of the system module based on the configuration parameter adjustment amount. According to the scheme, dynamic updating of the configuration in the ultramicro kernel operating system is realized, the system performance is optimized, the resource utilization rate is improved, and optimization and upgrading are carried out under the condition of ensuring that the service is not interrupted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of kernel dynamic configuration technology, and in particular to a method and system for dynamic configuration and hot update of a nano-kernel operating system. Background Art

[0002] To enable rapid response and dynamic configuration across various devices and systems in smart grids, the microkernel operating system, a lightweight, highly customizable operating system architecture, is gaining increasing attention in power systems. Unlike traditional operating systems, the microkernel minimizes operating system functionality and isolates core scheduling and management functions outside the kernel, enhancing system scalability and flexibility. Within this microkernel architecture, various system functional modules and services can be dynamically loaded and unloaded based on demand, reducing system complexity, improving resource utilization, and ensuring system stability and efficiency.

[0003] In power systems, nanokernel operating systems have the following advantages:

[0004] Resource scheduling and optimization: The nanokernel can more finely control the allocation and scheduling of system resources, ensuring the efficient operation of various control units, sensors, actuators and other equipment in the power system.

[0005] High concurrency and real-time performance: Tasks such as data transmission, real-time monitoring, and equipment control in power grids usually require high-concurrency processing capabilities. The nanokernel can achieve efficient task scheduling with low overhead.

[0006] Flexible dynamic updates and hot replacements: Due to the modular nature of the nanokernel, system configurations can be dynamically adjusted, performance optimized, and even hot-updated without impacting overall system stability. In smart grids, especially large-scale distributed power systems, system stability and efficiency depend on the operating system's ability to respond to changing power loads and device states in real time. However, traditional operating systems often cannot respond quickly to environmental changes and lack the flexibility and real-time performance to handle high-frequency events and dynamic configurations. Therefore, implementing dynamic configuration and hot-updates within the nanokernel operating system has become a core technical challenge for enhancing the intelligence and efficient management of power systems. Summary of the Invention

[0007] The embodiments of the present application provide a method and system for dynamic configuration and hot update of a nanokernel operating system to implement dynamic configuration and hot update in the nanokernel.

[0008] According to one aspect of the present application, a method for dynamic configuration and hot update of a nanokernel operating system is provided, the method comprising:

[0009] If the system state parameter exceeds the preset parameter threshold, the target system state parameter exceeding the preset parameter threshold is obtained and a timestamp is added to obtain a system state parameter data set;

[0010] Calculating a moving average and a standard deviation for each target system state parameter in the system state parameter data set, and determining an abnormal system state parameter based on the target system state parameter, the moving average and the standard deviation;

[0011] determining, according to the abnormal system state parameter, a configuration parameter adjustment amount of a system module corresponding to the abnormal system state parameter, and adjusting the configuration parameter of the system module based on the configuration parameter adjustment amount;

[0012] The CPU usage and I / O operation frequency of the system during operation after the configuration parameters of the system module are adjusted according to the configuration parameter adjustment amount are optimized and adjusted, and the CPU affinity data is optimized and adjusted according to the load of the CPU where the process is located and the total load of the CPU where all processes are located.

[0013] According to one aspect of the present application, a nanokernel operating system dynamic configuration and hot update system is provided, the system comprising:

[0014] The data acquisition module is used to obtain the target system state parameter exceeding the preset parameter threshold if the system state parameter exceeds the preset parameter threshold, and add a timestamp to obtain a system state parameter data set;

[0015] an abnormal system state parameter determination module, configured to calculate a moving average and a standard deviation for each target system state parameter in the system state parameter data set, and determine the abnormal system state parameter based on the target system state parameter, the moving average and the standard deviation;

[0016] a configuration parameter adjustment module, configured to determine, according to the abnormal system state parameter, a configuration parameter adjustment amount of a system module corresponding to the abnormal system state parameter, and adjust the configuration parameter of the system module based on the configuration parameter adjustment amount;

[0017] The optimization and adjustment module is used to optimize and adjust the CPU usage and I / O operation frequency of the system during operation after the configuration parameters of the system module are adjusted according to the configuration parameter adjustment amount, optimize and adjust the process priority data, and optimize and adjust the CPU affinity data according to the load of the CPU where the process is located and the total load of the CPU where all processes are located.

[0018] According to another aspect of the present application, an electronic device is provided, the electronic device comprising:

[0019] at least one processor; and

[0020] a memory communicatively connected to at least one processor; wherein,

[0021] The memory stores a computer program that can be executed by at least one processor, and the computer program is executed by at least one processor so that the at least one processor can execute the method for dynamic configuration and hot update of the nanokernel operating system of any embodiment of the present application.

[0022] According to another aspect of the present application, a computer-readable storage medium is provided, which stores computer instructions, and the computer instructions are used to enable a processor to implement the dynamic configuration and hot update method of the nano-kernel operating system of any embodiment of the present application when executed.

[0023] The technical solution of the embodiment of the present application involves obtaining target system state parameters exceeding the preset parameter threshold, adding a timestamp, and obtaining a system state parameter dataset. For each target system state parameter in the system state parameter dataset, a moving average and standard deviation are calculated, and an abnormal system state parameter is determined based on the target system state parameter, the moving average, and the standard deviation. Based on the abnormal system state parameter, a configuration parameter adjustment amount for the system module corresponding to the abnormal system state parameter is determined, and the configuration parameters of the system module are adjusted based on the configuration parameter adjustment amount. Furthermore, based on the CPU usage and I / O operation frequency of the system module after the configuration parameters are adjusted based on the configuration parameter adjustment amount, process priority data is optimized and adjusted, and CPU affinity data is optimized and adjusted based on the CPU load of the process and the total CPU load of all processes. This solution implements dynamic configuration updates in the nanokernel operating system, optimizes system performance, improves resource utilization, and ensures that optimization and upgrades can be performed without service interruption.

[0024] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present application, nor is it intended to limit the scope of the present application. Other features of the present application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0026] Figure 1A flowchart of a method for dynamic configuration and hot update of a nanokernel operating system provided in an embodiment of the present application;

[0027] Figure 2 A schematic diagram of the structure of a nanokernel operating system dynamic configuration and hot update system provided in an embodiment of the present application;

[0028] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0029] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.

[0030] It should be noted that the terms "first", "second", "third", "fourth", "actual", "preset", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0031] Figure 1 This is a flow chart of a method for dynamic configuration and hot update of a nano-kernel operating system provided in an embodiment of the present application. The embodiment of the present application is applicable to the case of dynamic configuration and hot update of a nano-kernel. The method can be executed by a system for dynamic configuration and hot update of a nano-kernel operating system. The system for dynamic configuration and hot update of a nano-kernel operating system can be implemented in the form of hardware and / or software. The system for dynamic configuration and hot update of a nano-kernel operating system can be configured in an electronic device. Figure 1 As shown, the method includes:

[0032] S110: If the system state parameter exceeds the preset parameter threshold, obtain the target system state parameter that exceeds the preset parameter threshold, add a timestamp, and obtain a system state parameter data set.

[0033] The nanokernel is a small program specifically responsible for handling interrupts, and its concept is similar to the hardware abstraction layer. The main function of the nanokernel is to virtualize the hardware, allowing a single hardware to run multiple operating systems simultaneously. It is usually used to translate the interrupt of one hardware into the interrupt of another hardware, and then hand it over to the corresponding simulation program to handle the interrupt. The system status parameters are the system status parameters of the nanokernel. System status parameters include, for example, CPU usage, memory usage, I / O operation frequency, process status changes, and the triggering of interrupt events. The preset parameter threshold can be a pre-set parameter threshold, which can be a fixed value or can be dynamically adaptively adjusted according to actual conditions.

[0034] For example, during operation, the system may periodically collect system status parameters and record and store the periodically collected system status parameters. The periodically collected system status parameters may be system status parameters for a period of time, such as system status parameters within 10 minutes. The system status parameters may be compared with a preset parameter threshold. If the system status parameters exceed the preset parameter threshold, the system status parameters exceeding the preset parameter threshold are obtained as target system status parameters, and the subsequent scheme of the embodiment of the present application is executed based on the target system status parameters. The system status parameters used for comparison with the preset parameter threshold may be statistical descriptive values such as the average value and median value of the system status parameters over a period of time.

[0035] In an embodiment of the present application, after obtaining the target system state parameters, a timestamp is added to the target system state parameters, that is, the acquisition time of the target system state parameters, to form a system state parameter data set, which is convenient for subsequent processing based on the target system state parameters within a continuous period of time.

[0036] In an embodiment of the present application, a shared memory area can be created and the system state parameter data set can be mapped to the shared memory area for storage. The details are as follows:

[0037] Memory pool initialization: When the system starts, the operating system creates a memory pool for the shared memory area;

[0038] Memory pool partitioning: The entire shared memory area is divided into multiple memory blocks, and the memory blocks are managed through a mapping table. Each memory block contains a pointer to the shared memory data structure;

[0039] Dynamic allocation and recycling: When data needs to be written to shared memory, the system allocates a free block from the memory pool and writes the data to the free block; when the system status parameter set is no longer needed, the operating system reclaims the corresponding memory block and marks it as available;

[0040] The mapping table is designed as follows:

[0041] The operating system creates a mapping table for each shared memory block, recording the state of the shared memory block and the corresponding data pointer; each memory block or process finds the memory block where the system state parameter data set is located by querying the mapping table;

[0042] Memory mapping: The operating system maps the shared memory area in the internal storage to the virtual address space of each process through system calls;

[0043] Semaphore mechanism: A semaphore is allocated to each shared memory block to ensure that only one process or module can operate on the shared memory block at the same time. A read-write lock mechanism is used to allow multiple processes to access the shared memory block concurrently when only read operations are performed on the data block. When writing is required, a write lock is used to ensure mutual exclusivity of the write operation.

[0044] S120 , calculating a moving average and a standard deviation for each target system state parameter in the system state parameter data set, and determining an abnormal system state parameter based on the target system state parameter, the moving average and the standard deviation.

[0045] For example, each target system state parameter in the system state parameter set is timestamped. Therefore, descriptive statistics can be calculated based on the temporally continuous target system state parameters to reflect changes in the target system state parameters. Specifically, the average value of the target system state parameters over a preset time period can be calculated as a moving average, and the standard deviation can be calculated. The target system state parameters, moving average, and standard deviation can be used to reflect deviations from the overall level, thereby identifying abnormal system state parameters.

[0046] In the embodiment of the present application, the process of determining the moving average value includes:

[0047] For the continuous same target system state parameter in the system state parameter data set, determine the target system state parameter within the preset time window closest to the current time;

[0048] Calculating an average value of the target system state parameter within a preset time window as the moving average value;

[0049] The process of determining the standard deviation includes:

[0050] For each target system state parameter within the preset time window, the square of the difference between the target system state parameter and the moving average is calculated, and the mean of the squares corresponding to each target system state parameter is calculated and then the square root is taken.

[0051] Specifically, the moving average is calculated as follows:

[0052]

[0053] Where: MA t represents the moving average value at the current time point; N represents the number of target system state parameters contained in the time window, which is a time period; x i represents the state parameter of the i-th target system in the time window;

[0054] Standard deviation calculation:

[0055]

[0056] Where: STD t The standard deviation at time point t.

[0057] S130: Determine, according to the abnormal system state parameter, a configuration parameter adjustment amount of a system module corresponding to the abnormal system state parameter, and adjust the configuration parameter of the system module based on the configuration parameter adjustment amount.

[0058] System modules are functional modules within the system, such as the I / O operation module, process management module, memory management module, and CPU management module. Configuration parameters include, for example, I / O scheduling priority, process priority, CPU affinity, and memory allocation. CPU affinity refers to the ability to associate specific computing resources (such as processor cores) with specific tasks or threads. This allows system administrators or developers to specify that specific tasks or threads be bound to specific processor cores to improve system performance and efficiency.

[0059] For example, the configuration parameter adjustment amount of the corresponding system module can be adaptively determined based on the abnormal system state parameters, and the configuration parameters of the system module can be adjusted based on the configuration parameter adjustment amount to improve the abnormal system state parameter situation, improve the overall efficiency of the system, and enhance the overall operational performance.

[0060] S140. Optimize and adjust the CPU usage and I / O operation frequency of the system during operation after the configuration parameters of the system module are adjusted according to the configuration parameter adjustment amount, optimize and adjust the process priority data, and optimize and adjust the CPU affinity data according to the load of the CPU where the process is located and the total load of the CPU where all processes are located.

[0061] For example, after adjusting the configuration parameters of the system module based on the configuration parameter adjustment amount, the process priority data and CPU affinity can be further optimized according to the parameters during system runtime to achieve a more optimized configuration. Specifically, after adjusting the configuration parameters of the system module, the CPU usage and I / O operation frequency during system runtime can be determined, and the process priority data can be optimized and adjusted according to the CPU usage and I / O operation frequency. The CPU load of the process and the CPU load of all processes can be obtained, and the CPU affinity data can be optimized and adjusted according to the CPU load of the process and the CPU load of all processes. Therefore, based on the previous configuration parameter adjustment, further optimization can be performed according to the adjusted performance to achieve a more optimal configuration.

[0062] The technical solution of the embodiment of the present application is to divide the firmware data packet to be transmitted based on the fragment division parameters of the firmware data packet to be transmitted to obtain firmware packet fragments, and transmit each firmware packet fragment based on the transmission rate, connection interval and priority; during the transmission process, the fragment division parameters, the transmission rate, the connection interval and the priority are dynamically adjusted according to the transmission information of the firmware packet fragment and the status information of the transmission device; the firmware data packet to be transmitted is divided based on the adjusted fragment division parameters to obtain firmware packet fragments, and transmit each firmware packet fragment based on the adjusted transmission rate, the connection interval and the priority. The above scheme can adaptively and dynamically adjust various parameters in the process of dividing the firmware data packet into fragments for transmission, so as to flexibly respond to factors such as transmission conditions, environmental changes and device status changes during the transmission process, so that the transmission parameters match actual needs and improve upgrade efficiency.

[0063] As a non-limiting implementation, determining the preset parameter threshold includes:

[0064] The preset parameter threshold corresponding to the previous time node is multiplied by the dynamic adjustment ratio to obtain the preset parameter threshold corresponding to the next time node; wherein the dynamic adjustment ratio is greater than one and less than two.

[0065] For example, in an embodiment of the present application, if a system state parameter exceeds a preset parameter threshold, the target system state parameter exceeding the preset parameter threshold is obtained, and the scheme in the embodiment of the present application is executed. However, as the scheme is executed, the configuration parameters of the system module are gradually adjusted and optimized, and the space for performance improvement is reduced. Moreover, if the target system state parameter is still frequently obtained to adjust the configuration parameter, more computing resources will be wasted. Therefore, the preset parameter threshold can be adaptively adjusted to adaptively limit the conditions for triggering the execution of the embodiment of the present application, and appropriately reduce the number of triggers to reduce unnecessary energy consumption.

[0066] Specifically, the preset parameter threshold can be adaptively increased over time, thereby reducing the number of subsequent triggering of the execution of the solution of the embodiment of the present application. The adjustment can be based on the following formula:

[0067] θ i ′(t)=θ i (t-1)×(1+Δ);

[0068] Where: θ i ′(t) represents the preset parameter threshold after adjustment; θ i (t-1) represents the preset parameter threshold at the previous moment; 1+Δ represents the dynamic adjustment ratio, which is a positive number greater than 1 and less than 2;

[0069] When the trigger condition of a system status parameter is met, the system obtains the parameter as the target system status parameter and records detailed information about the system status, including CPU usage, memory usage, I / O operation frequency, process status changes, and interrupt events.

[0070] Each time the target system status parameter acquisition is triggered, the system adds a timestamp to each record. The record format is as follows:

[0071] S=(timestamp,metric name ,value);

[0072] Where: S represents the data record format; timestamp represents the timestamp of data collection; metric name Indicates the numerical value of the indicator.

[0073] As a non-limiting implementation method, the abnormal system state parameter is determined based on the target system state parameter, the moving average value, and the standard deviation, including:

[0074] Calculating the absolute value of the difference between the target system state parameter and the moving average value, and calculating the product of a threshold constant and the standard deviation;

[0075] If the absolute value of the difference is greater than the product of the standard deviations, it is determined that the target system state parameter is an abnormal system state parameter.

[0076] Exemplarily, whether the target system state parameter is an abnormal system state parameter may be determined based on a deviation value of the target system state parameter relative to a moving average value and a comparison with a standard deviation.

[0077] It can be determined based on the following formula:

[0078] |x t -MA t |>α·STD t ;

[0079] Where: α is the threshold constant, which can be 2; x t Represents the currently sampled target system state parameter. If the target system state parameter satisfies the above formula, indicating that the target system state parameter deviates significantly from the average value, the target system state parameter is considered an abnormal system state parameter.

[0080] As a non-limiting implementation, determining, based on the abnormal system state parameter, a configuration parameter adjustment amount of a system module corresponding to the abnormal system state parameter includes:

[0081] For each abnormal system state parameter, determining a deviation value between the abnormal system state parameter and a preset target parameter;

[0082] The product of the deviation value and the gain factor is used as the configuration parameter adjustment amount.

[0083] For example, set the preset target parameters For each abnormal system state parameter, calculate its deviation from the preset target parameter:

[0084]

[0085] Where: e i (t) represents the deviation value of the i-th indicator at time t; x i (t) represents the actual value of the i-th abnormal system state parameter at time t;

[0086] Determine the configuration parameter adjustment amount based on the deviation value:

[0087] Δθ i (t) = K i ·e i (t);

[0088] Where: Δθ i (t) represents the adjustment amount of the i-th configuration parameter; K i represents the gain factor;

[0089] As a non-limiting implementation, the process of determining the gain factor includes:

[0090] If the deviation value is greater than the preset deviation threshold, a gain factor is added to the gain factor corresponding to the previous time node;

[0091] Otherwise, the gain factor is subtracted from the gain factor corresponding to the previous time node;

[0092] Wherein, the gain factor is the product of the gain update step length and the absolute value of the deviation value;

[0093] Gain increase rule: If the deviation value e i The absolute value of (t) is greater than the preset deviation threshold ∈ i , then increase the gain factor:

[0094] K i (t) = K i (t-1)+α i ·|e i (t)|;

[0095] Where: α i Indicates the gain update step size used when the gain increases;

[0096] Gain reduction rule: If the deviation value e i The absolute value of (t) is less than the preset deviation threshold ∈ i , then reduce the gain factor:

[0097] K i (t) = K i (t-1)-β i ·|e i (t)|;

[0098] Where: β i Indicates the gain update step size used when the gain is decreased.

[0099] The gain update step size is expressed as:

[0100]

[0101] Where: α i (t) represents the gain update step size at the current moment; α i0 represents the initial gain update step size; λ1 represents the gain adjustment sensitivity factor; λ2 represents the convergence rate control factor; e i (t) represents the deviation value at the current time t; e i (t-1) represents the deviation value at the previous moment t-1; e max Indicates the maximum tolerance of the deviation value; δ1 and δ2 are smoothing factors, which are constants to prevent division by 0.

[0102] As a non-limiting implementation manner, adjusting the configuration parameters of the system module based on the configuration parameter adjustment amount includes:

[0103] Based on the configuration parameter adjustment amount, creating a new version for each system module that needs to be updated, setting an update flag for the system module, and generating an update task;

[0104] The update task is executed to create a new version of the system module and adjust the configuration parameters of the system library.

[0105] Exemplarily, creating a new version of the system module: creating a new version of each system module that needs to be updated based on the configuration parameter adjustment amount.

[0106] Each system module version will be updated according to actual needs to ensure that the latest configuration is loaded in the memory.

[0107] Prepare update content: The update content needs to be prepared in memory in advance to avoid system interruption during the update process.

[0108] Set update flags and schedule tasks: Set update flags to mark which tasks or modules need to be updated to avoid system instability during the update process.

[0109] As a non-limiting implementation method, optimizing and adjusting the CPU usage and I / O operation frequency of the system during operation after the configuration parameters of the system module are adjusted according to the configuration parameter adjustment amount, optimizing and adjusting the process priority data, and optimizing and adjusting the CPU affinity data according to the load of the CPU where the process is located and the total load of the CPUs where all processes are located include:

[0110] The optimization adjustment coefficient of the process priority data is determined based on the ratio of the change in CPU usage to the change in I / O operation frequency in the current cycle and the product of the adjustment parameter;

[0111] Add the process priority data optimization adjustment coefficient to the current process priority data to obtain the optimized and adjusted process priority data;

[0112] The CPU affinity data optimization adjustment coefficient is determined based on the ratio of the CPU load of the process to the total CPU load of all processes multiplied by the adjustment coefficient.

[0113] The CPU affinity data optimization adjustment coefficient is added to the current CPU affinity data to obtain the optimized and adjusted CPU affinity data.

[0114] Exemplarily, the adjusted and optimized process priority data is determined based on the following formula:

[0115]

[0116] Where: Priority new Indicates the process priority after optimization and adjustment; Priority current Indicates the current process priority; ΔCPU indicates the change in CPU usage during the current cycle; ΔI / O indicates the change in I / O frequency during the current cycle; α indicates the adjustment parameter used to control the sensitivity of priority adjustment.

[0117] The CPU affinity after adjustment and optimization is determined based on the following formula:

[0118]

[0119] Where: Affinity new Indicates the CPU affinity of the process after adjustment and optimization; Affinity current Indicates the current CPU affinity setting of the process; CPUload i It represents the load of the CPU core where process i is currently located; TotalCPUload represents the CPU load of the entire system; β represents the adjustment coefficient, which is used to control the range of affinity update.

[0120] As a non-limiting implementation, the method further includes:

[0121] Calculate the relative change rate of CPU usage after adjustment relative to that before adjustment, and the relative change rate of memory usage after adjustment relative to that before adjustment;

[0122] Performance change data is determined according to the relative change rate of the CPU usage and the relative change rate of the memory usage, and an adjustment effect is determined according to the performance change data.

[0123] Exemplarily, the performance change data is determined based on the following formula:

[0124]

[0125] Where: ΔPerformance i Performance change data before and after adjustment; CPU Usage new CPU Usage is the adjusted CPU usage. old They are respectively the CPU usage before adjustment; Memory Usage new Memory Usage is the adjusted memory usage. old and memory usage before and after adjustment, respectively. The effectiveness of the aforementioned configuration parameter adjustments can be determined based on performance change data. If the performance change data is significant, for example, exceeding a preset change data threshold, then the aforementioned configuration parameter adjustments are effective. If the performance change data is small, for example, not exceeding the change data threshold, then the aforementioned configuration parameters are ineffective and can be further adjusted and optimized.

[0126] In the embodiment of the present application, the process of adjusting the above configuration parameters is described in detail using I / O scheduling as an example:

[0127] Assume that the goal of the system is to optimize disk I / O latency, and the target value is set to The expected disk I / O latency is 50 milliseconds. If the current I / O latency is 80 milliseconds, the error is:

[0128] e IO (t) = 80ms - 50ms = 30ms;

[0129] The system calculates the gain factor K that needs to be adjusted IO And adjust it through the gain update rule; if the gain factor K IO (t-1) = 1.0; and the error e IO (t) is greater than the threshold ∈ IO , then the gain factor will increase. For example, using the gain increase rule:

[0130] K IO (t)=1.0+α IO ·|30|(α IO =0.1)

[0131] K IO (t) = 1.0 + 0.1·30 = 4.0

[0132] The I / O scheduling priority can be adjusted based on the calculated adjustment amount Δθ IO (t) = K IO ·e IO (t) update;

[0133] If the priority is 0.5 (in the range of 0 to 1), the adjusted priority is:

[0134]

[0135] By dynamically adjusting the gain factor based on the performance error, changes in I / O scheduling priorities can be finely controlled. Ultimately, the system optimizes the I / O scheduling strategy based on the adjusted I / O configuration, thereby improving system responsiveness and performance.

[0136] Figure 2 This is a structural diagram of a nano-kernel operating system dynamic configuration and hot update system provided in an embodiment of the present application. The system can execute the nano-kernel operating system dynamic configuration and hot update method provided in any embodiment of the present application, and has the corresponding functional modules and beneficial effects of the execution method. Figure 2 As shown, the system includes:

[0137] The data acquisition module 210 is used to obtain the target system state parameter exceeding the preset parameter threshold if the system state parameter exceeds the preset parameter threshold, and add a timestamp to obtain a system state parameter data set;

[0138] an abnormal system state parameter determination module 220 for calculating a moving average and a standard deviation for each target system state parameter in the system state parameter data set, and determining an abnormal system state parameter based on the target system state parameter, the moving average and the standard deviation;

[0139] a configuration parameter adjustment module 230 for determining, based on the abnormal system state parameter, a configuration parameter adjustment amount of a system module corresponding to the abnormal system state parameter, and adjusting the configuration parameter of the system module based on the configuration parameter adjustment amount;

[0140] The optimization and adjustment module 240 is used to optimize and adjust the CPU usage and I / O operation frequency of the system during operation after the configuration parameters of the system module are adjusted according to the configuration parameter adjustment amount, and to optimize and adjust the CPU affinity data according to the load of the CPU where the process is located and the total load of the CPU where all processes are located.

[0141] In the embodiment of the present application, the data acquisition module 210 is specifically used to:

[0142] The preset parameter threshold corresponding to the previous time node is multiplied by the dynamic adjustment ratio to obtain the preset parameter threshold corresponding to the next time node; wherein the dynamic adjustment ratio is greater than one and less than two.

[0143] In the embodiment of the present application, the abnormal system state parameter determination module 220 determines the abnormal system state parameter according to the target system state parameter, the moving average value, and the standard deviation, including:

[0144] Calculating the absolute value of the difference between the target system state parameter and the moving average value, and calculating the product of a threshold constant and the standard deviation;

[0145] If the absolute value of the difference is greater than the product of the standard deviations, it is determined that the target system state parameter is an abnormal system state parameter.

[0146] In the embodiment of the present application, the abnormal system state parameter determination module 220 is specifically used to:

[0147] For the continuous same target system state parameter in the system state parameter data set, determine the target system state parameter within the preset time window closest to the current time;

[0148] Calculating an average value of the target system state parameter within a preset time window as the moving average value;

[0149] The process of determining the standard deviation includes:

[0150] For each target system state parameter within the preset time window, the square of the difference between the target system state parameter and the moving average is calculated, and the mean of the squares corresponding to each target system state parameter is calculated and then the square root is taken.

[0151] In the embodiment of the present application, the configuration parameter adjustment module 230 determines, based on the abnormal system state parameter, the configuration parameter adjustment amount of the system module corresponding to the abnormal system state parameter, including:

[0152] For each abnormal system state parameter, determining a deviation value between the abnormal system state parameter and a preset target parameter;

[0153] The product of the deviation value and the gain factor is used as the configuration parameter adjustment amount.

[0154] In the embodiment of the present application, the configuration parameter adjustment module 230 is specifically used to:

[0155] If the deviation value is greater than the preset deviation threshold, a gain factor is added to the gain factor corresponding to the previous time node;

[0156] Otherwise, the gain factor is subtracted from the gain factor corresponding to the previous time node;

[0157] Wherein, the gain factor is the product of the gain update step length and the absolute value of the deviation value;

[0158] The gain update step size is expressed as:

[0159]

[0160] Where: α i (t) represents the gain update step size at the current moment; α i0 represents the initial gain update step size; λ1 represents the gain adjustment sensitivity factor; λ2 represents the convergence rate control factor; e i (t) represents the deviation value at the current time t; e i (t-1) represents the deviation value at the previous moment t-1; e max Indicates the maximum tolerance of the deviation value; δ1 and δ2 are smoothing factors, which are constants to prevent division by 0.

[0161] In the embodiment of the present application, the optimization and adjustment module 240 adjusts the configuration parameters of the system module based on the configuration parameter adjustment amount, including:

[0162] Based on the configuration parameter adjustment amount, creating a new version for each system module that needs to be updated, setting an update flag for the system module, and generating an update task;

[0163] The update task is executed to create a new version of the system module and adjust the configuration parameters of the system library.

[0164] In the embodiment of the present application, the optimization and adjustment module 240 optimizes and adjusts the CPU usage and I / O operation frequency of the system during operation after the configuration parameters of the system module are adjusted according to the configuration parameter adjustment amount, optimizes and adjusts the process priority data, and optimizes and adjusts the CPU affinity data according to the load of the CPU where the process is located and the total load of the CPUs where all processes are located, including:

[0165] The optimization adjustment coefficient of the process priority data is determined based on the ratio of the change in CPU usage to the change in I / O operation frequency in the current cycle and the product of the adjustment parameter;

[0166] Add the process priority data optimization adjustment coefficient to the current process priority data to obtain the optimized and adjusted process priority data;

[0167] The CPU affinity data optimization adjustment coefficient is determined based on the ratio of the CPU load of the process to the total CPU load of all processes multiplied by the adjustment coefficient.

[0168] The CPU affinity data optimization adjustment coefficient is added to the current CPU affinity data to obtain the optimized and adjusted CPU affinity data.

[0169] In the embodiment of the present application, the apparatus further includes a continuing adjustment module, configured to:

[0170] Calculate the relative change rate of CPU usage after adjustment relative to that before adjustment, and the relative change rate of memory usage after adjustment relative to that before adjustment;

[0171] Performance change data is determined according to the relative change rate of the CPU usage and the relative change rate of the memory usage, and an adjustment effect is determined according to the performance change data.

[0172] This application aims to improve system flexibility, efficiency, and stability by implementing dynamic configuration and hot updates within a nanokernel operating system. This method enables dynamic configuration updates within the nanokernel operating system by collecting and processing system status data in real time. This not only improves the system's responsiveness during operation but also ensures that the system can be optimized and upgraded without service interruption, thereby achieving the goals of improving system resource utilization and optimizing performance.

[0173] Figure 3A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.

[0174] like Figure 3 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., which is communicatively connected to the at least one processor 11. The memory stores a computer program that can be executed by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 into the random access memory (RAM) 13. Various programs and data required for the operation of the electronic device 10 can also be stored in the RAM 13. The processor 11, ROM 12, and RAM 13 are connected to each other via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0175] Multiple components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0176] The processor 11 can be any general-purpose and / or specialized processing component with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the method for dynamic configuration and hot update of the nanokernel operating system.

[0177] In some embodiments, the nano-kernel operating system dynamic configuration and hot update method can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the nano-kernel operating system dynamic configuration and hot update method described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to execute the nano-kernel operating system dynamic configuration and hot update method by any other appropriate means (for example, by means of firmware).

[0178] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on a chip (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system comprising at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0179] Computer programs for implementing the methods of the present application may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable communication system, such that when the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0180] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. A computer-readable storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0181] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0182] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0183] A computing system may include a client and a server. The client and server are typically remote from each other and typically interact via a dynamically configured and hot-updated network within a nanokernel operating system. This client-server relationship is established by computer programs running on the respective computers, establishing a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a host product within a cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services.

[0184] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this application can be performed in parallel, sequentially, or in a different order, as long as the desired information of the technical solution of this application can be achieved. This document is not limited here.

[0185] The above specific embodiments do not constitute a limitation on the scope of protection of this application. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application shall be included within the scope of protection of this application.

Claims

1. A method for dynamic configuration and hot update of a nanokernel operating system, characterized in that: The method comprises: If the system state parameter exceeds the preset parameter threshold, the target system state parameter exceeding the preset parameter threshold is obtained and a timestamp is added to obtain a system state parameter data set; Calculating a moving average and a standard deviation for each target system state parameter in the system state parameter data set, and determining an abnormal system state parameter based on the target system state parameter, the moving average and the standard deviation; determining, according to the abnormal system state parameter, a configuration parameter adjustment amount of a system module corresponding to the abnormal system state parameter, and adjusting the configuration parameter of the system module based on the configuration parameter adjustment amount; The CPU usage and I / O operation frequency of the system during operation after the configuration parameters of the system module are adjusted according to the configuration parameter adjustment amount are optimized and adjusted, and the CPU affinity data is optimized and adjusted according to the load of the CPU where the process is located and the total load of the CPU where all processes are located.

2. The method according to claim 1, characterized in that Determining the preset parameter threshold includes: The preset parameter threshold corresponding to the previous time node is multiplied by the dynamic adjustment ratio to obtain the preset parameter threshold corresponding to the next time node; wherein the dynamic adjustment ratio is greater than one and less than two.

3. The method according to claim 1, characterized in that Determine abnormal system status parameters based on target system status parameters, moving averages, and standard deviations, including: Calculating the absolute value of the difference between the target system state parameter and the moving average value, and calculating the product of a threshold constant and the standard deviation; If the absolute value of the difference is greater than the product of the standard deviations, it is determined that the target system state parameter is an abnormal system state parameter.

4. The method according to claim 1, wherein The process of determining the moving average includes: For the continuous same target system state parameter in the system state parameter data set, determine the target system state parameter within the preset time window closest to the current time; Calculating an average value of the target system state parameter within a preset time window as the moving average value; The process of determining the standard deviation includes: For each target system state parameter within the preset time window, the square of the difference between the target system state parameter and the moving average is calculated, and the mean of the squares corresponding to each target system state parameter is calculated and then the square root is taken.

5. The method according to claim 1, wherein Determining, according to the abnormal system state parameter, a configuration parameter adjustment amount of a system module corresponding to the abnormal system state parameter, comprising: For each abnormal system state parameter, determining a deviation value between the abnormal system state parameter and a preset target parameter; The product of the deviation value and the gain factor is used as the configuration parameter adjustment amount.

6. The method according to claim 5, characterized in that The process of determining the gain factor includes: If the deviation value is greater than the preset deviation threshold, a gain factor is added to the gain factor corresponding to the previous time node; Otherwise, the gain factor is subtracted from the gain factor corresponding to the previous time node; Wherein, the gain factor is the product of the gain update step length and the absolute value of the deviation value; The gain update step size is expressed as: Where: α i (t) represents the gain update step size at the current moment; α i0 represents the initial gain update step size; λ1 represents the gain adjustment sensitivity factor; λ2 represents the convergence rate control factor; e i (t) represents the deviation value at the current time t; e i (t-1) represents the deviation value at the previous moment t-1; e max Indicates the maximum tolerance of the deviation value; δ1 and δ2 are smoothing factors, which are constants to prevent division by 0.

7. The method according to claim 1, characterized in that Adjusting the configuration parameters of the system module based on the configuration parameter adjustment amount includes: Based on the configuration parameter adjustment amount, creating a new version for each system module that needs to be updated, setting an update flag for the system module, and generating an update task; The update task is executed to create a new version of the system module and adjust the configuration parameters of the system library.

8. The method according to claim 1, characterized in that The method includes optimizing and adjusting the CPU usage and I / O operation frequency of the system during operation after the configuration parameters of the system module are adjusted according to the configuration parameter adjustment amount, optimizing and adjusting the process priority data, and optimizing and adjusting the CPU affinity data according to the load of the CPU where the process is located and the total load of the CPUs where all processes are located, including: The optimization adjustment coefficient of the process priority data is determined based on the ratio of the change in CPU usage to the change in I / O operation frequency in the current cycle and the product of the adjustment parameter; Add the process priority data optimization adjustment coefficient to the current process priority data to obtain the optimized and adjusted process priority data; The CPU affinity data optimization adjustment coefficient is determined based on the ratio of the CPU load of the process to the total CPU load of all processes multiplied by the adjustment coefficient. The CPU affinity data optimization adjustment coefficient is added to the current CPU affinity data to obtain the optimized and adjusted CPU affinity data.

9. The method according to claim 1, characterized in that The method further comprises: Calculate the relative change rate of CPU usage after adjustment relative to that before adjustment, and the relative change rate of memory usage after adjustment relative to that before adjustment; Performance change data is determined according to the relative change rate of the CPU usage and the relative change rate of the memory usage, and an adjustment effect is determined according to the performance change data.

10. A nanokernel operating system dynamic configuration and hot update system, characterized in that: The system comprises: The data acquisition module is used to obtain the target system state parameter exceeding the preset parameter threshold if the system state parameter exceeds the preset parameter threshold, and add a timestamp to obtain a system state parameter data set; an abnormal system state parameter determination module, configured to calculate a moving average and a standard deviation for each target system state parameter in the system state parameter data set, and determine the abnormal system state parameter based on the target system state parameter, the moving average and the standard deviation; a configuration parameter adjustment module, configured to determine, according to the abnormal system state parameter, a configuration parameter adjustment amount of a system module corresponding to the abnormal system state parameter, and adjust the configuration parameter of the system module based on the configuration parameter adjustment amount; The optimization and adjustment module is used to optimize and adjust the CPU usage and I / O operation frequency of the system during operation after the configuration parameters of the system module are adjusted according to the configuration parameter adjustment amount, optimize and adjust the process priority data, and optimize and adjust the CPU affinity data according to the load of the CPU where the process is located and the total load of the CPU where all processes are located.

Citation Information

Cited By

  • Automatic updating method and device of power equipment data model, equipment and medium

    CN120723784A