Operating system switching method and device and electronic equipment
By controlling the memory channel status and storage space usage of electronic devices, the problems of high power consumption and large delay during operating system switching are solved, low-power and efficient operating system switching is achieved, and the user experience is improved.
Patent Information
- Application Number
- CN202410337074.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-22
- Publication Date
- 2025-09-23
AI Technical Summary
In the prior art, electronic devices consume high power and experience large delays during operating system switching, which affects user experience.
By controlling the memory channel status and storage space usage of electronic devices, reducing the dependence on data transfer or recovery, adopting the power-on state and self-refresh mechanism of some memory channels, dynamically allocating storage space, and controlling the data type to reduce power consumption and latency.
In low-power mode, the power consumption of electronic devices is reduced, the operating system switching delay is shortened, and the user experience and switching efficiency are improved.
Smart Images

Figure CN120686965A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer science and technology, and in particular to a method, device and electronic device for switching an operating system. Background Art
[0002] With the rapid development of technology, electronic devices are widely used in all aspects of life, with ever-increasing performance and diverse functions. From consumer electronics such as smartphones and tablets for personal use to industrial electronics such as sensors, controllers, servers, and computing platforms used in intelligent manufacturing, the pursuit of performance improvements and functional diversification is ongoing. However, these performance improvements and functional additions are often accompanied by increased power consumption, necessitating the reduction of power consumption in electronic devices. Summary of the Invention
[0003] In view of this, the embodiments of the present application provide a method, device and electronic device for switching operating systems. By controlling the memory of the electronic device, the power consumption of the electronic device can be reduced to a greater extent in low power consumption mode, or the delay in the operating system switching process can be reduced, thereby improving the smoothness of users using the electronic device.
[0004] In a first aspect, the present application provides a control method, comprising: when an electronic device is operating in a first working mode, setting the memory channel state of the electronic device to a first state, using the first storage space as system memory to run a first operating system, and controlling the use scope of the second storage space, wherein, in the first state, multiple memory channels corresponding to the first storage space are in a powered-on state; obtaining a first switching request, the first switching request is generated based on the switching of the working mode of the electronic device, and the power consumption of the second working mode after the switch is less than the power consumption of the first working mode; based on the first switching request, suspending the first operating system, controlling the memory channel state to a second state, and using the second storage space as system memory to run the second operating system, wherein, in the second state, some channels of the multiple memory channels are in a powered-on state, and the some channels correspond to the second storage space.
[0005] The above switching method controls and manages the electronic device's memory, reducing reliance on data transfer or recovery during operating system switching, thereby minimizing latency during operating mode switching and improving the user experience. By keeping some memory channels powered on in the second operating mode, energy consumption associated with memory operation is reduced.
[0006] In one implementation, in the second state, the first storage space is in a self-refresh state, or a portion of the first storage space except the second storage space is in a self-refresh state.
[0007] The above switching method controls the self-refresh state of the storage space so that the data in the storage space in the self-refresh state will not be lost. Therefore, when switching from the first working mode to the second working mode, data transfer processing is not required, which greatly reduces the mode switching delay; and when switching from the second working mode to the first working mode, data recovery is not required, which further reduces the mode switching delay.
[0008] In one implementation, controlling the usage scope of the second storage space includes: reserving the second storage space; or controlling the type of data stored in the second storage space to be temporary data.
[0009] The above switching method can avoid reading or writing data by reserving the second storage space, so that when switching from the first operating mode to the second operating mode, erasing, overwriting, or backing up operations are not required, thereby reducing switching delay and improving the efficiency of the electronic device switching operating modes. Alternatively, by controlling the data type of the second storage space, temporary data stored in the second storage space can be directly overwritten during the operation of the second operating system, thereby improving the utilization of storage resources, reducing switching delay, and improving the efficiency of the electronic device switching operating modes.
[0010] In one implementation, the method further includes: when the electronic device operates in the first working mode, applying for a portion of the storage space of the first storage space as the second storage space.
[0011] The above switching method can dynamically allocate the capacity of the second storage space by applying for the second storage space, thereby reducing the fragmentation of storage resources and improving the utilization rate of storage resources.
[0012] In one implementation, it also includes: obtaining a second switching request, the second switching request is generated based on the switching of the working mode of the electronic device, and the power consumption of the first working mode after the switch is greater than the power consumption of the second working mode; based on the second switching request, triggering the recovery process of the first operating system, setting the memory channel state to the first state, and using the first storage space as system memory to run the first operating system, and controlling the use scope of the second storage space.
[0013] The above switching method improves the switching efficiency between working modes of electronic devices with different power consumption by controlling the memory in the storage resources, making the system response faster, and can be widely used in various occasions that require fast switching between high-performance and lightweight operating systems.
[0014] In one implementation, when the electronic device switches between the first operating system and the second operating system, the data in the second storage space is not backed up.
[0015] The above switching method can reduce the data backup delay during the switching of the first operating system to the second operating system by not backing up the data in the second storage space, further improve the operating system switching efficiency, and enhance the user experience.
[0016] In a second aspect, the present application provides an operating system switching device, comprising: a processing unit, for setting the memory channel state of the electronic device to a first state when the electronic device is operating in a first working mode, running the first operating system with the first storage space as the system memory, and controlling the use range of the second storage space, wherein, in the first state, the multiple memory channels corresponding to the first storage space are in a powered-on state; an interface unit, for obtaining a first switching request, the first switching request being generated based on the switching of the working mode of the electronic device, and the power consumption of the second working mode after the switch is less than the power consumption of the first working mode; the processing unit, further for suspending the first operating system based on the first switching request, setting the memory channel state to a second state, and running the second operating system with the second storage space as the system memory, wherein, in the second state, some channels of the multiple memory channels are in a powered-on state, and some channels correspond to the second storage space.
[0017] The switching device controls and manages the electronic device's memory through a processing unit, reducing reliance on data transfer or recovery during operating system switching, minimizing latency during operating mode switching and improving user experience. The processing unit also powers on some memory channels in the second operating mode, reducing energy consumption associated with memory operation.
[0018] In one implementation, in the second state, the first storage space is in a self-refresh state, or a portion of the first storage space except the second storage space is in a self-refresh state.
[0019] In one implementation, the processing unit controls the usage scope of the second storage space, including: the processing unit reserves the second storage space; or controls the data type stored in the second storage space to be temporary data.
[0020] In one implementation, the processing unit is further configured to: when the electronic device operates in the first working mode, apply for a portion of the storage space of the first storage space as the second storage space.
[0021] In one implementation, the interface unit is also used to: obtain a second switching request, the second switching request is generated based on the switching of the working mode of the electronic device, and the power consumption of the first working mode after the switch is greater than the power consumption of the second working mode; the processing unit is also used to trigger the recovery process of the first operating system based on the second switching request, set the memory channel state to the first state, use the first storage space as system memory to run the first operating system, and control the use scope of the second storage space.
[0022] In one implementation, when the electronic device switches between the first operating system and the second operating system, the data in the second storage space is not backed up.
[0023] In a third aspect, the present application provides an operating system switching device, comprising: at least one processor for coupling to a memory, the memory comprising instructions, which, when called by the at least one processor, enable the at least one processor to execute any of the switching methods implemented above.
[0024] In a fourth aspect, the present application provides an operating system switching device, comprising: a first processor and a second processor, wherein the first processor is used to set the memory channel state of the electronic device to the first state when the electronic device is operating in the first working mode, use the first storage space as system memory to run the first operating system, and control the use range of the second storage space, wherein, in the first state, multiple memory channels corresponding to the first storage space are in a powered-on state; the first processor is also used to obtain a first switching request, the first switching request is generated based on the switching of the working mode of the electronic device, and the power consumption of the second working mode after switching is less than the power consumption of the first working mode; based on the first switching request, the first processor or the second processor of the first operating system is suspending, and is used to set the memory channel state to the second state; the second processor is used to use the second storage space as system memory to run the second operating system, wherein, in the second state, some channels of the multiple memory channels are in a powered-on state, and some channels correspond to the second storage space.
[0025] In one implementation, the second processor is further used to: obtain a second switching request, the second switching request is generated based on the switching of the working mode of the electronic device, and the power consumption of the first working mode after the switch is greater than the power consumption of the second working mode; based on the second switching request, trigger the recovery process of the first operating system; the first processor or the second processor is used to set the memory channel state to the first state; the first processor is used to use the first storage space as system memory to run the first operating system, and control the use scope of the second storage space.
[0026] In a fifth aspect, the present application provides an electronic device comprising an operating system switching device and at least one memory in any one of the above implementations.
[0027] In one implementation, the electronic device is a controller of a vehicle.
[0028] In a sixth aspect, the present application provides a vehicle comprising the electronic device in any one of the above implementations.
[0029] In a seventh aspect, the present application provides a computer-readable storage medium, comprising instructions stored thereon, and when the instructions are executed by a processor, the switching method in any of the above implementations is executed. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The following is a brief introduction to the drawings used in describing the embodiments of this application:
[0031] Figure 1 A structural block diagram of an electronic device provided in an embodiment of the present application is shown;
[0032] Figure 2 A flowchart of a method for switching an operating system provided in an embodiment of the present application is shown;
[0033] Figure 3 A flowchart of another operating system switching method provided by an embodiment of the present application is shown;
[0034] Figure 4 A system architecture block diagram of an electronic device provided in an embodiment of the present application is shown;
[0035] Figure 5 A structural block diagram of an operating system switching device provided by an embodiment of the present application is shown;
[0036] Figure 6 A structural block diagram of another operating system switching device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the specific implementation methods of the present application will be described below with reference to the accompanying drawings. The drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings or embodiments can be obtained based on these drawings or embodiments without inventive work. Adjustments and improvements made without departing from the concept of the present application are all within the scope of protection of the present application.
[0038] To simplify the drawings, the figures schematically illustrate only the portions relevant to the embodiments and do not represent the actual structure of the products. Furthermore, to simplify the drawings and facilitate understanding, in some figures, only a portion of components with the same structure or function are schematically depicted; in practice, more or fewer components with the same structure or function may exist.
[0039] In this application, unless otherwise expressly specified and limited, ordinal numbers such as "first" and "second" are only used to distinguish and describe related objects, and cannot be understood as indicating or implying the relative importance or order between related objects; in addition, they do not represent the number of related objects. "Multiple" includes two or more, and other quantifiers are similar. " / " is used to describe the relationship between related objects, which indicates an "or" relationship between related objects. "And / or" is used to describe the relationship between related objects, which includes any combination relationship between related objects, for example, "a and / or b" includes: "alone a", "alone b", or "a and b". "One or more" or "at least one" in multiple objects refers to any object or any combination of multiple objects, for example, "one or more of a1, a2, a3" or "at least one of a1, a2, a3" includes: "alone a1", "alone a2", "alone a3", "a1 and a2", "a1 and a3", "a2 and a3" or "a1, a2 and a3".
[0040] During use, electronic devices face different performance or functional requirements in different scenarios. These differences in requirements will result in different workloads for the electronic devices. For example, when an electronic device performs fewer tasks or interacts less with the user, the workload of the electronic device decreases; when it performs more tasks or interacts more frequently with the user, the workload of the electronic device increases. Based on the changes in workload, the power consumption of the electronic device can be managed so that the electronic device operates in a lower power consumption mode when the workload is low, and the power consumption of the electronic device is reduced as a whole during the operation of the electronic device to extend the battery life of the electronic device. For example, electronic devices such as smartphones or tablets can enter standby mode and operate at lower power consumption when not in use. For another example, a vehicle can operate in low power mode in sentry mode. For another example, a server may only be used to process data queries or file storage during off-peak hours, and the workload is low, so it can operate in low power mode.
[0041] The sources of power consumption of electronic devices include, for example, the energy consumed when hardware resources are running, such as the energy consumed when the processor is running, the energy consumed when the memory is running, etc. The operating system is used to manage and coordinate the interaction between the electronic device hardware and application software. The operating system can be designed for the electronic device and used in the low power consumption mode of the electronic device, so that the hardware resource consumption in the low power consumption mode is reduced. Therefore, the electronic device can run on different operating systems in different power consumption modes. In the embodiment of the present application, when the electronic device switches the operating system, the memory of the electronic device is managed, which can achieve at least one of the following effects: reducing the power consumption of the electronic device to a greater extent in the low power consumption mode; or reducing the delay in the operating system switching process, thereby improving the fluency of the user's use of the electronic device.
[0042] The following is a description with reference to the accompanying drawings:
[0043] Please refer to Figure 1 , which is a structural block diagram of an electronic device provided in an embodiment of the present application. Figure 1 As shown, the electronic device 100 includes at least one processor (hereinafter described as processor 110 as an example, and other processors can access the memory in a similar manner), a memory 120, and a memory 130. The memory 120 is a non-volatile memory for storing one or more information such as data and programs. After the electronic device is powered off, the information stored in the memory 120 will not be lost. The memory 130 is a volatile memory, which can be called an internal memory (abbreviated as memory) or a running memory, and is used to temporarily store one or more information such as programs and data (for example, including one or more of intermediate running data and running result data) run by the processor. The memory 130 is a bridge between the memory 120 and the processor. When the electronic device 100 is running, the currently required programs and / or data in the memory 120 are temporarily stored in the memory 130; the processor 110 reads the program and / or data from the memory 130, runs it, and writes the running data into the memory 130. All or part of the data in the memory 130 can be written to the memory 120 periodically or as needed.
[0044] A processor is a circuit with signal processing capabilities. In one example, a processor can be a circuit with the ability to read and execute instructions; for example, a central processing unit (CPU), a microcontroller unit (MCU), a microprocessor unit (MPU), a graphics processing unit (GPU), or a digital signal processor (DSP). In another example, a processor can achieve its processing capabilities through the logical relationships of a hardware circuit, where the logical relationships of the hardware circuit are fixed or reconfigurable. For example, a processor can be a dedicated processor, such as a processor implemented by an application-specific integrated circuit (ASIC), which achieves processing capabilities by designing the logical relationships between components within the circuit. For another example, a processor implemented by a programmable logic device (PLD) achieves processing capabilities by configuring the logical relationships between logic devices through a configuration file; for example, a processor implemented by a field programmable gate array (FPGA). In another example, the processor can be a hardware circuit designed for artificial intelligence, which can be understood as an ASIC, such as a neural network processing unit (NPU), a tensor processing unit (TPU), a deep learning processing unit (DPU), etc. This application is not limited to the type of processor. An electronic device may include one or more processors.
[0045] The memory 120 is a non-volatile memory (NVM), including, but not limited to, semiconductor non-volatile memory, magnetic disk storage, or optical storage. Semiconductor non-volatile memory includes, but is not limited to, read-only memory (ROM) or flash memory, such as mask ROM, programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), NAND flash, or NOR flash. The memory 130 is a volatile memory, including, for example, random access memory (RAM). RAM includes, for example, static random access memory (SRAM) or dynamic random access memory (DRAM). DRAM includes, for example, synchronous dynamic RAM (SDRAM) or double data rate SDRAM (DDR). With the development of technology, DDR includes but is not limited to DDR1, DDR2, DDR3, ..., DDR5, etc., and may also include future DDR6, etc.
[0046] Memory speed and power consumption are important factors affecting the performance and energy efficiency of electronic devices. In order to increase the processor's read and / or write speed to memory and improve memory bandwidth, a multi-channel memory architecture (such as DDR) is adopted to enhance data transfer rate by running multiple channels in parallel to meet the demand for high data throughput. For example, please continue to refer to Figure 1, the memory 130 adopts a multi-channel memory architecture, for example, including storage spaces 131-134. Under the control of the memory controller 140, the processor 110 can access the storage spaces 131-134 through independent channels C1-C4; in this way, all or part of the multiple channels can transmit data in parallel, thereby improving the processor's read and / or write speed to the memory and increasing the memory bandwidth. Channels, for example, refer to independent paths for transmitting data between the processor and the memory. The number of channels in the figure is only for example, and there can be more or fewer channels in practice; similarly, the number of storage spaces is only for example, and there can be more or fewer independently accessible storage spaces in practice. The memory 130 may include one or more circuit boards (such as memory sticks); the multiple storage spaces of the memory 130 (such as storage spaces 131-134) may be located on separate circuit boards, or may be partially located on the same circuit board, or may be all located on the same circuit board; this application does not limit the integrated form of the storage space. In addition, the storage space may include a memory chip or a storage resource including multiple memory chips. This application does not limit the number of memory chips included in the storage space. For example, storage spaces 131 and 132 include the storage resources of four memory chips and are located on the same memory bank; storage spaces 133 and 134 include the storage resources of four memory chips and are located on another memory bank. Storage controller (or memory controller) 140 is used to control processor 110's access to memory 130 (including read access and write access); storage controller 140 can be integrated into processor 110 or can be independent of processor 110.
[0047] To reduce the power consumption of electronic devices, they can be configured to operate under different operating systems based on their workload; for example, when the workload is high, they can operate under a first operating system, and when the workload is low, they can operate under a second operating system. The present application controls the switching of operating systems to further reduce the power consumption of electronic devices, or to reduce delays during operating system switching, thereby improving the user's experience with the electronic device.
[0048] Please refer to Figure 2 , which is a flow chart of a method for switching an operating system provided by an embodiment of the present application. The method can be executed by at least one processor of an electronic device. Figure 2 As shown, the method includes at least the following steps:
[0049] S210: When the electronic device operates in the first operating mode, setting a memory channel state of the electronic device to a first state, using the first storage space as system memory to run a first operating system, and controlling a usage range of the second storage space, wherein in the first state, multiple memory channels corresponding to the first storage space are in a powered-on state;
[0050] S220: Obtain a first switching request, where the first switching request is generated based on switching of an operating mode of the electronic device, and power consumption of the second operating mode after switching is less than power consumption of the first operating mode;
[0051] S230: Based on the first switching request, suspend the first operating system, set the memory channel state to a second state, and use the second storage space as system memory to run the second operating system, wherein, in the second state, some channels of the multiple memory channels are in a powered-on state, and the some channels correspond to the second storage space.
[0052] The electronic device can switch between different working modes according to different workloads, for example, switching between a first working mode and a second working mode, wherein the power consumption of the first working mode is higher than that of the second working mode, or the workload of the first working mode is higher than that of the second working mode. For example, the first working mode can be called a normal working mode, and the second working mode can be called a low-power working mode. In different working modes, different operating systems can be used, the first operating system is called a high-performance operating system (high performance OS), and the second operating system is called a lightweight operating system (light OS); this application does not limit the types of the first operating system and the second operating system. The first operating system has richer functions than the second operating system, consumes more hardware resources, and is more complex. For example, in the first working mode, the electronic device runs on an Android system, an iOS system, or a Harmony system. In the second working mode, it runs on a lightweight real-time operating system (RTOS), for example, FreeRTOS, LiteOS, RT-Thread, or uC / OS-II.
[0053] In the low-power mode, the electronic device's demand for memory decreases, but all memory channels are still activated. This not only wastes hardware resources, but also consumes a certain amount of energy when the memory is running. In the second operating mode (low-power mode), the embodiment of the present application powers on some memory channels, thereby reducing the energy consumption caused by memory operation and further reducing the power consumption of the electronic device.
[0054] In addition, the electronic device limits the use scope of the second storage space in the first working mode. This use scope allows the storage space to not transfer data when the working mode is switched. This can reduce the delay in entering the low power mode and improve user experience.
[0055] The first storage space may include the second storage space, i.e., the second storage space is part of the first storage space; or the first storage space is independent of the second storage space. In some embodiments of the present application, in the second state, the first storage space may be in a self-refresh state, or the portion of the first storage space excluding the second storage space may be in a self-refresh state.
[0056] When switching between operating systems, the electronic device may experience significant delays, resulting in a reduced user experience. For example, when switching from a first operating system to a second operating system, the electronic device stores data from memory 130 to memory 120, and this storage process has a certain delay. For another example, when switching from the second operating system to the first operating system, the electronic device restores data from memory 120 to memory 130, and this restoration process also has a certain delay. The present application does not limit the type of stored data, such as context data; for example, including but not limited to register status, program counter value, memory mapping information, or hardware status data.
[0057] In an embodiment of the present application, the memory of the electronic device is controlled and managed, and when the operating system is switched, the reliance on data transfer or recovery is reduced to reduce the delay effect when the working mode is switched. For example, part of the storage space of the memory (called the second storage space) is reserved as the system memory of the second operating system. In the first working mode, the scope of use of the second storage space is limited. When the working mode is switched, the storage space may not be transferred. In addition, in the second working mode, the first storage space is controlled to be in a self-refresh state, or the part of the first storage space other than the second storage space is controlled to be in a self-refresh state, so that the data in the storage space in the self-refresh state will not be lost, so that when the first working mode is switched to the second working mode, data transfer processing may not be performed, which greatly reduces the delay of the mode switching. When switching from the second working mode to the first working mode, data recovery may not be performed, which further reduces the delay of the mode switching.
[0058] In some embodiments of the present application, a memory channel can be designed as a single-channel independently powered mode with support for dynamic frequency and voltage regulation. For example, when designing a chip, a memory interface that supports multiple independent channels can be integrated within the chip, and each channel can be independently powered on or off. When switching to a second operating system, the number of powered memory channels can be reduced as needed, for example, by switching the number of powered memory channels from multiple channels to a single channel.
[0059] In some embodiments of the present application, dynamic voltage and frequency scaling (DVFS) of the memory can be supported. In the first operating mode, the memory operates at a first frequency and a first voltage; in the second operating mode, the memory operates at a second frequency and a second voltage. The first frequency is greater than the second frequency; or the first voltage is greater than the second voltage; or the first frequency is greater than the second frequency, and the first voltage is greater than the second voltage. In this way, the operating frequency and / or operating voltage of the memory can be controlled when the operating mode of the electronic device is switched. For example, when switching to the second operating system, the memory operates in a low-frequency and low-voltage mode; when restoring the second operating system, the memory operates at a high-frequency and high-voltage mode. In this way, the power consumption of the electronic device can be further reduced.
[0060] The first switching request is generated based on the switching of the working mode of the electronic device, that is, when the electronic device is to switch from the first working mode to the second working mode, the first switching request is generated and sent to the processor of the electronic device. The present application does not limit the trigger source for the generation of the first switching request. For example, it can be actively triggered by the user, or it can be automatically triggered by the electronic device based on its task or load status. For example, when the user suspends the use of the electronic device, the electronic device can be controlled to enter a low power state through operation, and the electronic device generates a first switching request in response to the user's operation. The operation mode includes but is not limited to one or more of key operation, voice operation, or gesture operation. For example, the user clicks the power button of the smartphone to put it into sleep mode; for another example, the user controls the electronic device to enter sleep mode through voice commands; for another example, after the user parks the vehicle, the vehicle turns off the power or pulls out the key to put the electronic device in the vehicle into sleep mode.
[0061] Suspending the first operating system means that the operation of the first operating system is temporarily suspended or paused. When switching to the second operating system, the second operating system takes over the interaction between the electronic device hardware and application software. The second operating system is a lightweight operating system. Running it in the second storage space as system memory can reduce power consumption and energy waste. The second operating system does not start running while the first operating system is running. After receiving the first switching request, it can start running in a cold boot manner.
[0062] In some embodiments of the present application, controlling the usage scope of the second storage space includes reserving the second storage space. When controlling the usage scope of the second storage space, the second storage space is reserved for the first operating mode or the first operating system, and data is not read or written in the second storage space. This eliminates the need for erasing, overwriting, or backing up data when switching from the first operating mode to the second operating mode, thereby reducing switching latency and improving the efficiency of switching operating modes of the electronic device. This implementation method is simple and has low system complexity.
[0063] In some embodiments of the present application, controlling the scope of use of the second storage space includes: controlling the type of data stored in the second storage space to be temporary data. Temporary data, for example, refers to data temporarily stored during program execution. These data usually only exist while the program is running, and no longer need to be retained after the program is executed, the task is completed, or the system is shut down. During operation, the first operating system can write temporary data into the second storage space to improve the utilization of the storage space. When the first working mode is switched to the second working mode, the contents of the second storage space do not need to be erased, overwritten, or backed up, thereby improving the startup efficiency of the second operating system. During the operation of the second operating system, the temporary data stored in the second storage space can be directly overwritten without affecting the normal data reading and writing of the second operating system. This implementation method can improve the utilization of storage resources, reduce switching delays, and improve the efficiency of electronic devices switching working modes.
[0064] In some embodiments of the present application, when the electronic device is operating in the first working mode, part of the storage space of the first storage space is applied as the second storage space. When applying for the second storage space, you can apply according to the pre-configured capacity of the second storage space or according to the capacity configuration parameters of the second storage space. The capacity of the second storage space can be set, for example, according to the operating requirements of the second operating system, or according to historical data, or according to the workload under the second working mode, and this application does not impose any restrictions. When the first operating system is started or switched back to the first operating system, an application is made according to the configured capacity of the second storage space. When applying for the second storage space, the capacity of the second storage space can be dynamically allocated, which can reduce the fragmentation of storage resources and improve the utilization of storage resources.
[0065] An example process of switching the electronic device from the second operating mode to the first operating mode is described below with reference to the accompanying drawings.
[0066] Please refer to Figure 3 , which shows a flowchart of another operating system switching method provided by an embodiment of the present application. The method can be executed by at least one processor of an electronic device. Figure 3 As shown, the method comprises at least the following steps:
[0067] S310: Obtain a second switching request, where the second switching request is generated based on switching of an operating mode of the electronic device, and power consumption of the first operating mode after switching is greater than power consumption of the second operating mode;
[0068] S320: Based on the second switching request, trigger a recovery process of the first operating system, set the memory channel state to the first state, use the first storage space as system memory to run the first operating system, and control the use range of the second storage space.
[0069] The second switching request is generated based on the switching of the electronic device's operating mode, that is, when the electronic device is to switch from the second operating mode to the first operating mode, the second switching request is generated and sent to the processor of the electronic device. This application does not limit the triggering source of the generation of the second switching request. Similar to the first switching request, for example, it can be actively triggered by the user, or it can be automatically triggered by the electronic device based on its task or load status.
[0070] The embodiments of the present application improve the efficiency of switching between operating modes of electronic devices with different power consumption by controlling the memory in the storage resources, making the system response faster, and can be widely used in various situations that require fast switching between high-performance and lightweight operating systems, such as consumer electronic products such as smartphones and tablets, and industrial electronic equipment such as sensors, controllers, servers, or computing platforms used in industrial intelligence.
[0071] In some embodiments of the present application, pre-processing operations may be performed when switching operating systems, so that tasks running in the first operating system can be better restored when subsequently switching back to the first operating system. For example, the above switching method further includes: saving one or more pieces of information, such as context data and hardware status, of the first operating system before it enters suspension. This saving location may be located in the first storage space, for example, so that when the operating system is restored to the first operating system, tasks can be more efficiently resumed.
[0072] For example, the switching method further includes: determining a bus status of the electronic device; and when the bus status satisfies a condition, suspending the first operating system and running the second operating system using the second storage space as system memory. The condition may include, for example, the absence of access transmission on the bus.
[0073] like Figure 1 As shown, bus 150 is used to transmit information between components within the electronic device, including a data bus, an address bus, and a control bus, which are used to transmit data, addresses, and control signals, respectively. When there is access transmission on the bus, performing a system switch may cause information loss of the current task, resulting in problems with task recovery when switching back to the first operating system, resulting in a reduced user experience. Therefore, performing a bus status check before switching operating systems can improve the accuracy of task recovery and thus enhance the user experience.
[0074] In a multi-channel memory architecture, bus interleaving can be used to balance read / write operations across different memory banks. Before switching the operating system from the first operating system to the second operating system, the bus interleaving function can be disabled to further reduce the power consumption of the electronic device in the second operating mode. Optionally, if the second storage space corresponds to more than one memory channel in the second operating mode, the bus interleaving function can be retained to improve read / write bandwidth.
[0075] Accordingly, before switching the operating system from the first operating system to the second operating system, one or more of the above preprocessing operations are performed; before switching from the second operating system to the first operating system, corresponding preprocessing operations may also be performed, such as but not limited to: restoring the bus interleaving function, restoring one or more saved context data and hardware status and other information.
[0076] The steps of the switching method can be performed by one processor of the electronic device or by multiple processors. Figure 1 , the first operating system and the second operating system can both run on the processor 110, and the processor 110 executes the above operating system switching method. Figure 1 The first operating system runs on processor 110, and the second operating system runs on processor 110'. Processor 110, for example, is configured to execute steps S210 and S220, as well as some operations in step S230, such as controlling the channel state to the second state and suspending the first operating system. Processor 110' is configured to execute some operations in step 230, such as running the second operating system using the second storage space as system memory. Optionally, setting the memory channel state to the second state may also be executed by the second processor 110'. For another example, processor 110' is configured to execute step 310, and processor 110 is configured to execute step S320. Optionally, processor 110 performs preprocessing operations based on the first switching request, sets the memory channel state to the second state, and instructs processor 110' to start the second operating system. Optionally, processor 110' instructs the first processor to resume the first operating system based on the second switching request. Processor 110' or processor 110 sets the memory channel state to the first state. Processor 110 uses the first storage space as system memory to run the first operating system and controls the usage range of the second storage space. For example, the processor 110 includes a CPU or FPGA, and the processor 110 ′ includes an MCU or MPU, for example.
[0077] An exemplary description is given below in conjunction with the accompanying drawings.
[0078] Please refer to Figure 4 , which is a system architecture block diagram of an electronic device provided in an embodiment of the present application. Figure 4 As shown, when the electronic device 400 operates in the first operating mode, the running hardware resources include but are not limited to bus resources B1, memory resources M1, and processor resources N1. Bus resource B1, for example, has the interleaving function enabled; memory resource M1, for example, includes multiple powered-on memory channels; processor resource N1, for example, includes a CPU, and the processor is, for example, in a multi-core operating state. Running software resources, for example, include a first operating system (a high-performance operating system) and a partner management system of the first operating system, such as a memory management system, which applies for a second storage space for memory resources in the second operating mode. The first operating system is a high-performance operating system that runs X1 applications (APPs) and X2 services, where X1 and X2 are both positive integers. The electronic device 400 also includes a security management system for bus driving and / or memory driving to protect the security of data transmission / reading and writing. When the electronic device 400 switches to the second operating mode, the running bus resource B2 can disable the interleaving function, the memory resource M2, for example, includes one powered-on memory channel; the processor resource N1, for example, includes a CPU, and the processor is, for example, in a single-core operating state; or the processor resource N1, for example, includes an MCU. The second operating system is a lightweight operating system that runs X3 tasks, and the task load of X3 is smaller than the task load of X1 applications (APPs) and X2 services.
[0079] The processor resources and memory resources in the above second working mode are only for example. More processor cores may be running or memory channels may be powered on, but they are less than the processor resources and memory resources in the first working mode.
[0080] When the electronic device 400 starts, the first operating system starts and runs applications and / or services. The memory management system applies for a second storage space for the second working mode; and when the application or service is running, it allocates memory space for the corresponding application or service. When the processor obtains the first switching request, it can perform the preprocessing described above, such as turning off bus interleaving when there is no access on the bus; saving one or more information such as context data and hardware status. The processor controls the memory resource M1 so that some memory channels are powered off, the corresponding memory space enters the self-refresh state, the memory channel corresponding to the second storage space is kept powered on, and then the operating system is switched. The second operating system runs with the second storage space as the system memory, runs tasks with lower power consumption, and maintains the low power consumption state of the electronic device 400. At this time, the memory can operate in a low-frequency and low-voltage working mode.
[0081] When the processor receives the second switch request, it initiates a recovery process from the low-power operating system to the high-performance operating system. The processor restores power to all or most memory channels and restores bus interleaving and one or more pieces of information, including saved context data and hardware status. At this point, the memory can operate in a high-frequency, high-voltage operating mode.
[0082] The present application also provides a control device, including a unit or means for executing any of the above switching method steps. For example, please refer to Figure 5 , which is a structural block diagram of an operating system switching device provided by an embodiment of the present application. Figure 5 As shown, the control device 500 includes: a processing unit 510 and an interface unit 520. The processing unit 510 is used to set the memory channel state of the electronic device to the first state when the electronic device operates in the first working mode, run the first operating system with the first storage space as the system memory, and control the use range of the second storage space, wherein, in the first state, the multiple memory channels corresponding to the first storage space are in a powered-on state; the interface unit 520 is used to obtain a first switching request, the first switching request is generated based on the switching of the working mode of the electronic device, and the power consumption of the second working mode after the switching is less than the power consumption of the first working mode; the processing unit 510 is also used to suspend the first operating system based on the first switching request, set the memory channel state to the second state, and run the second operating system with the second storage space as the system memory, wherein, in the second state, some of the multiple memory channels are in a powered-on state, and some of the channels correspond to the second storage space.
[0083] In some embodiments, in the second state, the first storage space is in a self-refresh state, or a portion of the first storage space except the second storage space is in a self-refresh state.
[0084] In some embodiments, the description of controlling the usage scope of the second storage space may refer to the above embodiments.
[0085] In some embodiments, the processing unit 510 is further configured to apply for a portion of the storage space of the first storage space as the second storage space when the electronic device operates in the first working mode.
[0086] In some embodiments, the interface unit 520 is also used to obtain a second switching request, which is generated based on the switching of the working mode of the electronic device, and the power consumption of the first working mode after the switch is greater than the power consumption of the second working mode; the processing unit 510 is also used to trigger the recovery process of the first operating system based on the second switching request, set the memory channel state to the first state, use the first storage space as system memory to run the first operating system, and control the use scope of the second storage space.
[0087] In some embodiments, when the electronic device switches between the first operating system and the second operating system, the data in the second storage space is not backed up.
[0088] The division of the above units is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. For example, the interface unit 510 includes an interface circuit for communication between the processor and the bus, and the processing unit 520 includes at least one processor. In some embodiments, the processing unit 520 includes a processor, and the interface unit 510 includes an interface circuit for the processor. Alternatively, in some embodiments, the processing unit 520 includes a first processor and a second processor, and the interface unit 510 includes an interface circuit for the first processor and an interface circuit for the second processor. For the description of the processor, refer to the above embodiment.
[0089] For example, please refer to the attached Figure 6 , which shows a structural block diagram of another operating system switching device provided by an embodiment of the present application. Figure 6 As shown, the switching device 600 includes: at least one processor 610, which is used to couple to a memory 620, and the memory 620 includes instructions. When the instructions are called by the at least one processor 610, the at least one processor 610 executes any one of the switching methods in the above method embodiments.
[0090] Based on a concept similar to the above embodiment, an embodiment of the present application further provides a controller, which includes the above integrated circuit; the integrated circuit includes any of the above switching devices. The controller includes, for example: a domain controller (DCU), a vehicle central computer (VCC), an electronic control unit (ECU), a zone controller (zonal / zone ECU, or, zone control unit, ZCU), a micro control unit (MCU), or a vehicle control unit (VCU), etc. The domain controller includes, for example, a vehicle domain controller (VDC), a cockpit domain controller (CDC), or an intelligent driving domain controller (advanced driving assistance system / autonomous driving, ADAS / AD, domain controller, ADC), etc.
[0091] Based on concepts similar to the above embodiments, embodiments of the present application also provide a means of transport, which may include, for example, a vehicle, a ship, or an aircraft (such as a flying vehicle or a drone, etc.).
[0092] An embodiment of the present application further provides a computer-readable storage medium, comprising instructions stored thereon, and when the instructions are called by a processor, any one of the switching methods in the above embodiments is executed.
[0093] It should be noted that the above embodiments can be freely combined as needed. The above are only preferred implementations of the present application. It should be noted that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application, and these improvements and modifications should also be considered as the scope of protection of the present application.
Claims
1. A method for switching an operating system, characterized in that: include: When the electronic device operates in a first operating mode, setting the memory channel state of the electronic device to a first state, using the first storage space as system memory to run a first operating system, and controlling the usage range of the second storage space, wherein, in the first state, the multiple memory channels corresponding to the first storage space are in a powered-on state; Acquire a first switching request, where the first switching request is generated based on switching of an operating mode of the electronic device; Based on the first switching request, the first operating system is suspended, the memory channel state is set to a second state, and the second storage space is used as system memory to run the second operating system, wherein, in the second state, some channels of the multiple memory channels are in a powered-on state, and the some channels correspond to the second storage space.
2. The switching method according to claim 1, wherein: In the second state, the first storage space is in a self-refresh state, or a portion of the first storage space except the second storage space is in a self-refresh state.
3. The switching method according to claim 1 or 2, characterized in that: The controlling the usage scope of the second storage space includes: reserving the second storage space; or, The data type stored in the second storage space is controlled to be temporary data.
4. The switching method according to any one of claims 1 to 3, characterized in that: Also includes: When the electronic device operates in the first working mode, part of the storage space of the first storage space is applied as the second storage space.
5. The switching method according to any one of claims 1 to 4, characterized in that: Also includes: Acquire a second switching request, where the second switching request is generated based on switching of an operating mode of the electronic device; Based on the second switching request, a recovery process of the first operating system is triggered, the memory channel state is set to the first state, the first storage space is used as system memory to run the first operating system, and the use range of the second storage space is controlled.
6. The switching method according to any one of claims 1 to 5, characterized in that: When the electronic device switches between the first operating system and the second operating system, the data in the second storage space is not backed up.
7. A switching device for an operating system, characterized in that: include: a processing unit, configured to, when the electronic device operates in a first operating mode, set a memory channel state of the electronic device to a first state, use the first storage space as system memory to operate a first operating system, and control a usage range of the second storage space, wherein, in the first state, multiple memory channels corresponding to the first storage space are in a powered-on state; An interface unit, configured to obtain a first switching request, where the first switching request is generated based on switching of an operating mode of the electronic device; The processing unit is further configured to suspend the first operating system based on the first switching request, set the memory channel state to a second state, and use the second storage space as system memory to run the second operating system, wherein, in the second state, some of the multiple memory channels are in a powered-on state, and the some of the channels correspond to the second storage space.
8. The switching device according to claim 7, characterized in that: In the second state, the first storage space is in a self-refresh state, or a portion of the first storage space except the second storage space is in a self-refresh state.
9. The switching device according to claim 7 or 8, characterized in that: The processing unit controls the use range of the second storage space including: The processing unit reserves the second storage space; or controls the data type stored in the second storage space to be temporary data.
10. The switching device according to any one of claims 7 to 9, characterized in that: The processing unit is further configured to apply for a portion of the first storage space as the second storage space when the electronic device operates in the first working mode.
11. The switching device according to any one of claims 7 to 10, characterized in that: The interface unit is further configured to: obtain a second switching request, where the second switching request is generated based on switching of the operating mode of the electronic device; The processing unit is further configured to trigger a recovery process of the first operating system based on the second switching request, set the memory channel state to the first state, use the first storage space as system memory to run the first operating system, and control the usage scope of the second storage space.
12. The switching device according to any one of claims 7 to 11, characterized in that: When the electronic device switches between the first operating system and the second operating system, the data in the second storage space is not backed up.
13. A switching device for an operating system, characterized in that: include: At least one processor is configured to be coupled to a memory, wherein the memory includes instructions, and when the instructions are called by the at least one processor, the at least one processor executes the switching method according to any one of claims 1 to 6.
14. An electronic device, characterized in that: The invention comprises a switching device for an operating system according to any one of claims 7 to 13 and at least one memory.
15. The electronic device according to claim 14, characterized in that The electronic device is a controller of a vehicle.
16. A vehicle, characterized in that: Comprising the electronic device as claimed in claim 14.
17. A computer-readable storage medium comprising instructions stored thereon, characterized in that: When the instruction is executed by the processor, the switching method according to any one of claims 1 to 6 is executed.