Power management method and device of microkernel operating system, storage medium and operating system
Patent Information
- Application Number
- CN202211279892.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-19
- Publication Date
- 2026-10-16
- Estimated Expiration
- 2042-10-19
AI Technical Summary
[0004]本申请的目的在于提供一种微内核操作系统的功耗管理方法、装置、存储介质和操作系统,以解决现有技术中微内核操作系统中功耗管理模式需要进行大量进程间数据交互导致的系统资源占用过高,影响系统性能的技术问题
[0037]In this application, shared information, including device information of at least one hardware device, its current power consumption mode, and its target power consumption mode, is stored in shared memory. Each hardware device's driver process can access its corresponding shared information, enabling the sharing of the hardware device's current and target power consumption information between the power management service process and the hardware device's driver process. Upon receiving a mode switching signal, the device information and the power consumption mode to be switched are obtained, and the power consumption mode to be switched is written into the target power consumption mode in the corresponding shared information. After obtaining the current power consumption mode of the hardware device, the current power consumption mode and the target power consumption mode of each hardware device are compared to determine the hardware device requiring mode switching as the controlled hardware device. That is, if the current power consumption mode and the target power consumption mode are different, mode switching needs to be performed, and this type of hardware device is designated as the controlled hardware device. Then, a mode switching command is sent to the driver module of the controlled hardware device. Since each hardware device's driver process has permission to access the shared information, the driver process of the controlled hardware device can obtain the corresponding target power consumption mode after accessing the shared information and perform mode switching automatically. In this solution, shared information is directly used as the information carrier, which can be directly accessed by the power management service process and the driver process of the hardware device. This avoids unnecessary inter-process communication between the power management service process and each driver process for switching execution modes, simplifies the switching process, releases system resources, and improves the performance of the system power management function.
Smart Images

Figure CN117908660B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of power management technology for microkernel operating systems, and more particularly to a power management method, apparatus, storage medium, and operating system for a microkernel operating system. Background Technology
[0002] A typical system includes various hardware devices, such as processors, memory, various interfaces, and peripheral hardware devices. System power management is the power management of various hardware devices in the system. The power consumption of each hardware device is maintained and managed by its own driver module. Its power consumption modes include normal operation mode, short rest mode (short-term hibernation) and sleep mode.
[0003] To achieve system power consumption management, a power management service process is created in the microkernel operating system to manage and maintain the system's power consumption modes. When the power management service process detects trigger events such as excessively high system temperature or low battery, it switches the system's power consumption mode. This is mainly done by communicating with the driver modules of various hardware devices, controlling the driver modules to switch the hardware devices to the corresponding power consumption mode. For example, when low battery is detected, the power consumption mode of some hardware devices can be controlled to switch from normal operation mode to rest mode to reduce power consumption. However, since the power management service process cannot determine the current power consumption mode of the hardware devices when it detects a trigger event, it cannot determine whether to perform a power consumption mode switching operation for each hardware device. At this time, the power management service process needs to obtain the current power consumption mode of all hardware devices through inter-process communication requests. Similarly, when the driver module of a hardware device receives a mode switching instruction sent by the power management service process, it must also determine the switched power consumption mode contained in the mode switching instruction through inter-process communication. Obviously, the above power consumption mode switching process requires a large amount of inter-process communication transmission between the power management service process and the driver module of at least one hardware device, consuming high system resources and leading to a decrease in system performance. Summary of the Invention
[0004] The purpose of this application is to provide a power management method, device, storage medium, and operating system for a microkernel operating system, in order to solve the technical problem that the power management mode of the existing microkernel operating system requires a large amount of inter-process data interaction, resulting in excessive system resource consumption and affecting system performance.
[0005] Firstly, the technical solution of this application provides a power management method for a microkernel operating system, including:
[0006] In response to a mode switching signal, acquire device information of at least one hardware device and the power consumption mode to be switched;
[0007] Obtain the current power consumption mode of the hardware device recorded in the shared information; the shared information includes at least one entry, each entry of the shared information is used to record the device information, current power consumption mode and target power consumption mode of a hardware device; the shared information is stored in the shared memory of the microkernel operating system;
[0008] Based on the device information of each hardware device, write the power consumption mode to be switched into the target power consumption mode in the corresponding shared information;
[0009] Compare the current power consumption mode and the target power consumption mode of each hardware device. If the current power consumption mode and the target power consumption mode of any hardware device are different, then it is regarded as the controlled hardware device.
[0010] A mode switching instruction is sent to the driver module of the controlled hardware device, so that the driver process of the controlled hardware accesses the corresponding shared information according to the pre-configured access permissions, extracts the corresponding target function mode, and controls the controlled hardware device to switch to its corresponding target power consumption mode.
[0011] In some solutions for power management methods of microkernel operating systems, the step of obtaining the current power consumption mode of the hardware device recorded in the shared information includes:
[0012] The current power consumption mode of the hardware device in the shared information is written by the driver process of the corresponding hardware device.
[0013] In some solutions for power management methods of microkernel operating systems, the step of obtaining the current power consumption mode of the hardware device recorded in the shared information includes:
[0014] The current power consumption mode of the hardware device in the shared information is the power consumption mode to be switched obtained when the hardware device responded to the mode switching signal the previous time.
[0015] In some solutions, the power management method for a microkernel operating system includes the step of obtaining device information of at least one hardware device and the power mode to be switched in response to a mode switching signal, which includes:
[0016] The mode setting information input by the user is obtained as the mode switching signal. The mode setting information records the device information of at least one hardware device and the power consumption mode to be switched.
[0017] In some solutions, the power management method for a microkernel operating system includes the step of obtaining device information of at least one hardware device and the power mode to be switched in response to a mode switching signal, which includes:
[0018] Monitor the operating status parameters of the microkernel operating system, including temperature and power consumption;
[0019] If the operating status parameters are not within the preset parameter range, it is determined that a trigger event has been detected and a mode switching signal has been received.
[0020] The corresponding power consumption mode to be switched for the hardware device is obtained from the shared memory based on the detected trigger event; the shared information pre-stores the correspondence between the trigger event and the power consumption mode to be switched for at least one hardware device.
[0021] In some solutions, the power management method for a microkernel operating system includes, before sending a mode switching instruction to the driver module of the controlled hardware device, enabling the driver process of the controlled hardware to access the corresponding shared information according to pre-configured access permissions, extract the corresponding target function mode, and control the controlled hardware device to switch to its corresponding target power mode, the following steps are taken:
[0022] Configure the access permissions of the driver process of at least one hardware device to the shared information, so that the driver process of each hardware device can only access the shared information corresponding to it.
[0023] In some solutions for power management methods of microkernel operating systems, the step of configuring access permissions for the driver process of at least one hardware device to the shared information, so that the driver process of each hardware device can only access the shared information corresponding to it:
[0024] Set up an access link for each access interface of shared information;
[0025] Each access link is associated with the device information of the corresponding hardware device and then stored in the dynamic library of the microkernel operating system.
[0026] Configure the link permissions of the driver process for at least one hardware device so that the driver process for each hardware device can only link to the access links in the dynamic library associated with its device information.
[0027] Secondly, the technical solution of this application provides a power management device for a microkernel operating system, comprising:
[0028] The target information acquisition module is used to acquire device information of at least one hardware device and the power consumption mode to be switched in response to the mode switching signal.
[0029] The current information acquisition module is used to acquire the current power consumption mode of the hardware device recorded in the shared information; the shared information includes at least one piece, and each piece of shared information is used to record the device information, current power consumption mode and target power consumption mode of a hardware device; the shared information is stored in the shared memory of the microkernel operating system;
[0030] The target information writing module is used to write the power consumption mode to be switched of each hardware device into the target power consumption mode in the corresponding shared information according to the device information of each hardware device.
[0031] The information comparison module is used to compare the current power consumption mode and the target power consumption mode of each hardware device. If the current power consumption mode and the target power consumption mode of any hardware device are different, then it is regarded as the controlled hardware device.
[0032] The mode switching module is used to send a mode switching instruction to the driver module of the controlled hardware device, so that the driver process of the controlled hardware accesses the corresponding shared information according to the pre-configured access permissions, extracts the corresponding target function mode, and controls the controlled hardware device to switch to its corresponding target power consumption mode.
[0033] Thirdly, the present application provides a storage medium storing program information, wherein a computer reads the program information and executes the power management method of the microkernel operating system described in any one of the first aspects.
[0034] Fourthly, the present application provides an electronic device, including at least one processor and at least one memory, wherein at least one memory stores program information, and at least one processor reads the program information and executes the power management method of the microkernel operating system described in any one of the first aspects.
[0035] Fifthly, the present application provides an operating system, which is a microkernel operating system, and the operating system includes the power management device of the microkernel operating system described in the second aspect, or the storage medium described in the third aspect, or the electronic device described in the fourth aspect.
[0036] The above technical solution has the following beneficial effects:
[0037] In this application, shared information, including device information of at least one hardware device, its current power consumption mode, and its target power consumption mode, is stored in shared memory. Each hardware device's driver process can access its corresponding shared information, enabling the sharing of the hardware device's current and target power consumption information between the power management service process and the hardware device's driver process. Upon receiving a mode switching signal, the device information and the power consumption mode to be switched are obtained, and the power consumption mode to be switched is written into the target power consumption mode in the corresponding shared information. After obtaining the current power consumption mode of the hardware device, the current power consumption mode and the target power consumption mode of each hardware device are compared to determine the hardware device requiring mode switching as the controlled hardware device. That is, if the current power consumption mode and the target power consumption mode are different, mode switching needs to be performed, and this type of hardware device is designated as the controlled hardware device. Then, a mode switching command is sent to the driver module of the controlled hardware device. Since each hardware device's driver process has permission to access the shared information, the driver process of the controlled hardware device can obtain the corresponding target power consumption mode after accessing the shared information and perform mode switching automatically. In this solution, shared information is directly used as the information carrier, which can be directly accessed by the power management service process and the driver process of the hardware device. This avoids unnecessary inter-process communication between the power management service process and each driver process for switching execution modes, simplifies the switching process, releases system resources, and improves the performance of the system power management function. Attached Figure Description
[0038] Figure 1 This is a flowchart of a power management method for a microkernel operating system in one embodiment of this application;
[0039] Figure 2 This is a schematic diagram illustrating the access to shared information by the power management service process and the hardware device driver process according to an embodiment of this application;
[0040] Figure 3 This is a schematic diagram illustrating the isolated access method for shared information by the driver processes of different hardware devices according to an embodiment of this application;
[0041] Figure 4 This is a structural block diagram of a power management device for a microkernel operating system according to an embodiment of this application;
[0042] Figure 5 This is a schematic diagram of the hardware connections of an electronic device that executes a power management method for a microkernel operating system according to an embodiment of this application. Detailed Implementation
[0043] The specific embodiments of this application will be further described below with reference to the accompanying drawings.
[0044] It is readily understood that, based on the technical solution of this application, various structural and implementation methods can be interchanged by those skilled in the art without altering the essential spirit of this application. Therefore, the following detailed embodiments and accompanying drawings are merely illustrative examples of the technical solution of this application and should not be considered as the entirety of this application or as limitations or restrictions on the technical solution of the application.
[0045] The directional terms such as up, down, left, right, front, back, front, back, top, and bottom mentioned or possibly used in this specification are defined relative to the structures shown in the accompanying drawings. They are relative concepts and may therefore vary depending on their location and usage. Therefore, these or other directional terms should not be interpreted as restrictive.
[0046] The technical terms used in the following embodiments of the present invention are explained as follows:
[0047] Microkernel: A microkernel is a simplified form of kernel that separates the system service layer, which is usually integrated with the kernel, into an optional layer that can be added as needed. This provides better scalability and a more efficient application environment. The concept of a microkernel is proposed in contrast to a monolithic kernel. In a monolithic kernel, various system services are implemented in the kernel address space, and user calls to system services are made through system calls. References from one system service to another can be made directly through function calls. In contrast, the kernel space of a microkernel operating system only provides basic services such as process scheduling and memory management; other services are provided by the operating system's user space. Therefore, the power management method provided in the following embodiments of this application is designed for the aforementioned special case in a microkernel operating system. Specifically, during power management, data communication is required between the power management service process in the kernel and the driver processes of various peripheral device driver modules to execute. This improvement addresses the problems of excessive data communication volume and excessive system resource consumption in such cases.
[0048] This embodiment provides a power management method for a microkernel operating system, which can be applied to the power management service process (Power Manager) in a microkernel operating system, such as... Figure 1 and Figure 2 As shown, it includes:
[0049] S10: In response to a mode switching signal, acquire device information of at least one hardware device and the power consumption mode to be switched.
[0050] A mode switching signal is an instruction signal that requires one, some, or all hardware devices to switch to the current power consumption mode. This signal can be set by the user or triggered by external events, such as system overheating or low battery.
[0051] S20: Obtain the current power consumption mode of the hardware device recorded in the shared information; the shared information includes multiple entries, each entry of which records the device information, current power consumption mode, and target power consumption mode of a hardware device; the shared information is stored in the shared memory of the microkernel operating system.
[0052] One feasible approach is to set a parameter for each of the two power consumption modes in the shared information. For example, `current_state` could represent the current power consumption mode, and `power_change_info` could represent the target power consumption mode. Each hardware device includes the processor, memory, and peripheral hardware devices in the system. During the initialization phase, the current power consumption mode of the hardware device in the shared information can be initialized and updated by the corresponding hardware device's driver module, or the power management service process can collect the existing current power consumption mode from the driver module and write it into the shared information. The target power consumption mode for each hardware device can only be obtained after the power management service process determines and writes the power consumption mode to be switched. Therefore, in the initial stage, the target power consumption mode is in a pending state. The shared information can be stored in a segment of shared memory. The storage space can be a contiguous memory region, and different shared information will have different storage addresses in the memory region. Using a contiguous memory region to store shared information offers greater convenience and storage space utilization efficiency. Furthermore, it makes the allocation of storage addresses for shared information from different hardware devices more convenient.
[0053] S30: Based on the device information of each hardware device, write the power consumption mode to be switched into the target power consumption mode in the corresponding shared information.
[0054] In step S10, the power consumption modes to be switched for each hardware device have been obtained. Therefore, the target power consumption mode corresponding to the corresponding device information is found in the shared information, and written according to the power consumption mode to be switched in step S10. After this step, the current power consumption mode and target power consumption mode of the corresponding hardware device are recorded in each shared information.
[0055] S40: Compare the current power consumption mode and the target power consumption mode of each hardware device. If the current power consumption mode and the target power consumption mode of any hardware device are different, then it is regarded as the controlled hardware device.
[0056] In other words, for each hardware device, if the current power consumption mode and the target power consumption mode are the same, then it means that there is no need to switch the power consumption mode of that hardware device. Therefore, this step can determine whether a mode switching operation needs to be performed on the hardware device. If a mode switching is not required, there is no need to send a power consumption mode switching instruction to the driver module of that hardware device. Only when the power consumption mode of a hardware device needs to be switched will that hardware device be selected as the controlled hardware device.
[0057] S50: Send a mode switching instruction to the driver module of the controlled hardware device, so that the driver process of the controlled hardware accesses the corresponding shared information according to the pre-configured access permissions, extracts the corresponding target function mode, and controls the controlled hardware device to switch to its corresponding target power consumption mode.
[0058] like Figure 2 As shown, the hardware devices may include A, B, and C. Each hardware device is configured with a driver module, which can access its corresponding shared information through the driver process. Accordingly, the shared information corresponding to hardware device A records the device information, current power consumption mode, and target power consumption mode of hardware device A; the shared information corresponding to hardware device B records the device information, current power consumption mode, and target power consumption mode of hardware device B; and the shared information corresponding to hardware device C records the device information, current power consumption mode, and target power consumption mode of hardware device C. In step S30, the target power consumption mode corresponding to the controlled hardware device has been set in the shared information. In this step, the power management service process sends a switching command to the driver module of the controlled hardware device. The driver process of the controlled hardware device then accesses the corresponding shared information and obtains its corresponding target power consumption mode. For the controlled hardware device, the driver module can determine its current power consumption mode. After obtaining the target power consumption mode, the driver module can determine whether the target power consumption mode of the controlled hardware device is different from the current power consumption mode. If they are different, the driver module can switch the power consumption mode.
[0059] The above solution provided in this embodiment stores shared information, including device information, current power consumption mode, and target power consumption mode, in shared memory. Each hardware device's driver process can access its corresponding shared information, enabling the sharing of the hardware device's current and target power consumption information between the power management service process and the hardware device's driver process. Upon receiving a mode switching signal, the device information and the power consumption mode to be switched are obtained, and the power consumption mode to be switched is written into the target power consumption mode in the corresponding shared information. After obtaining the hardware device's current power consumption mode, the hardware device requiring mode switching is determined by comparing the current and target power consumption modes. That is, if the current and target power consumption modes are different, mode switching is required, and this type of hardware device is designated as the controlled hardware device. Then, a mode switching command is sent to the controlled hardware device's driver module. Since the hardware device's driver process has permission to access the shared information, the controlled hardware device's driver process can obtain the corresponding target power consumption mode from the shared information after accessing it and automatically perform the mode switching. In this solution, shared information is directly used as the information carrier, which can be directly accessed by the power management service process and the driver process of the hardware device. This avoids unnecessary inter-process communication between the power management service process and the driver process for switching execution modes, simplifies the switching process, releases system resources, and improves the performance of the system power management function.
[0060] As mentioned earlier, the mode switching signal can be obtained in different forms, and correspondingly, the power consumption mode to be switched by the hardware device can also be obtained in different ways. Specifically, it can include the following methods:
[0061] If the mode switching signal is set by the user, the user sets the power consumption mode to be switched of the hardware device at the same time as setting the mode switching signal. At this time, the mode switching signal is input from the user state, and the power management service process can directly obtain the mode setting information input from the user state as the mode switching signal. The mode setting information includes device information of at least one hardware device and the power consumption mode to be switched.
[0062] If the mode switching signal is triggered by a trigger event, the power consumption mode to be switched for at least one hardware device is a predefined power consumption mode corresponding to the trigger event. Therefore, upon receiving a mode switching signal, the power management service process can determine the power consumption mode to be switched for at least one hardware device based on the different forms of the mode switching signal. At this time, the operating status parameters of the microkernel operating system can be monitored. When the operating status parameters of the microkernel operating system are detected to be outside the preset parameter range, a trigger event is detected, and a mode switching signal is responded to. The corresponding power consumption mode to be switched for at least one hardware device is retrieved from the shared memory based on the detected trigger event. The preset parameter range is a pre-set parameter, and its specific value can be determined after calibration tests on various trigger events to ensure normal system operation. Therefore, a temperature parameter is set for a high-temperature trigger event, and a power parameter is set for a low-battery trigger event. When the system temperature or battery level reaches the above parameters, it is determined that a mode switch needs to be performed. For different trigger events, the power consumption mode to be switched for at least one hardware device is pre-determined and stored in shared memory. This allows the power consumption mode to be determined directly based on the trigger event. For example, when the battery is low, some functions of some hardware devices can be selectively disabled according to their functional importance, thereby reducing power consumption. In this case, the power consumption mode of these hardware devices can be controlled to switch from normal operation mode to sleep mode. After determining the power consumption mode to be switched for at least one hardware device, it can be written into the corresponding target power consumption mode in the shared memory based on the device information mapping.
[0063] In some solutions, the mode switching signal can also be implemented by periodic triggering, in which case the power consumption mode to be switched for at least one hardware device is pre-stored. For example, two time points are preset. At the first time point, the power consumption mode of a certain hardware device is switched from normal operation mode to rest mode. At the second time point, the power consumption mode of the hardware device is switched back from rest mode to normal operation mode.
[0064] Additionally, the current power consumption mode included in the shared information can be obtained in the following way:
[0065] (1) The current power consumption mode of the hardware device in the shared information is written by the driver process of the corresponding hardware device.
[0066] Each piece of shared information records the current power consumption mode and target power consumption mode of the corresponding hardware device. As a preferred embodiment, the current power consumption mode of the hardware device in the shared information is written by the driver process of the corresponding hardware device. Since each hardware device's driver process has permission to access the corresponding shared information, it can write its current power consumption mode into the corresponding shared information.
[0067] (2) The current power consumption mode of the hardware device in the shared information is the power consumption mode to be switched of the hardware device obtained when the mode switching signal was received last time.
[0068] Under normal circumstances, after a mode switch is completed, the latest current power consumption mode of the hardware device should be its corresponding target power consumption mode. That is, the power consumption mode to be switched to, which was obtained when the mode switch signal was received last time, can be updated to the current power consumption mode. This simplifies the process of updating shared information.
[0069] Furthermore, prior to step S50, the method may further include the following step: configuring access permissions for the driver process of at least one hardware device to the shared information, such that the driver process of each hardware device can only access the shared information corresponding to it. Figure 3 As shown, the driver process for hardware device A can only access the shared information corresponding to hardware device A, the driver process for hardware device B can only access the shared information corresponding to hardware device B, and the driver process for hardware device C can only access the shared information corresponding to hardware device C. Implementing isolated access for different access objects within the same shared information avoids the hardware device reading an incorrect target power consumption mode, ensuring accuracy during power consumption mode switching.
[0070] In some solutions, access permissions for the shared information to the driver process of at least one hardware device can be configured in the following manner:
[0071] S601: Set up an access link for each access interface of shared information;
[0072] Since each piece of shared information corresponds to a storage address in shared memory, the access link in this step directly corresponds to its storage address.
[0073] S602: Each access link is associated with the device information of the corresponding hardware device and stored in the dynamic library of the microkernel operating system;
[0074] Dynamic libraries, also known as dynamic link libraries, are a common database type in microkernel systems. Dynamic libraries contain code and data that can be used by multiple processes simultaneously, facilitating data and resource sharing. They allow a process to directly access the memory address corresponding to the code or data by linking to the code or data in the dynamic library. This step utilizes this feature of dynamic libraries to encapsulate the access link for each shared piece of information into a dynamic library.
[0075] S603: Configure the link permissions of the driver process of at least one hardware device, so that the driver process of each hardware device can only link to the access links in the dynamic library associated with its device information.
[0076] Through this step, the driver process of each hardware device can only link to access links for the same device information, thus only being able to access the access interface for its corresponding shared information. The access connection corresponding to the access interface is encapsulated in a dynamic library, and each process accesses the shared information by linking to the dynamic library, thereby improving the flexibility and security of accessing shared information.
[0077] Some embodiments of this application also provide a power management device for a microkernel operating system, such as... Figure 4 As shown, it includes:
[0078] The target information acquisition module 10 is used to acquire device information of at least one hardware device and the power consumption mode to be switched in response to the mode switching signal.
[0079] The current information acquisition module 20 is used to acquire the current power consumption mode of the hardware device recorded in the shared information; the shared information includes multiple entries, each of which records the device information, current power consumption mode, and target power consumption mode of a hardware device; the shared information is stored in the shared memory of the microkernel operating system.
[0080] The target information writing module 30 is used to write the power consumption mode to be switched of each hardware device into the target power consumption mode in the corresponding shared information according to the device information of each hardware device.
[0081] The information comparison module 40 is used to compare the current power consumption mode and the target power consumption mode of each hardware device. If the current power consumption mode and the target power consumption mode of any hardware device are different, then it is regarded as the controlled hardware device.
[0082] The mode switching module 50 is used to send a mode switching instruction to the driver module of the controlled hardware device, so that the driver process of the controlled hardware accesses the corresponding shared information according to the pre-configured access permissions, extracts the corresponding target function mode, and controls the controlled hardware device to switch to its corresponding target power consumption mode.
[0083] The apparatus provided in this embodiment stores shared information, including device information, current power consumption mode, and target power consumption mode, in shared memory. Each hardware device's driver process can access its corresponding shared information, enabling the sharing of current and target power consumption information between the power management service process and the hardware device's driver process. Upon receiving a mode switching signal, the device information and the power consumption mode to be switched are obtained, and the power consumption mode to be switched is written into the target power consumption mode in the corresponding shared information. After obtaining the current power consumption mode of the hardware device, the current power consumption mode and the target power consumption mode are compared to determine the hardware device requiring mode switching as the controlled hardware device. That is, if the current power consumption mode and the target power consumption mode are different, mode switching needs to be performed, and this type of hardware device is designated as the controlled hardware device. Then, a mode switching command is sent to the driver module of the controlled hardware device. Since each hardware device's driver process has permission to access the corresponding shared information, the driver process of the controlled hardware device can obtain the corresponding target power consumption mode from the corresponding shared information after accessing it and perform mode switching automatically. In this solution, shared information is directly used as the information carrier, which can be directly accessed by the power management service process and the driver processes of each hardware device. This avoids unnecessary inter-process communication between the power management service process and each driver process for performing mode switching, simplifies the switching process, releases system resources, and improves the performance of the system power management function.
[0084] In some solutions, the mode switching signal in the target information acquisition module 10 can be obtained in different forms, and correspondingly, the power consumption mode to be switched for at least one hardware device can also be obtained in different ways. The target information acquisition module 10 acquires user-mode input mode setting information as the mode switching signal. The mode setting information includes device information of at least one hardware device and the power consumption mode to be switched. If the mode switching signal is user-defined, the user sets the power consumption mode to be switched for the hardware device simultaneously with setting the mode switching signal; in this case, the mode switching signal is input from user mode. Alternatively, the target information acquisition module 10 monitors the running status parameters of the microkernel operating system. When the running status parameters of the microkernel operating system are detected to be outside the preset parameter range, it determines that a trigger event has been detected and determines to respond to the mode switching signal; based on the detected trigger event, it obtains the corresponding power consumption mode to be switched for at least one hardware device from the shared memory. If the mode switching signal is triggered by a trigger event, the power consumption mode to be switched for at least one hardware device is a predefined power consumption mode corresponding to the trigger event. Therefore, upon responding to the mode switching signal, the power management service process can determine the power consumption mode to be switched for the hardware device based on the different forms of the mode switching signal. The preset parameter range consists of pre-defined parameters, whose specific values can be determined after calibration tests on various trigger events, provided that the system can operate normally. For different trigger events, the power consumption modes to be switched by the hardware devices are pre-determined and stored in shared memory. This allows the power consumption mode to be switched by the hardware devices to be determined directly based on the trigger event.
[0085] In some solutions, in the current information acquisition module 20, the current power consumption mode of the hardware device in the shared information is written by the driver process of the corresponding hardware device. Each piece of shared information records the current power consumption mode and the target power consumption mode of the corresponding hardware device. As a preferred solution, the current power consumption mode of the hardware device in the shared information is written by the driver process of the corresponding hardware device. Since each hardware device's driver process has the permission to access the corresponding shared information, the driver process of the hardware device can write its current power consumption mode into the corresponding shared information. Alternatively, in the current information acquisition module 20, the current power consumption mode of the hardware device in the shared information is the power consumption mode to be switched of the hardware device obtained when responding to the previous mode switching signal. Generally, after performing a mode switch, the latest current power consumption mode of the hardware device should be its current target power consumption mode. That is, the power consumption mode to be switched of the hardware device obtained when responding to the previous mode switching signal can be updated to the current power consumption mode. This simplifies the update process of the shared information.
[0086] Furthermore, the aforementioned device may also include a configuration module for configuring the access permissions of the driver process of at least one hardware device to the shared information, so that the driver process of each hardware device can only access the shared information corresponding to it. This achieves isolated access for different access objects within the same shared information, preventing the hardware device from reading an incorrect target power consumption mode and ensuring accuracy during power consumption mode switching.
[0087] Specifically, the configuration module sets up an access link for each shared information access interface; it associates each access link with the device information of the corresponding hardware device and stores it in the dynamic library of the microkernel operating system; it configures the link permissions of the driver process of at least one hardware device, so that the driver process of each hardware device can only link to the access link associated with its device information in the dynamic library. Since each piece of shared information corresponds to a storage address in shared memory, the access link in this step directly corresponds to its storage address. Encapsulating the access link corresponding to each shared information into the dynamic library, each hardware device can only link to the access link of the same device information, thus only being able to access the access interface of its corresponding shared information. Encapsulating the access link corresponding to the access interface into the dynamic library, each process accesses the shared information by linking to the dynamic library according to its link permissions, thereby improving the flexibility and security of shared information during access.
[0088] In some embodiments of this application, a storage medium is also provided, wherein program information is stored in the storage medium, and after the computer reads the program information, it executes the power management method of the microkernel operating system described in any of the above schemes.
[0089] Some embodiments of this application also provide an electronic device, such as... Figure 5 As shown, the electronic device includes at least one processor 51 and at least one memory 52. The at least one memory 52 stores program information. After reading the program information, the at least one processor 51 executes the power management method of the microkernel operating system described above. The electronic device may further include an input device 53 and an output device 54. The processor 51, memory 52, input device 53, and output device 54 can be communicatively connected. The memory 52, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. The processor 51 executes various functional applications and data processing by running the non-volatile software programs, instructions, and modules stored in the memory 52, thereby implementing the power management method of the microkernel operating system provided by any of the above schemes.
[0090] In some embodiments of this application, an operating system is also provided. The operating system is a microkernel operating system, and the operating system includes the power management device of the microkernel operating system described in the above embodiments, or the storage medium described in the above embodiments, or the electronic device described in the above embodiments.
[0091] As needed, the above technical solutions can be combined to achieve the best technical effect.
[0092] The above are merely the principles and preferred embodiments of this application. It should be noted that, for those skilled in the art, several other modifications can be made based on the principles of this application, and these modifications should also be considered within the scope of protection of this application.
Claims
1. A power management method for a microkernel operating system, characterized in that, include: In response to a mode switching signal, acquire device information of at least one hardware device and the power consumption mode to be switched; Obtain the current power consumption mode of the hardware device recorded in the shared information; the shared information includes at least one entry, each entry of the shared information is used to record the device information, current power consumption mode and target power consumption mode of a hardware device; the shared information is stored in the shared memory of the microkernel operating system; Based on the device information of each hardware device, write the power consumption mode to be switched into the target power consumption mode in the corresponding shared information; Compare the current power consumption mode and the target power consumption mode of each hardware device. If the current power consumption mode and the target power consumption mode of any hardware device are different, then it is regarded as the controlled hardware device. A mode switching instruction is sent to the driver module of the controlled hardware device, so that the driver process of the controlled hardware accesses the corresponding shared information according to the pre-configured access permissions, extracts the corresponding target function mode, and controls the controlled hardware device to switch to its corresponding target power consumption mode.
2. The power management method for a microkernel operating system according to claim 1, characterized in that, In the step of obtaining the current power consumption mode of the hardware device recorded in the shared information: The current power consumption mode of the hardware device in the shared information is written by the driver process of the corresponding hardware device.
3. The power management method for a microkernel operating system according to claim 1, characterized in that, In the step of obtaining the current power consumption mode of the hardware device recorded in the shared information: The current power consumption mode of the hardware device in the shared information is the power consumption mode to be switched obtained when the hardware device responded to the mode switching signal the previous time.
4. The power management method for a microkernel operating system according to claim 1, characterized in that, The step of obtaining device information of at least one hardware device and the power consumption mode to be switched in response to a mode switching signal includes: The mode setting information input by the user is obtained as the mode switching signal. The mode setting information records the device information of at least one hardware device and the power consumption mode to be switched.
5. The power management method for a microkernel operating system according to claim 1, characterized in that, The step of obtaining device information of at least one hardware device and the power consumption mode to be switched in response to a mode switching signal includes: Monitor the operating status parameters of the microkernel operating system, including temperature and power consumption; If the operating status parameters are not within the preset parameter range, it is determined that a trigger event has been detected and a mode switching signal has been received. The power consumption mode to be switched for each hardware device is obtained from the shared memory based on the detected trigger events; the shared information pre-stores the correspondence between trigger events and the power consumption mode to be switched for at least one hardware device.
6. The power management method for a microkernel operating system according to claim 1, characterized in that, Before sending a mode switching command to the driver module of the controlled hardware device, enabling the driver process of the controlled hardware to access the corresponding shared information according to pre-configured access permissions, extract the corresponding target function mode, and control the controlled hardware device to switch to its corresponding target power consumption mode, the process includes: Configure the access permissions of the driver processes of each hardware device to the shared information, so that the driver process of each hardware device can only access the shared information corresponding to it.
7. The power management method for a microkernel operating system according to claim 6, characterized in that, In the step of configuring the access permissions of the driver process of each hardware device to the shared information, so that the driver process of each hardware device can only access the shared information corresponding to it: Set up an access link for each access interface of shared information; Each access link is associated with the device information of the corresponding hardware device and then stored in the dynamic library of the microkernel operating system. Configure the link permissions of the driver process for at least one hardware device so that the driver process for each hardware device can only link to the access links in the dynamic library associated with its device information.
8. A power management device for a microkernel operating system, characterized in that, include: The target information acquisition module is used to acquire device information of at least one hardware device and the power consumption mode to be switched in response to the mode switching signal. The current information acquisition module is used to acquire the current power consumption mode of the hardware device recorded in the shared information; the shared information includes at least one piece, and each piece of shared information is used to record the device information, current power consumption mode and target power consumption mode of a hardware device; the shared information is stored in the shared memory of the microkernel operating system; The target information writing module is used to write the power consumption mode to be switched of each hardware device into the target power consumption mode in the corresponding shared information according to the device information of each hardware device. The information comparison module is used to compare the current power consumption mode and the target power consumption mode of each hardware device. If the current power consumption mode and the target power consumption mode of any hardware device are different, then it is regarded as the controlled hardware device. The mode switching module is used to send a mode switching instruction to the driver module of the controlled hardware device, so that the driver process of the controlled hardware accesses the corresponding shared information according to the pre-configured access permissions, extracts the corresponding target function mode, and controls the controlled hardware device to switch to its corresponding target power consumption mode.
9. A storage medium, characterized in that, The storage medium stores program information, and after the processor reads the program information, it executes the power management method of the microkernel operating system according to any one of claims 1-7.
10. An electronic device, characterized in that, It includes at least one processor and at least one memory, wherein at least one of the memory stores program information, and at least one of the processor reads the program information and executes the power management method of the microkernel operating system according to any one of claims 1-7.
Citation Information
Patent Citations
Method and system for communication among multiple kernels
CN104123265A
Application process configuration updating method and system, terminal equipment and storage medium
CN111831350A