System sleep method and device, system wake-up method and device
By filtering tasks and devices, combined with the CPU frequency increase strategy, the system sleep and wake-up process is optimized, solving the problem of long sleep and wake-up times in the existing technology, and improving user experience and standby time.
Patent Information
- Application Number
- CN202210466672.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-29
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2042-04-29
AI Technical Summary
The existing system sleep and wake-up processes take a long time, affecting the user experience and shortening the standby time.
By filtering blocked tasks, the number of frozen and hibernating devices is reduced, device status information is used to optimize the hibernation and wake-up process, and the CPU frequency increase strategy is combined to accelerate system hibernation and wake-up.
Improved system sleep and wake-up speed, shortened response time, extended standby time, and reduced system power consumption.
Smart Images

Figure CN117008980B
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of operating system technology, and in particular, to a system sleep method and device, and a system wake-up method and device. Background Art
[0002] In this field, electronic devices can control the operating system to enter a dormant state when the operating system does not need to work according to different power states to save system power consumption. When a wake-up type interrupt occurs, the electronic device can wake up the operating system of the device from the dormant state to resume the running state (also called the wake-up state) so that the system can resume working.
[0003] Currently, the system sleep and wake-up process takes a long time, and the speed of system sleep and wake-up is slow, which results in a long response time for the electronic device to sleep and wake up (such as turning the screen on and off), affecting the user experience and shortening the system's standby time. Summary of the invention
[0004] In order to solve the above technical problems, the present application provides a system sleep method and device, and a system wake-up method and device. In this method, the number of frozen or unfrozen tasks and the number of sleep or wake-up devices can be reduced, thereby improving the speed of system sleep and wake-up, reducing the response time of system sleep and wake-up, improving user experience, and increasing standby time.
[0005] In a possible implementation, the present application provides a system hibernation method. The method includes: in response to receiving a system hibernation request, filtering a first task in a blocked state; freezing a second task that is not in a blocked state after filtering; hibernating a first device of a first type based on device status information; wherein the device status information includes: a device status of at least one device of the first type, the device status being information used to indicate whether the device is in a running state; the first device is different from the second device, wherein the second device is a device that is not in a running state among the at least one device.
[0006] Exemplarily, the second task is a task obtained by filtering the first task, and the second task is not in a blocking state (can also be described as being in a non-blocking state).
[0007] Exemplarily, the second task may be the remaining tasks after filtering out the first task in a blocked state from all (or part) tasks in the operating system. Exemplarily, the tasks to be frozen may be screened by traversing the tasks.
[0008] Exemplarily, in this embodiment, even before the first device is put into sleep mode, the task state of the filtered task in the blocked state is switched to the running state. Since the second task which is not in the blocked state can be frozen in this embodiment, the task in the blocked state can still be frozen after being awakened, thereby ensuring the reliability of system sleep mode.
[0009] Exemplarily, the first type of device is used to represent a device that does not affect the operation of the CPU. The first type of device may be an external device (referred to as an external device).
[0010] Exemplarily, a preset device list may be configured for the first type of device.
[0011] Exemplarily, putting a device into hibernation may cause the device to stop running, or shut down, or power off.
[0012] Exemplarily, the device status information may be generated during the operation of the system based on whether the at least one device is in operation. The present application may detect whether at least one external device is in operation when the system is running, thereby maintaining the device status of the external device when the system is running.
[0013] Exemplarily, the device state may include a first state or a second state, wherein the first state is used to indicate that the device is in an operating state (e.g., a startup state, a power-on state, etc.), and exemplarily, the device being in an operating state is also referred to as the device being in an awake state; the second state is used to indicate that the device is not in an operating state (e.g., a shutdown state, a stopped operating state, a power-off state, etc.), and exemplarily, the device not being in an operating state is also referred to as the device being in a sleep state.
[0014] Exemplarily, after freezing the task and before putting the peripherals into sleep mode, the device status information generated by the system maintenance may include the device status information of all peripherals, or may include the device status information of some peripherals.
[0015] In this embodiment, when the peripherals are in hibernation, it is not necessary to hibernate the second device recorded in the device status information that is not in operation (also called hibernation), but only the peripherals (the first device mentioned above) other than the second device in the system need to be hibernated, so that the peripherals other than the second device can be stopped from running, thereby achieving the effect of hibernating the peripherals. The hibernation process of the system reduces the number of hibernating peripherals and improves the hibernation speed of the peripherals.
[0016] Exemplarily, considering that the above device status information is data dynamically generated during the operation of the system based on whether the detected peripherals are in the operating state, the device status information may only include the device status information of some peripherals. In this embodiment, the peripherals in sleep mode (i.e., the first device) may be peripherals in the recorded device status information or peripherals that have not been recorded in the device status information. This application does not limit this.
[0017] Exemplarily, the data structure of the device status information may be a linked list. The linked list may be a linked list for recording all peripherals and the device status of the peripherals detected by marking. The linked list may also be two linked lists, one linked list for recording peripherals in a running state, and the other linked list for recording peripherals that are not in a running state. This application does not limit this.
[0018] In an embodiment of the present application, when the system is in hibernation, the task can be frozen, and then the device can be hibernated. When freezing the task, the task in a blocked state may not be frozen, thereby reducing the number of frozen tasks and speeding up the task freezing speed. And when the device is in hibernation, the number of device hibernations can be reduced based on the device status information maintained when the system is running, thereby speeding up the device hibernation process. In this way, the overall system hibernation speed can be improved and the duration of the system hibernation process can be shortened. As a result, the response time of system hibernation (such as screen off) of electronic devices equipped with the system can be shortened, thereby improving the user experience. And after the system hibernation process is accelerated, the system can enter the hibernation state faster, thereby reducing system power consumption and increasing the standby time of the system.
[0019] In a possible implementation, before filtering the first task in a blocked state, the method further includes: when it is detected that the system sleep request is a preset sleep request, increasing the operating frequency of the CPU to a first frequency; wherein the first frequency is the maximum operating frequency of the CPU.
[0020] Exemplarily, when the CPU of the system is a multi-core CPU, the CPU whose frequency is increased here may be a master core CPU and / or a slave core CPU.
[0021] Exemplarily, the preset sleep request is a sleep request related to user experience.
[0022] In this embodiment, when the system sleep request is a preset sleep request, the CPU operating frequency can be increased to the maximum operating frequency to accelerate the CPU instruction execution speed. Then, when the above-mentioned system sleep related operations are performed in response to the system sleep request, the system sleep process can be accelerated as a whole (for example, the task freezing process, the sleep device process, etc. can be accelerated) to maximize the user experience.
[0023] In a possible implementation, before filtering the first task in a blocked state, the method further includes: when it is detected that the system sleep request is not a preset sleep request, increasing the operating frequency of the CPU to a second frequency; wherein the second frequency is less than the first frequency, and wherein when the operating frequency of the CPU is the second frequency, the energy efficiency ratio of the CPU is the highest.
[0024] Exemplarily, the second frequency may be named as the operating frequency with the best energy efficiency ratio of the CPU.
[0025] Exemplarily, when the operating frequency of the CPU is the second frequency, the energy efficiency ratio of the CPU is the highest, which can be understood as: when the CPU is at different operating frequencies, when the CPU completes the same amount of instruction execution tasks, among which, when the operating frequency of the CPU is the second frequency, the power consumption of the CPU is the lowest.
[0026] Exemplarily, when the CPU of the system is a multi-core CPU, the CPU whose frequency is increased here may be a master core CPU and / or a slave core CPU.
[0027] Exemplarily, the operating frequency a with the best energy efficiency ratio can be used to indicate that when the operating frequency of the CPU is the operating frequency a, the energy efficiency ratio of the CPU is the highest and the power consumption of the CPU is the lowest.
[0028] In this embodiment, when the system sleep request is not a preset sleep request, it means that the system sleep request is irrelevant to the user experience, so the user does not care about the speed of the system sleep process. In order to reduce CPU power consumption, the CPU operating frequency can be adjusted to the above-mentioned operating frequency with the best energy efficiency ratio to save system power consumption to the greatest extent.
[0029] It can be understood that the present application provides a frequency modulation strategy for the CPU used in the system sleep or wake-up scenario, and the frequency modulation strategy includes increasing the CPU frequency to the highest operating frequency when the system sleep request or the system wake-up request is a preset request, and increasing the CPU frequency to the operating frequency with the best energy efficiency ratio when the system sleep request or the system wake-up request is not a preset request.
[0030] In a possible implementation, filtering the first task in a blocked state includes: filtering the first task in a blocked state among tasks of a second type; wherein the tasks of the second type are tasks other than system tasks in the operating system.
[0031] Exemplarily, under a microkernel architecture, tasks in the system may include user-mode tasks and kernel-mode tasks.
[0032] Among them, user-mode tasks may include common tasks and system service tasks (also a kind of system tasks). Kernel-mode tasks are all system tasks.
[0033] When freezing tasks, this embodiment does not need to freeze system tasks (including system service tasks in user mode and system tasks in kernel mode), but only needs to freeze tasks that are not in a blocked state among ordinary tasks. There are a large number of system tasks, and there is no need to freeze system tasks, which can greatly improve the task freezing speed, thereby shortening the system sleep time.
[0034] In a possible implementation, after receiving the system sleep request, the method further includes: sending a freeze signal to the second type of task, where the freeze signal is used to instruct the task to be frozen.
[0035] Exemplarily, after receiving a system sleep request, the embodiment of the present application may send a freeze signal to all common tasks, where the common tasks include common tasks in a blocked state. Although the task in a blocked state does not need to be frozen, a freeze signal may still be sent to the task in a blocked state. Even if the task in a blocked state is in a non-blocking state before the peripheral is put into sleep mode, the task may still process the freeze signal to freeze the task that is no longer in a blocked state, thereby ensuring that the task in a blocked state can still be frozen after resuming operation, thereby improving the reliability of system sleep.
[0036] In a possible implementation, after filtering the first task in a blocked state and before putting the first device of the first type into hibernation based on the device status information, the method further includes: saving the third task in the second task that is not in a frozen state to a first data structure; looping through the third task in the first data structure and detecting the task status of the traversed third task; when it is detected in the first data structure that the task status of the third task is the frozen state, deleting the third task in the frozen state from the first data structure; when it is detected in the first data structure that the task status of the third task is not the frozen state, continuing to loop through the first data structure until the first data structure is empty.
[0037] Exemplarily, the second task includes the third task.
[0038] Exemplarily, after sending a freeze signal to the second type of task, the tasks of the second type that are not in a blocked state (i.e., the second tasks) may process the freeze signal to freeze the tasks. In order to determine whether each second task is frozen and in a frozen state, the present application may detect the task state of the second task to save the third task that has not been frozen (in an unfrozen state) to the first data structure.
[0039] Then, the tasks in the first data structure can be looped through to detect the task status, so as to delete the tasks in the frozen state from the first data structure. Then, as the freezing progress of the tasks in the non-blocking state (such as the second task) advances, the tasks in the first data structure become fewer and fewer. The first data structure only saves unfrozen tasks, thereby avoiding redundant checks on the task status of a large number of frozen tasks, improving the traversal efficiency of unfrozen tasks, and thus accelerating the task freezing process. When the first data structure is empty, the first data structure no longer includes any tasks, indicating that the tasks in the non-blocking state have been frozen, and the task freezing process ends.
[0040] Exemplarily, the third task in the first data structure may be looped over within a preset time period, thereby preventing the third task in the first data structure from being unfrozen for a long time and affecting the system hibernation speed.
[0041] In one possible implementation, the CPU of the system is a multi-core CPU, and the multi-core CPU includes a master core CPU and at least one slave core CPU. After the first device of the first type is put into hibernation based on the device status information, the method also includes: before powering off the first slave core CPU, retaining the timer and task on the first slave core CPU without migrating to the second CPU; wherein the second CPU is the second slave core CPU or the master core CPU; the at least one slave core CPU includes the first slave core CPU, or further includes the second slave core CPU.
[0042] In this way, among the blocked tasks that are filtered out, the tasks running on the slave CPU will not be migrated to other running CPUs. Then, after the slave CPU goes offline, the blocked tasks on the slave CPU will not be executed even if they are updated from the blocked state to the non-blocked state, thus ensuring that before the non-core device (also known as the peripheral) is put to sleep, the task state of the blocked task will be frozen according to the received freeze signal even if it is updated to the non-blocked state, and will not be able to run.
[0043] For example, if the task of the timer on the slave CPU is in a blocked state and is added to the blocked task list, after the timer ends, the task corresponding to the timer can send an interrupt to the slave CPU. However, since the slave CPU has been offline, the task corresponding to the timer has not been migrated to other running CPUs, so that after the system enters the kernel, it will no longer receive interrupts initiated by the offline slave CPU task, and thus will not execute the task awakened after blocking, ensuring that the blocked task is not frozen and correct.
[0044] In a possible implementation, putting a first device of a first type into hibernation based on device status information includes: filtering the second device among devices of the first type based on the device status information to determine a first device of the first type; and putting the first device into hibernation.
[0045] In an embodiment of the present application, peripherals that are in sleep mode (eg, in a turned-off state) can be filtered out from peripherals of the system (eg, all peripherals), and the remaining peripherals after filtering can be put into sleep mode, thereby reducing the number of devices in sleep mode.
[0046] In a possible implementation, the method further includes: during the operation of the system, when it is detected that a third device of the first type is in an operating state, recording or updating the device state of the third device to a first state to generate or update the device state information; wherein the first state is information used to indicate that the third device is in an operating state; during the operation of the system, when it is detected that a fourth device of the first type is not in an operating state, recording or updating the device state of the fourth device to a second state to generate or update the device state information; wherein the second state is information used to indicate that the fourth device is not in an operating state; the device state is the first state or the second state; wherein the at least one device includes: the third device and / or the fourth device.
[0047] Exemplarily, during the operation of the system, it indicates that the operating system has not entered the S3 state (sleep state).
[0048] Among them, the S3 state means that only necessary devices such as memory are powered to ensure that data is not lost. Other components are in a shut down state and the system's power consumption is extremely low.
[0049] For example, when the system is running, the detected peripheral device 1 is in the running state. If the device state of the peripheral device 1 is not recorded in the data structure (e.g., linked list) corresponding to the device state information, the present application may record the device state of the peripheral device 1 as the running state in the data structure, thereby generating the device state information.
[0050] For example, when the system is running, the detected peripheral device 2 is in the running state. If the device state of the peripheral device 2 (e.g., the stopped running state) is recorded in the data structure (e.g., linked list) corresponding to the device state information, the present application can update the device state of the peripheral device 2 from the stopped running state to the running state in the data structure, thereby updating the device state information.
[0051] The above two examples are used to help readers understand the significance of recording or updating device status to generate or update device status information.
[0052] In the embodiment of the present application, when the system is running, the detected devices in the running state and / or the detected devices not in the running state are recorded or updated in the above data structure (such as a linked list), so that the device status information can be generated or updated. When the system is dormant, based on the devices in the second state (not running state) recorded in the device status information, the number of dormant devices can be reduced and the device dormancy speed can be increased.
[0053] In a possible implementation, after putting the first device of the first type into hibernation based on the device status information, the method further includes: recording or updating the device status of the first device to the second status in the device status information.
[0054] Exemplarily, during the system hibernation process, after the first device (e.g., part of the peripherals) is put into hibernation based on the device status information, all the peripherals can be put into hibernation. Then, in order to ensure the accuracy of the device status information, the status information of the peripherals that are hibernating during the system hibernation process can be recorded or updated in the device status information, so that the device status of the first device in the device status information is a non-running state (e.g., the second state).
[0055] In a possible implementation, the present application provides a system wake-up method. The method includes: in response to receiving a system wake-up request, waking up a first device of a first type based on device status information; wherein the device status information includes: a device status of at least one device of the first type, the device status being information used to indicate whether the device is in a running state; the first device is different from a second device, wherein the second device is a device in a running state among the at least one device; unfreezing a first task in a frozen state; wherein the first task is not in a blocked state when frozen.
[0056] For the similarities between the embodiments of the present application and the system sleep method, as well as the same nouns and objects, please refer to the relevant description of the above-mentioned system sleep method embodiment, which will not be repeated here.
[0057] Exemplarily, the device status information may be generated during the operation of the system based on whether the at least one device is in operation. The present application may detect whether at least one external device is in operation when the system is running, thereby maintaining the device status of the external device when the system is running.
[0058] Exemplarily, the device state may include a first state or a second state, wherein the first state is used to indicate that the device is in an operating state (e.g., a startup state, a power-on state, etc.), and the device in an operating state is also referred to as an awake state; the second state is used to indicate that the device is not in an operating state (e.g., a shutdown state, a stopped operating state, a power-off state, etc.), and the device is not in an operating state is also referred to as a dormant state. The device in an operating state is also referred to as an awake state.
[0059] In an embodiment of the present application, when the system wakes up, the device can be woken up and then the task can be unfrozen. When waking up the device, the number of device wake-ups can be reduced based on the device status information maintained during system operation, thereby speeding up the device wake-up process. When unfreezing tasks, tasks in a blocked state may not be unfrozen, thereby reducing the number of unfrozen tasks and speeding up the task unfreezing speed. In this way, the overall system wake-up speed can be improved and the duration of the system wake-up process can be shortened. As a result, the response time of system wake-up (such as lighting the screen) of electronic devices equipped with the system can be shortened, thereby improving the user experience.
[0060] In a possible implementation, before waking up the first device of the first type based on the device status information, the method also includes: after the CPU comes online, when it is detected that the system wake-up request is a preset wake-up request, increasing the operating frequency of the CPU to a first frequency; wherein the first frequency is the maximum operating frequency of the CPU.
[0061] Exemplarily, when the CPU in the system is a single-core CPU, the frequency of the main core CPU can be increased according to the frequency increase strategy of this application after the main core CPU is online. Exemplarily, when the CPU in the system is a multi-core CPU, the frequency of the slave core CPU can be increased according to the frequency increase strategy of this application after the slave core CPU is online.
[0062] Exemplarily, the preset wake-up request is a wake-up request related to user experience.
[0063] The effects and principles of this implementation are similar to the effects and principles of the corresponding frequency increase implementation of the above-mentioned system sleep method, and will not be repeated here.
[0064] In this embodiment, when the system wake-up request is a preset wake-up request, the CPU operating frequency can be increased to the maximum operating frequency to accelerate the CPU instruction execution speed. Then, when the above-mentioned system wake-up related operations are performed in response to the system wake-up request, the system wake-up process can be accelerated as a whole (for example, the task unfreezing process, the device wake-up process, etc. can be accelerated) to maximize the user experience.
[0065] In a possible implementation, before waking up the first device of the first type based on the device status information, the method also includes: after the CPU comes online, when it is detected that the system wake-up request is not a preset wake-up request, increasing the operating frequency of the CPU to a second frequency; wherein the second frequency is less than the first frequency, and wherein when the operating frequency of the CPU is the second frequency, the energy efficiency ratio of the CPU is the highest.
[0066] The effects and principles of this implementation are similar to the effects and principles of the corresponding frequency increase implementation of the above-mentioned system sleep method, and will not be repeated here.
[0067] In this embodiment, when the system wake-up request is not a preset wake-up request, it means that the system wake-up request is irrelevant to the user experience, so the user does not care about the speed of the system wake-up process. In order to reduce power consumption, the CPU operating frequency can be adjusted to the above-mentioned operating frequency with the best energy efficiency ratio to save system power consumption to the greatest extent.
[0068] It can be understood that the present application provides a frequency modulation strategy for the CPU used in the system sleep or wake-up scenario, and the frequency modulation strategy includes increasing the CPU frequency to the highest operating frequency when the system sleep request or the system wake-up request is a preset request, and increasing the CPU frequency to the operating frequency with the best energy efficiency ratio when the system sleep request or the system wake-up request is not a preset request.
[0069] In a possible implementation, after unfreezing the first task in a frozen state, the method further includes: restoring the frequency modulation strategy of the CPU to the original frequency modulation strategy; wherein the original frequency modulation strategy is the frequency modulation strategy of the CPU before receiving the system wake-up request.
[0070] Exemplarily, the present application does not limit the original frequency modulation strategy of the CPU, and the original frequency modulation strategy is the frequency modulation strategy of the CPU before the frequency increase operation of the present application during the system sleep or wake-up process.
[0071] Exemplarily, the original frequency modulation strategy may be a fixed frequency modulation strategy, that is, adjusting the CPU operating frequency to a fixed operating frequency configured by the strategy. Exemplarily, the original frequency modulation strategy may also be a dynamic frequency modulation strategy, that is, flexibly adjusting the CPU operating frequency according to the tasks running on the CPU.
[0072] In a possible implementation manner, the first task is a task that is not in a blocked state among tasks of the second type, wherein the second type of tasks are tasks other than system tasks in the operating system.
[0073] The effects and principles of this implementation are similar to those of the implementation of filtering system tasks and tasks in a blocked state corresponding to the above-mentioned system hibernation method, and will not be described in detail here.
[0074] When unfreezing tasks, this embodiment does not need to unfreeze system tasks (including system service tasks in user mode and system tasks in kernel mode), but only needs to unfreeze tasks that are not in a blocked state among ordinary tasks. There are a large number of system tasks, and there is no need to unfreeze system tasks, which can greatly improve the task unfreezing speed, thereby shortening the system wake-up time.
[0075] In a possible implementation, waking up the first device of the first type based on the device status information includes: filtering the second device in the first type of devices based on the device status information to determine the first device of the first type; and waking up the first device.
[0076] In an embodiment of the present application, the awakened (eg, in operation) peripherals can be filtered out from the peripherals of the system (eg, all peripherals), and the remaining peripherals after filtering can be awakened, thereby reducing the number of awakened devices.
[0077] In a possible implementation, the method further includes: during the operation of the system, when it is detected that a third device of the first type is in an operating state, recording or updating the device state of the third device to a first state to generate or update the device state information; wherein the first state is information used to indicate that the third device is in an operating state; during the operation of the system, when it is detected that a fourth device of the first type is not in an operating state, recording or updating the device state of the fourth device to a second state to generate or update the device state information; wherein the second state is information used to indicate that the fourth device is not in an operating state; the device state is the first state or the second state; wherein the at least one device includes: the third device and / or the fourth device.
[0078] The effects and principles of this implementation are similar to those of the embodiment of generating and updating color environment status information corresponding to the above-mentioned system sleep method, and are not described in detail here.
[0079] In the embodiment of the present application, when the system is running, the detected devices in the running state and / or the detected devices not in the running state are recorded or updated in the above data structure (such as a linked list), so that the device status information can be generated or updated. When the system wakes up, based on the devices in the first state (running state) recorded in the device status information, the number of awakened devices can be reduced and the device awakening speed can be improved.
[0080] In a possible implementation, after waking up the first device of the first type based on the device status information, the method further includes: recording or updating the device status of the first device to the first status in the device status information.
[0081] Exemplarily, during the system wake-up process, after the first device (e.g., part of the peripherals) is woken up based on the device status information, all the peripherals can be woken up. Then, in order to ensure the accuracy of the device status information, the status information of the peripherals woken up during the system wake-up process can be recorded or updated in the device status information, so that the device status of the first device in the device status information is a running status (e.g., a first status).
[0082] In a possible implementation, the present application provides a system hibernation device. The system hibernation device includes: a filtering module, which is used to filter a first task in a blocked state in response to receiving a system hibernation request; a freezing module, which is used to freeze the filtered second task that is not in a blocked state; a hibernation device module, which is used to hibernate a first device of a first type based on device status information; wherein the device status information includes: a device status of at least one device of the first type, the device status being information used to indicate whether the device is in a running state; the first device is different from the second device, wherein the second device is a device that is not in a running state among the at least one device.
[0083] In a possible implementation, the system sleep device further includes: a first frequency increasing module, configured to increase the operating frequency of the CPU to a first frequency when it is detected that the system sleep request is a preset sleep request; wherein the first frequency is the maximum operating frequency of the CPU.
[0084] In a possible implementation, the system sleep device further includes: a second frequency increasing module, for increasing the operating frequency of the CPU to a second frequency when it is detected that the system sleep request is not a preset sleep request; wherein the second frequency is less than the first frequency, and wherein when the operating frequency of the CPU is the second frequency, the energy efficiency ratio of the CPU is the highest.
[0085] In a possible implementation, the filtering module is specifically configured to filter the first task in a blocked state among the second type of tasks; wherein the second type of tasks are tasks other than system tasks in the operating system.
[0086] In a possible implementation manner, the system hibernation device further includes: a signal sending module, configured to send a freeze signal to the second type of task, wherein the freeze signal is used to instruct the task to be frozen.
[0087] In a possible implementation, the system hibernation device further includes: a saving module, used to save the third task in the second task that is not in a frozen state to the first data structure; a traversal module, used to loop through the third task in the first data structure and detect the task status of the traversed third task; a deletion module, used to delete the third task in a frozen state from the first data structure when it is detected in the first data structure that the task status of the third task is the frozen state; the traversal module is also used to continue to loop through the first data structure when it is detected in the first data structure that the task status of the third task is not the frozen state until the first data structure is empty.
[0088] In one possible implementation, the CPU of the system is a multi-core CPU, and the multi-core CPU includes a master core CPU and at least one slave core CPU. The system hibernation device also includes: a reservation module, which is used to reserve the timers and tasks on the first slave core CPU without migrating them to the second CPU before powering off the first slave core CPU; wherein the second CPU is the second slave core CPU or the master core CPU; the at least one slave core CPU includes the first slave core CPU, or further includes the second slave core CPU.
[0089] In a possible implementation, the sleep device module is specifically configured to: filter the second device in the first type of devices based on the device status information to determine the first type of first device; and put the first device to sleep.
[0090] In a possible implementation, the system hibernation device further includes: a device status management module, used for: during the operation of the system, when it is detected that the third device of the first type is in an operating state, recording or updating the device status of the third device to a first state to generate or update the device status information; wherein the first state is information used to indicate that the third device is in an operating state; during the operation of the system, when it is detected that the fourth device of the first type is not in an operating state, recording or updating the device status of the fourth device to a second state to generate or update the device status information; wherein the second state is information used to indicate that the fourth device is not in an operating state; the device status is the first state or the second state; wherein the at least one device includes: the third device and / or the fourth device.
[0091] In a possible implementation manner, the device status management module is further configured to record or update the device status of the first device to the second status in the device status information.
[0092] The effects of the system hibernation devices of the above embodiments are similar to the effects of the system hibernation methods of the above embodiments, and will not be described in detail here.
[0093] In a possible implementation, the present application provides a system wake-up device. The system wake-up device includes: a wake-up device module, which is used to wake up a first device of a first type based on device status information in response to receiving a system wake-up request; wherein the device status information includes: a device status of at least one device of the first type, the device status being information used to indicate whether the device is in a running state; the first device is different from a second device, wherein the second device is a device in a running state among the at least one device; and a thawing module, which is used to thaw a first task in a frozen state; wherein the first task is not in a blocked state when frozen.
[0094] In a possible implementation, the system wake-up device further includes: a first frequency increasing module, which is used to increase the operating frequency of the CPU to a first frequency after the CPU comes online and when it is detected that the system wake-up request is a preset wake-up request; wherein the first frequency is the maximum operating frequency of the CPU.
[0095] In a possible implementation, the system wake-up device also includes: a second frequency increasing module, which is used to increase the operating frequency of the CPU to a second frequency after the CPU comes online and when it is detected that the system wake-up request is not a preset wake-up request; wherein the second frequency is less than the first frequency, and wherein when the operating frequency of the CPU is the second frequency, the energy efficiency ratio of the CPU is the highest.
[0096] In a possible implementation, the system wake-up device further includes: a frequency increase release module, configured to restore the frequency modulation strategy of the CPU to the original frequency modulation strategy; wherein the original frequency modulation strategy is the frequency modulation strategy of the CPU before receiving the system wake-up request.
[0097] In a possible implementation manner, the first task is a task that is not in a blocked state among tasks of the second type, wherein the second type of tasks are tasks other than system tasks in the operating system.
[0098] In a possible implementation manner, the device waking-up module is specifically configured to: filter the second device in the first type of devices based on the device status information to determine the first type of first device; and wake up the first device.
[0099] In a possible implementation, the system wake-up device also includes: a device status management module, used to: during the operation of the system, when it is detected that the third device of the first type is in an operating state, record or update the device status of the third device to a first state to generate or update the device status information; wherein the first state is information used to indicate that the third device is in an operating state; during the operation of the system, when it is detected that the fourth device of the first type is not in an operating state, record or update the device status of the fourth device to a second state to generate or update the device status information; wherein the second state is information used to indicate that the fourth device is not in an operating state; the device status is the first state or the second state; wherein the at least one device includes: the third device and / or the fourth device.
[0100] In a possible implementation manner, the device status management module is further configured to record or update the device status of the first device to the first status in the device status information.
[0101] The effects of the system awakening devices of the above embodiments are similar to the effects of the system awakening methods of the above embodiments, and will not be described in detail here.
[0102] In a possible implementation, the present application provides a system hibernation device. The system hibernation device includes one or more interface circuits and one or more processors; the interface circuit is used to receive a signal from a memory and send the signal to the processor, the signal including a computer instruction stored in the memory; when the processor executes the computer instruction, the processor can implement the system hibernation method in any of the above implementations.
[0103] The effect of the system hibernation device of this embodiment is similar to the effect of the system hibernation method of the above embodiments, and will not be described in detail here.
[0104] In a possible implementation, the present application provides a system wake-up device. The system wake-up device includes one or more interface circuits and one or more processors; the interface circuit is used to receive a signal from a memory and send the signal to the processor, the signal including a computer instruction stored in the memory; when the processor executes the computer instruction, the processor can implement the system wake-up method in any of the above implementations.
[0105] The effect of the system awakening device of this embodiment is similar to the effect of the system awakening method of the above embodiments, and will not be described in detail here.
[0106] In a possible implementation, the present application provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program runs on a computer or a processor, the computer or the processor executes the system hibernation method in any of the above implementations, or the computer or the processor executes the system wake-up method in any of the above implementations.
[0107] The effect of the computer-readable storage medium of this embodiment is similar to the effect of the system sleep method or system wake-up method of the above embodiments, and will not be described in detail here.
[0108] In a possible implementation, the present application provides a computer program product. The computer program product includes a software program, and when the software program is executed by a computer or a processor, the system sleep method or system wake-up method in any one of the above implementations is executed.
[0109] The effect of the computer program product of this embodiment is similar to the effect of the system sleep method or system wake-up method of the above embodiments, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0110] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0111] Figure 1 The figure is a schematic diagram showing the process of system sleep and wake-up in the conventional technology.
[0112] Figure 2a is a schematic diagram of a microkernel architecture of a host shown as an example;
[0113] Figure 2b is a schematic diagram of a system software architecture shown as an example;
[0114] Figure 2c The diagram is an exemplary diagram of the interaction of each module;
[0115] Figure 3a is a schematic diagram of an exemplary system hibernation process;
[0116] Figure 3b is a schematic diagram of an exemplary system wake-up process;
[0117] Figure 4a is a schematic diagram of an exemplary frequency increase process;
[0118] Figure 4b is a graph of test data shown as an example;
[0119] Figure 5a A schematic diagram of an exemplary freezing task process;
[0120] Figure 5b A schematic diagram of an exemplary freezing task process;
[0121] Figure 6a A schematic diagram of a process of device status management is shown as an example;
[0122] Figure 6b A schematic diagram of a process of hibernating a device is shown as an example;
[0123] Figure 6c A schematic diagram of a process of waking up a device is shown as an example;
[0124] Figure 7a A schematic diagram of the structure of a device provided in an embodiment of the present application;
[0125] Figure 7b A schematic diagram of the structure of a device provided in an embodiment of the present application;
[0126] Figure 8 A schematic diagram of the structure of a chip provided in an embodiment of the present application. DETAILED DESCRIPTION
[0127] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0128] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0129] The terms "first" and "second" in the description and claims of the embodiments of the present application are used to distinguish different objects rather than to describe a specific order of objects. For example, a first target object and a second target object are used to distinguish different target objects rather than to describe a specific order of target objects.
[0130] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0131] In the description of the embodiments of the present application, unless otherwise specified, the meaning of "multiple" refers to two or more than two. For example, multiple processing units refer to two or more processing units; multiple systems refer to two or more systems.
[0132] In the field of sleep and wakeup of computer operating systems, ACPI (Advanced Configuration and Power Interface) defines six power states, namely S0-S5:
[0133] S0: Working state (also called running state), all devices are fully turned on.
[0134] S1: Power on Suspend (POS for short), the CPU clock is turned off, and other components still work normally.
[0135] S2: The CPU stops running, the bus clock is turned off, and other components still operate normally.
[0136] S3: Suspend to RAM (abbreviated as STR, also known as hibernation state), only necessary devices such as memory are powered to ensure that data is not lost, other components are in a closed state, and the system power consumption is extremely low.
[0137] S4: Suspend to Disk (STD for short), the system main power is turned off, but the hard disk is still powered and can be awakened. It is a power state that saves more power than S4.
[0138] S5: All devices including the power supply are turned off, and the system power consumption is 0.
[0139] In this field, electronic devices can control the operating system to enter S3 (also known as the sleep state) when the operating system does not need to work according to different power states to save system power consumption. When a wake-up type interrupt occurs, the electronic device can wake up the operating system of the device from the sleep state and restore it to S0 (also known as the running state, or the wake-up state) to resume the system.
[0140] Current electronic devices generally have sleep and wake-up functions. Figure 1The figure is a schematic diagram showing the process of system sleep and wake-up in the Linux kernel architecture in the conventional technology.
[0141] like Figure 1 As shown, the sleep process is as follows: first, a sleep request is initiated by the user state, and the sleep request module can receive the sleep request. Then, the freezing task module can freeze the task based on the sleep request, specifically freezing the user state task and the kernel state task. Exemplarily, freezing the process can be understood as the kernel setting the state of all processes in the process list to the stopped state and saving the context of all processes. Exemplarily, freezing the kernel state task can set the state of the kernel state task (such as the system task) to the stopped state. Then, the sleep peripheral module can call the suspend callback function of the registered device to sleep the peripherals in the registration order. Then, the offline slave core module can put the slave core CPU to sleep so that the slave core CPU goes offline. Then, the offline core device module can control the core device to stop running and take the core device offline. Finally, the sleep main core module can control the main core CPU to enter the sleep state so that the main core CPU goes to sleep.
[0142] The wake-up process is as follows: The operating system in the dormant state is Figure 1 The interrupt or other events shown wake up the Figure 1 It can be seen that the execution order of the steps in the wake-up process is opposite to that of the sleep process. The following is a brief description. First, the main core wake-up module can start the main core CPU to wake up the main core. Then, the online core device module can start the core device to bring the core device online. Next, the online slave core module can start the slave core CPU to bring the slave core CPU online. Then, the wake-up peripheral module can start the peripheral to wake up the peripheral. Finally, the thawing task module can start the user-mode task and kernel-mode task in the stopped state to thaw the task and put the task in the running state, and the wake-up process is completed.
[0143] exist Figure 1 In the scheme, during the hibernation process, the process of freezing tasks takes a long time, and the more tasks that need to be frozen, the longer the process takes; in addition, during the hibernation and wake-up process, the process of hibernating devices (including peripherals) and waking devices (including peripherals) also takes a long time, and the more hardware devices in the electronic device, the longer it takes. Therefore, the system hibernation and wake-up scheme in the related art may cause the system's hibernation and wake-up processes to take too long, and the hibernation and wake-up speed is slow because the process of freezing tasks and hibernating devices and waking devices takes a long time.
[0144] The longer the system's sleep and wake-up processes take, the greater the power consumption of the sleep and wake-up processes. Moreover, the longer the sleep and wake-up processes take, the longer the response time of sleep and wake-up (for example, turning the screen on and off) will be, affecting the user experience. In addition, the slow sleep and wake-up speed of the system can shorten the standby time of the electronic device.
[0145] To this end, the present application provides a method for sleeping and waking up an operating system, which can improve the speed of the sleeping and waking up process of the operating system by increasing the CPU frequency, and reduce the time consumed by the sleeping and waking up process. And by reducing the number of frozen tasks and the number of sleeping and waking up devices, the time consumed by the sleeping and waking up process of the operating system can be shortened, thereby shortening the response time of the sleeping and waking up of the electronic device (such as turning the screen on and off), so as to improve the user experience and reduce the power consumption of the system. And the speed of the system sleeping and waking up process is improved, which can extend the standby time of the electronic device.
[0146] Exemplarily, the electronic device on which the operating system for sleep and wake-up in the present application is installed may be a cellular phone, a tablet computer, a wearable device or an IoT device, a cockpit domain controller (CDC), etc., and the present application does not impose any restrictions on this.
[0147] The following is an explanation of the technical terms involved in this application:
[0148] In a computer system, the CPU in the power management module is downgraded from a higher level active state to an inactive state, which is called sleep; receiving a signal to make the system run again is called wake-up. In each embodiment of the present application, the system sleep process is described as entering the S3 state, and the system wake-up process is described as entering the S0 state.
[0149] Power consumption: refers to the amount of energy consumed per unit time, measured in W.
[0150] Frequency increase: refers to increasing the CPU's operating frequency, thereby improving CPU performance.
[0151] Freeze task: Set the task status to stop to suspend the task. The frozen task cannot generate data and will not interact with any module. The task status of the frozen task is freeze.
[0152] Unfreeze task: restore the task status from frozen to running status, so that the task can continue to execute from the task status when it was frozen. The unfrozen task can generate data and interact with other modules.
[0153] For example, task 1 is frozen at time t1, so that all data and operations of task 1 are suspended at time t1. After task 1 is unfrozen at time t2, all data and operations of task 1 can be continued at time t2. Wherein, time t2 is after time t1.
[0154] Illustratively, the tasks described in various embodiments of the present application may include, but are not limited to: threads or processes.
[0155] Core device: a device that can affect the operation of the CPU. For example, a core device may include a hardware device located inside the CPU.
[0156] External devices (referred to as peripherals): devices that do not affect the operation of the CPU. The system may include a list of external devices. For example, external devices may include but are not limited to: mouse, keyboard, printer, etc.
[0157] Figure 2a The microkernel architecture diagram of the host of the present application is shown as an example. Figure 2b It can be a schematic diagram of the software architecture of the system of the present application.
[0158] Combine the following Figure 2a and Figure 2b The system of the present application is described as follows: Figure 2a As shown, the host of the present application can be divided into a multi-layer architecture, including an application layer, a framework service layer, a kernel layer and a hardware layer.
[0159] Exemplarily, the application layer and the framework service layer may be implemented in user mode, and the kernel layer and the hardware layer may be implemented in kernel mode.
[0160] Exemplarily, the application layer may include at least one application program, and application 1 to application n are shown here as examples.
[0161] For example, the application layer may receive user input.
[0162] Exemplarily, the framework service layer (also known as the microkernel service layer, or the user-mode basic service of the microkernel) may include, but is not limited to: a power management module (also known as a power management service), a driver framework module, etc. Here, only two service modules in the framework service layer are shown exemplarily, and the service framework layer may also include more service modules, which are not limited here.
[0163] The operating system of the embodiment of the present application is implemented under the microkernel architecture, and the various functional modules involved in the framework service layer can provide corresponding services to users in the form of applications by transplanting them from the kernel state to the user state under the microkernel architecture.
[0164] Exemplarily, the power management module can be used for power management, etc.
[0165] Exemplarily, the driver framework module can be used to run the driver programs of various hardware devices.
[0166] Exemplarily, the kernel layer may include a kernel processing module and a kernel interrupt subsystem.
[0167] Exemplarily, the hardware layer may include a multi-core CPU, which may include a master core CPU and at least one slave core CPU (one slave core CPU is shown here as an example). In addition, the hardware layer may also include core devices and external devices. The definitions of the two types of devices can be found above and will not be repeated here.
[0168] Combination Figure 2a In the microkernel architecture, the tasks in the operating system can be divided into user-state tasks and kernel-state tasks.
[0169] Exemplarily, a user-mode task is a task (eg, a process, a thread, etc.) running in a user-mode.
[0170] Exemplarily, user-mode tasks may include common tasks and user-mode system service tasks.
[0171] For example, a common task is a task created by a user triggering an operation, such as Figure 2a A task created by an application in the application layer in user mode or a service in the framework service layer triggering an operation.
[0172] For example, users use music applications (such as Figure 2a An application in the application layer) triggers the operation of playing music, and the system creates a task of playing music as a normal task in response to the user operation.
[0173] Exemplary user-mode system service tasks: Figure 2a The system tasks triggered by the service modules in the framework service layer (rather than triggered by the user), for example, the tasks for displaying the mobile phone desktop interface.
[0174] Exemplarily, a kernel-mode task is a system task running in kernel mode. Under the microkernel architecture of the present application, the kernel layer has low overhead.
[0175] In various embodiments of the present application, system tasks may include system service tasks in user mode and system tasks in kernel mode.
[0176] It should be noted that Figure 2aThe application layer, framework service layer, kernel layer, and hardware layer shown do not constitute a specific limitation on the device. In other embodiments of the present application, the device may include more or fewer layers than shown in the figure, and each layer may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. Figure 2a The various levels and components shown in the drawings may be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and / or application specific integrated circuits.
[0177] Figure 2b The figure is a schematic diagram showing the sleep and wake-up process of the operating system of the present application. Figure 2b The left half is a schematic diagram of the operating system's sleep process. Figure 2b The middle right half is a schematic diagram of the operating system wake-up process.
[0178] Combination Figure 2a , please refer to Figure 2b For example, the power management module (also called the sleep and wake-up management module) may include but is not limited to: Figure 2b The CPU frequency boost maintenance module, fast freezing task module, fast dormancy device module, slave core frequency boost maintenance module, fast awakening device module, and thawing task module shown may optionally include a CPU frequency boost release module.
[0179] Combination Figure 2a , please refer to Figure 2b , exemplary, the kernel processing module (also referred to as the core processing module) may include but is not limited to: Figure 2b The slave core offline module, the sleep core device module, the master core offline module, the master core online module, the wake-up core device module, and the slave core online module are shown.
[0180] Related technologies Figure 1 The system shown is applied to an operating system under a kernel architecture. Figure 2b The system shown can be applied not only to operating systems under the kernel architecture (such as the Linux operating system), but also to Figure 2a The operating system under the microkernel architecture shown in the figure will be explained below by taking the application of the system of the present application to the operating system under the microkernel architecture as an example. When the system of the present application is applied to the operating system under the kernel architecture, the principles are similar and will not be repeated one by one.
[0181] Compared to Figure 1 ,like Figure 2b As shown, the system of the present application adds the following software modules: CPU frequency boost maintenance module, slave core frequency boost maintenance module, fast freeze task module, fast sleep device module, fast wake-up device module, and optionally also includes a CPU frequency boost release module. The above modules can constitute Figure 1 The main difference of the scheme shown, however, is that Figure 2b The other modules in Figure 1 There are differences in the corresponding modules in the , and the specific differences will be explained in detail below.
[0182] Exemplarily, the CPU frequency boost maintenance module and the slave core frequency boost maintenance module can implement a CPU precise frequency boost mechanism, which can be specifically used to obtain a system sleep or wake-up request and determine whether the request is a preset request (a preset sleep request or a preset wake-up request). If the request is a preset request (a preset sleep request or a preset wake-up request), it means that the request is strongly related to the user experience, and thus the operating frequency of the CPU (main core CPU, and / or, slave core CPU) is increased to the highest operating frequency to increase the CPU's instruction execution speed, thereby accelerating the completion of the system sleep or wake-up process. On the contrary, if the request is not a preset request, it means that the request is not strongly related to the user experience, and then the CPU's operating frequency can be increased to the operating frequency with the best energy efficiency ratio to maintain the CPU's sleep and wake-up process with the lowest power consumption.
[0183] Exemplarily, the above-mentioned CPU precise frequency increase mechanism can be regarded as a CPU frequency increase strategy provided by the present application, and the CPU frequency increase strategy can be triggered during system sleep or system wake-up.
[0184] Exemplarily, the preset sleep request is a sleep request related to user experience. The preset wake-up request is a wake-up request related to user experience. Exemplarily, the request related to user experience may be a system sleep request in a scenario where the user wants the system sleep (or wake-up) process to be faster and take less time.
[0185] Exemplarily, when the operating frequency of the CPU is the operating frequency a with the best energy efficiency ratio, the energy efficiency ratio of the CPU is the highest. It can be understood that when the CPU is at different operating frequencies to complete the same amount of instruction execution tasks, when the operating frequency of the CPU is the operating frequency a, the power consumption of the CPU is the lowest. Therefore, the operating frequency a can be named as the operating frequency with the best energy efficiency ratio of the CPU.
[0186] Exemplarily, the fast freezing task module can implement a fast freezing task mechanism, under which there is no need to wait for blocking tasks, and optionally no need to freeze system tasks, reducing the number of frozen tasks to achieve fast freezing of tasks, thereby accelerating the system hibernation process.
[0187] Exemplarily, when the fast freezing task module filters tasks, there is no restriction on the execution order of the filtering steps for the tasks in the blocking state and the filtering steps for the system tasks. Optionally, the system tasks are first filtered to obtain the ordinary tasks, and then the tasks in the blocking state among the ordinary tasks are filtered, and only the ordinary tasks in the non-blocking state are frozen to accelerate the task freezing.
[0188] Exemplarily, the fast freezing task module may also directly identify common tasks, and then filter the common tasks that are in a blocked state, so that only the common tasks that are in a non-blocked state are frozen to accelerate task freezing.
[0189] For example, the fast sleep device module and the fast wake device module can be combined with the runtime sleep and wake mechanism to manage and record the status (sleep state or wake state) of the plug-in device when the system is running. Then, when the system needs to sleep or wake up, the number of nodes of the plug-in device to be sleep or wake up can be reduced based on the recorded status of the plug-in device, so as to quickly sleep and wake up the device, thereby accelerating the system sleep and wake up process.
[0190] Exemplarily, the CPU frequency increase release module can be used to restore the CPU frequency modulation strategy to the original frequency modulation strategy after the task is unfrozen; wherein the original frequency modulation strategy is the CPU frequency modulation strategy before receiving the system wake-up request.
[0191] Exemplarily, the CPU here is a CPU that has been frequency-increased using the frequency-increase strategy of the present application during system sleep or wake-up, and may be a master core CPU or a slave core CPU, and the present application does not impose any limitation thereto.
[0192] Exemplarily, the present application does not limit the original frequency modulation strategy of the CPU, and the original frequency modulation strategy is the frequency modulation strategy of the CPU before the frequency increase operation of the present application during the system sleep or wake-up process.
[0193] Exemplarily, the original frequency modulation strategy may be a fixed frequency modulation strategy, that is, adjusting the CPU operating frequency to a fixed operating frequency configured by the strategy. Exemplarily, the original frequency modulation strategy may also be a dynamic frequency modulation strategy, that is, flexibly adjusting the CPU operating frequency according to the tasks running on the CPU.
[0194] Figure 2b The various modules and communication connection relationships shown in the system of the present application are merely an example. The system of the present application may have more or fewer modules than those shown in the figure, may combine two or more modules, or may have different module configurations. Figure 2b The various modules shown in the drawings may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application specific integrated circuits.
[0195] Figure 2c for Figure 2a A schematic diagram showing the interaction of some components during the process of executing system sleep or system wakeup.
[0196] It should be noted that Figure 2c The interaction between different modules is shown by a unidirectional arrow. In a specific application, there may be bidirectional interactive communication between different modules, which will not be described in detail here.
[0197] Combine the following Figure 2c right Figure 2b The workflow of each module is explained in this paper.
[0198] Example 1, system hibernation process:
[0199] Step 11: Receive a system sleep request.
[0200] For example, Figure 2c As shown, the power management module may receive a system sleep request from the application layer or the kernel interrupt subsystem.
[0201] Exemplarily, the system sleep request may be a preset event triggered by the system, or a preset event triggered by a user at the application layer.
[0202] The system sleep method of the present application can be applied to system sleep scenarios of electronic devices such as mobile phones, and can also be applied to system sleep scenarios of motor vehicles and sleep scenarios of other electronic devices, and the present application does not impose any restrictions on this.
[0203] Exemplarily, when the system sleep request is triggered by the user at the application layer, the power management module may receive the system sleep request triggered by the user from the application layer.
[0204] For example, the system of the present application is applied to a mobile phone, and the user presses the lock screen button of the mobile phone to trigger the system sleep request, wherein the user wants to quickly turn off the screen, then the system sleep request here is a preset sleep request that is strongly related to the user experience. It is understandable that the preset sleep request that is strongly related to the user experience is not limited to the example here.
[0205] For example, the system of the present application can be applied to CDC in a motor vehicle scenario. If the motor vehicle does not move for a long time and the user does not perform any operation on the display screen of the motor vehicle for a long time, the system can trigger a system sleep request to sleep the motor vehicle system. The system sleep request here does not belong to the preset sleep request that is strongly related to the user experience.
[0206] Exemplarily, in a motor vehicle scenario, the CDC may be divided into an instrument domain and an entertainment domain. Exemplarily, the preset sleep request may include a sleep request related to the display of the instrument domain or the entertainment domain.
[0207] Exemplarily, when the system sleep request is triggered by the system, the power management module may receive the system sleep request from the interrupt subsystem.
[0208] For example, the system of the present application can be applied to a mobile phone. If the screen of the mobile phone is on for a long time and the mobile phone does not receive any input triggered by the user, the interrupt subsystem will periodically send a system sleep request to the power management module, so that the power management module receives the system sleep request triggered by the system from the interrupt subsystem. Among them, the user does not care about the speed of the sleep process, so the system sleep request does not belong to the preset sleep request that is strongly related to the user experience.
[0209] It should be noted that the consideration criteria for whether a system sleep request is a preset sleep request that is strongly related to user experience does not limit the system sleep request triggered by the user at the application layer to be a preset sleep request, nor does it limit the system sleep request automatically issued by the interrupt subsystem to not be a preset sleep request. Whether a system sleep request is a preset sleep request has no direct correlation with the triggering object of the system sleep request.
[0210] For example, Figure 2b As shown, the CPU frequency boosting and maintaining module in the power management module may receive a system sleep request sent by the application layer, or the CPU frequency boosting and maintaining module may receive a system sleep request sent by the kernel interrupt subsystem.
[0211] Step 12: Increase CPU frequency.
[0212] For example, Figure 2c The power management module shown (eg Figure 2b The CPU frequency increase and maintenance module shown in the figure may determine the target frequency (the highest operating frequency or the operating frequency with the best energy efficiency ratio) to which the CPU frequency is to be increased based on whether the system sleep request is a preset sleep request.
[0213] In a possible implementation, in a multi-core CPU scenario, the multi-core CPU can be divided into multiple groups of CPUs. For example, an 8-core CPU can include two groups of 4-core CPUs, wherein the operating frequencies of each CPU in a group of 4-core CPUs are close. Then, when the CPU frequency increase and maintenance module determines the target frequency to be increased for the CPU, it can determine the target frequency for each group of CPUs, and the target frequencies of the same group of CPUs are the same. For example, the target frequency is the highest operating frequency corresponding to the group of CPUs, or the operating frequency with the best energy efficiency ratio.
[0214] In another possible implementation, in a multi-core CPU scenario, the operating frequency of each single-core CPU can be controlled separately, so when the CPU frequency increase and maintenance module determines the target frequency to be increased to, it can determine the target frequency for each single-core CPU separately, and the target frequencies of each core CPU are independent of each other. For example, the target frequency of a single-core CPU is the highest operating frequency of the single-core CPU, or the operating frequency with the best energy efficiency ratio.
[0215] It should be noted that in a multi-core CPU scenario, the multi-core CPU includes a master core CPU and at least one slave core CPU. This application does not restrict the order in which different slave core CPUs are taken offline and the order in which the frequencies are increased, but the slave core CPUs are all taken offline before the master core CPU.
[0216] For example, in the sleep process, for a CPU that needs to be taken offline, before taking the CPU offline, the system of the present application may first increase its operating frequency so that the CPU can freeze the tasks running on the CPU at a higher operating frequency, thereby accelerating the system sleep process and shortening the duration of the sleep process.
[0217] In a possible implementation, Figure 2c The power management module shown (eg Figure 2b The CPU frequency increase and maintenance module shown in the figure can notify the core processing module of the CPU to be frequency increased and the target frequency to which the CPU is to be frequency increased. The core processing module can send instructions to the main core CPU to increase the operating frequency of the main core CPU and / or the slave core CPU to the corresponding target frequency.
[0218] Exemplarily, the CPU to be frequency-increased may include a master core CPU and / or a slave core CPU, which is not limited in the present application.
[0219] For example, Figure 2c As shown, the master core CPU can increase the frequency of the slave core CPU. Exemplarily, the core processing module can send a first instruction to the master core CPU, so that the master core CPU can increase the operating frequency of the slave core CPU to the corresponding target frequency.
[0220] Exemplarily, the core processing module may also send a second instruction to the main core CPU, so that the main core CPU increases the operating frequency of the main core CPU to the corresponding target frequency.
[0221] The first instruction and the second instruction may be the same or different, and this application does not limit this. In this implementation, the master core CPU may increase the frequency of the slave core CPU.
[0222] In another embodiment, a power management module (e.g. Figure 2bThe CPU frequency increase maintenance module shown in FIG. 1 may also notify the CPU to be frequency increased and the target frequency to which the CPU is to be frequency increased to the CPU. Figure 2a The core device driver module shown is used to increase the operating frequency of the master core CPU and / or the slave core CPU to the corresponding target frequency. Exemplarily, the master core CPU can also increase the operating frequency of the slave core CPU to the corresponding target frequency. Exemplarily, the core device driver module may include a driver for the core device.
[0223] Step 13, task freeze.
[0224] Exemplarily, after step 12, Figure 2c The power management module shown (eg Figure 2b The fast freezing task module shown in the figure can filter the tasks in the operating system (e.g., all the tasks in the operating system) based on the fast freezing task mechanism. Exemplarily, the power management module can filter the ordinary tasks in the blocked state and filter the system tasks (including the system service tasks in the user state and the system tasks in the kernel state) for all the tasks in the operating system. In addition, the power management module can control the main core CPU and / or the slave core CPU with the help of the kernel processing module to freeze the ordinary tasks that are not in the blocked state executed on the corresponding CPU, which can reduce the number of frozen tasks, thereby realizing the fast freezing of tasks.
[0225] Optionally, in a possible implementation, in step 13, when the system of the present application is applied to an operating system under a kernel architecture, such as a Linux operating system, the power management module can filter out tasks in a blocked state for tasks in the operating system (e.g., all tasks in the operating system) based on a fast freezing task mechanism. In addition, the power management module can control the main core CPU and / or the slave core CPU with the aid of the kernel processing module to freeze the tasks that are not in a blocked state executed on the corresponding CPU. In this process, there is no need to freeze tasks in a blocked state, which can reduce the number of frozen tasks, thereby achieving fast freezing of tasks.
[0226] Step 14: hibernate non-core devices.
[0227] Exemplarily, after step 13, Figure 2c The power management module shown (eg Figure 2b The fast sleep device module shown in the figure can be combined with the runtime sleep wake-up mechanism to Figure 2b Before the system sleep or system wake-up process shown in the figure, whether the non-core device (such as a plug-in device) is in the sleep state or wake-up state is managed. Figure 2bIn the system sleep process shown, the power management module does not need to traverse the external devices in sleep state, which can reduce the number of calls to the first callback function for sleep devices, thereby speeding up the sleep process of the devices. Among them, one device may correspond to one first callback function for sleep devices.
[0228] Exemplary, exemplary, Figure 2c The peripheral module shown may include drivers for corresponding external devices, such as Figure 2c As shown, when the power management module puts the traversed external devices into sleep mode, the power management module may call the peripheral module to put the corresponding external devices into sleep mode. Exemplarily, the power management module may call the first callback function of the driver of the corresponding device to put the corresponding external device into sleep mode.
[0229] Step 15, offline the slave core CPU.
[0230] Exemplarily, after step 14, Figure 2c The power management module shown (eg Figure 2b The fast sleep device module shown in FIG. 10 may notify the kernel processing module (eg Figure 2b Of course, when a CPU is offline, the information that the power management module notifies the core processing module is not limited to the examples given here, and may include more information, which is not limited here.
[0231] Exemplarily, the kernel processing module may freeze all kernel-mode tasks (eg, kernel-mode threads) running on the slave-core CPU, and control the slave-core CPU to perform operations such as going offline.
[0232] Step 16: hibernate the core device.
[0233] Exemplarily, after step 15, Figure 2c The kernel processing modules shown (e.g. Figure 2b The hibernate core device module shown) can hibernate (eg shut down) the core device.
[0234] Step 17, offline the main core CPU.
[0235] Exemplarily, after step 16, Figure 2c The kernel processing modules shown (e.g. Figure 2b The main core offline module shown in the figure can freeze all kernel state tasks (such as kernel state threads) running on the main core CPU and control the main core CPU to perform offline operations.
[0236] In this embodiment, the operating system can be hibernated through the above steps 11 to 17, the CPU can be frequency-increased, and the CPU after frequency-increase can be used to process the instructions of the hibernation process to accelerate the system hibernation process; and when freezing tasks, there is no need to freeze tasks in a blocked state, which can reduce the number of frozen tasks, and optionally, the system tasks can be filtered, so that only ordinary tasks that are not in a blocked state are frozen, which can further reduce the number of frozen tasks, thereby accelerating the task freezing speed; and during the operation of the system, the device status can be managed based on the device status change, so when the non-core device is hibernated, the number of traversals of the hibernating device can be reduced, thereby accelerating the device hibernation process. Based on the above process, the duration of the system hibernation process can be shortened, and the system hibernation speed can be increased to improve the user experience and reduce power consumption.
[0237] Example 2, system wake-up process:
[0238] Step 21: Receive a system wake-up request.
[0239] For example, Figure 2c As shown, the power management module may receive a system wake-up request from the application layer or the kernel interrupt subsystem.
[0240] Exemplarily, the system sleep request may be a preset event triggered by the system, or a preset event triggered by a user at the application layer.
[0241] The system wake-up method of the present application can be applied to system wake-up scenarios of electronic devices such as mobile phones, and can also be applied to system wake-up scenarios of motor vehicles and wake-up scenarios of other electronic devices. The present application does not impose any restrictions on this.
[0242] For example, Figure 2c As shown, after the system is in hibernation, the power management module may receive a system wake-up request sent by the application layer, or the power management module may receive a system wake-up request sent by the kernel interrupt subsystem.
[0243] Exemplarily, when the system wake-up request is triggered by the user at the application layer, the power management module may receive the system wake-up request triggered by the user from the application layer.
[0244] For example, the system of the present application is applied to a mobile phone, and the user presses the lock screen button of the mobile phone to trigger the system wake-up request, where the user wants to quickly light up the screen. In this case, the system wake-up request here is a preset wake-up request that is strongly related to the user experience.
[0245] For example, the system of the present application can be applied to a CDC in a motor vehicle scenario. After the system of the motor vehicle CDC is dormant, the user presses the start engine button of the motor vehicle, and the power management module can receive a system wake-up request triggered by the user to wake up the operating system of the motor vehicle. The system wake-up request here is a preset wake-up request that is strongly related to the user experience.
[0246] Exemplarily, when the system wake-up request is triggered by the system, the power management module may receive the system wake-up request from the interrupt subsystem.
[0247] For example, the system of the present application can be applied to mobile phones. For example, after the mobile phone system goes into sleep mode, the mobile phone system can periodically send a heartbeat instruction for waking up the system to perform related operations. The heartbeat instruction here does not belong to the preset wake-up request that is strongly related to the user experience, because the user does not care about the speed of the wake-up process. Moreover, the wake-up process is imperceptible to the user.
[0248] It should be noted that the consideration criteria for whether a system wake-up request is a preset wake-up request that is strongly related to user experience does not limit the system wake-up request triggered by the user at the application layer to be a preset wake-up request, nor does it limit the system wake-up request automatically issued by the interrupt subsystem to not be a preset wake-up request. Whether a system wake-up request is a preset wake-up request has no direct correlation with the triggering object of the system wake-up request.
[0249] Step 22: Go online to the main core CPU.
[0250] For example, refer to Figure 2c , the power management module may notify the core processing module of the received system wake-up request. For example, Figure 2b As shown, the main core online module in the core processing module can receive a system wake-up request (for example, an interrupt signal for waking up the system). Figure 2c As shown, the core processing module can control the main core CPU to perform operations such as going online.
[0251] Step 23: Wake up the core device.
[0252] Exemplarily, after step 22, as Figure 2c The kernel processing modules shown (e.g. Figure 2b The wake-up core device module shown in the figure can wake up the core device (for example, start running).
[0253] Step 24, go online from the core CPU.
[0254] Exemplarily, after step 23, as Figure 2c The kernel processing modules shown (e.g. Figure 2b The slave core online module shown) can bring at least one slave core CPU online.
[0255] Step 25, CPU frequency increase.
[0256] Exemplarily, after step 24, Figure 2c The power management module shown (eg Figure 2b The slave core frequency boost maintenance module shown in the figure can determine the target frequency (the highest operating frequency or the operating frequency with the best energy efficiency ratio) to be boosted to for the online slave core CPU based on whether the system wake-up request received from the application layer or the kernel interrupt subsystem is a preset wake-up request.
[0257] Exemplarily, the number of slave core CPUs that have been put online is at least one. When the number of slave core CPUs that have been put online is multiple, the power management module can determine the target frequency to be increased (the highest operating frequency or the operating frequency with the best energy efficiency ratio) for each slave core CPU, and can also determine a common target frequency to be increased (the highest operating frequency or the operating frequency with the best energy efficiency ratio) for multiple slave core CPUs.
[0258] Exemplarily, when the system wake-up request is a preset wake-up request, the target frequency is the highest operating frequency of the corresponding slave core CPU; when the system wake-up request is not a preset wake-up request, the target frequency is the operating frequency with the best energy efficiency ratio of the corresponding slave core CPU.
[0259] For example, in the wake-up process, before waking up non-core devices and unfreezing tasks, the operating frequency of the online slave core CPU can be increased so that the slave core CPU can wake up non-core devices and unfreeze tasks at a higher operating frequency, thereby accelerating the system wake-up process and shortening the duration of the wake-up process.
[0260] In a possible implementation, Figure 2c The power management module shown (eg Figure 2b The slave core frequency increase and maintenance module shown in the figure can notify the core processing module of the CPU to be frequency increased and the target frequency to which the CPU is to be frequency increased. The core processing module can send instructions to the master core CPU to increase the operating frequency of the corresponding slave core CPU to the corresponding target frequency.
[0261] For example, Figure 2c As shown, the master core CPU can increase the frequency of the slave core CPU. Exemplarily, the core processing module can send a first instruction to the master core CPU, so that the master core CPU can increase the operating frequency of the slave core CPU to the corresponding target frequency.
[0262] In another embodiment, a power management module (e.g. Figure 2bThe slave core frequency increase maintenance module shown in FIG. 1 may also notify the CPU to be frequency increased and the target frequency to which the CPU is to be frequency increased to the CPU. Figure 2a The core device driver module shown is used to increase the operating frequency of the corresponding slave core CPU to the corresponding target frequency.
[0263] The execution principle of this step 25 is similar to the principle of step 12 in the sleep process, and will not be repeated here.
[0264] Step 26, wake up the non-core devices.
[0265] Exemplarily, after step 25, Figure 2c The power management module shown (eg Figure 2b The fast wake-up device module shown in the figure can be combined with the runtime sleep wake-up mechanism to Figure 2b Before the system sleep or system wake-up process shown in the figure, whether the non-core device (such as a plug-in device) is in the sleep state or wake-up state is managed. Figure 2b In the system wake-up process shown, the power management module does not need to traverse the external devices in the wake-up state, which can reduce the number of calls to the second callback function for waking up the device, thereby speeding up the process of waking up the device. Among them, one device may correspond to one second callback function for waking up the device.
[0266] Exemplary, exemplary, Figure 2c The peripheral module shown may include drivers for corresponding external devices, such as Figure 2c As shown, when the power management module wakes up the traversed external devices, the power management module can call the peripheral module to wake up the corresponding external devices. Exemplarily, the power management module can call the second callback function of the driver of the corresponding device to wake up the corresponding external device.
[0267] Step 27, unfreeze the task.
[0268] Exemplarily, after step 26, Figure 2c The power management module shown (eg Figure 2b The unfreeze task module shown in the figure) can unfreeze the tasks in the frozen state through the kernel processing module to resume the operation of the corresponding tasks.
[0269] Exemplarily, the task in the frozen state here is not in the blocked state when it is frozen.
[0270] Exemplarily, the task in the frozen state here is a common task.
[0271] Exemplarily, the task to be unfrozen here may be the task frozen in step 13 in Example 1.
[0272] Optionally, in step 28, CPU frequency boost is released.
[0273] Exemplarily, after step 26, Figure 2c The power management module shown (eg Figure 2b The CPU frequency increase release module shown in the figure can restore the CPU frequency modulation strategy to the original frequency modulation strategy after the task is unfrozen; wherein the original frequency modulation strategy is the CPU frequency modulation strategy before receiving the system wake-up request.
[0274] Exemplarily, the CPU here is a CPU that has been frequency-increased using the frequency-increase strategy of the present application during system sleep or wake-up, and may be a master core CPU or a slave core CPU, and the present application does not impose any limitation thereto.
[0275] Exemplarily, the present application does not limit the original frequency modulation strategy of the CPU, and the original frequency modulation strategy is the frequency modulation strategy of the CPU before the frequency increase operation of the present application during the system sleep or wake-up process.
[0276] Exemplarily, the original frequency modulation strategy may be a fixed frequency modulation strategy, that is, adjusting the CPU operating frequency to a fixed operating frequency configured by the strategy. Exemplarily, the original frequency modulation strategy may also be a dynamic frequency modulation strategy, that is, flexibly adjusting the CPU operating frequency according to the tasks running on the CPU.
[0277] Exemplarily, when determining that the operating frequency of the corresponding slave core CPU needs to be adjusted, the power management module may notify the slave core CPU of the frequency to be adjusted to. Figure 2c The kernel processing module shown in the figure. Then the kernel processing module can notify the master core CPU to adjust the operating frequency of the slave core CPU, or the kernel processing module can notify the slave core CPU to self-adjust the operating frequency of the slave core CPU, which is not limited in this application.
[0278] In this embodiment, the operating system can be awakened through the above steps 21 to 28, the CPU frequency can be increased, and the CPU with increased frequency can be used to process the instructions of the awakening process to accelerate the system awakening process; and the device status can be managed based on the device status change during the system operation, so when awakening non-core devices, the number of traversals of the awakened devices can be reduced, thereby accelerating the device awakening process. Based on the above process, the duration of the system awakening process can be shortened, the system awakening speed can be increased, so as to improve the user experience and reduce power consumption.
[0279] Figure 3a The figure is a schematic diagram showing an exemplary system hibernation process.
[0280] Figure 3aTaking the CDC of a motor vehicle as an application scenario, in this example, the CDC is divided into an instrument domain and an entertainment domain, where the instrument domain is a microkernel architecture (e.g. Figure 2a The system of the present application can run on an embedded platform.
[0281] like Figure 3a As shown, the system hibernation process may include the following steps:
[0282] S501: The power management module receives and processes a system sleep request.
[0283] For example, the power management module can refer to Figure 4a The implementation process shown implements S501 through the CPU precise frequency increase mechanism.
[0284] For example, Figure 4a As shown, the implementation process of the CPU precise frequency increase mechanism by the power management module may include:
[0285] S101, a power management module receives a system sleep request.
[0286] S102: The power management module determines whether the system sleep request is a preset request.
[0287] For example, when a user presses a sleep button on a display screen of a motor vehicle, the power management module may receive a system sleep request triggered by the user from the application layer to sleep the operating system of the motor vehicle. The system sleep request here is a preset sleep request that is strongly related to the user experience.
[0288] For example, if the motor vehicle does not move for a long time and the user does not perform any operation on the display screen of the motor vehicle for a long time, the power management module may receive Figure 2c The interrupt subsystem sends a system sleep request to sleep the vehicle system. The system sleep request here does not belong to the preset sleep request that is strongly related to the user experience.
[0289] Exemplarily, the system sleep request can be in the form of an event, so the power management module can be configured with a first preset event representing the preset sleep request. When the event that triggers the system sleep is the first preset event, the process can proceed to execute S103. When the event that triggers the system sleep is not the first preset event, the process can proceed to execute S104.
[0290] S103, when the power management module detects that the system sleep request is a preset request, it can determine that the target frequency to be increased for the CPU is the highest operating frequency.
[0291] Exemplarily, the preset request may include a preset sleep request.
[0292] For example, after a user presses the sleep button on the display screen of a motor vehicle, the user hopes that the motor vehicle system will enter the sleep state as soon as possible. The power management module can then determine the CPU to be frequency-increased and the target frequency to which the CPU is to be frequency-increased, which is the maximum operating frequency of the CPU.
[0293] Exemplarily, the power management module may be configured with the maximum operating frequency of each single-core CPU or each group of CPUs (including multi-core CPUs).
[0294] S104, when the power management module detects that the system sleep request is not a preset request, it can determine that the target frequency of the CPU to be increased is the operating frequency with the best energy efficiency ratio.
[0295] For example, if the motor vehicle does not move for a long time and the user does not perform any operation on the display screen of the motor vehicle for a long time, the power management module may receive Figure 2c The interrupt subsystem sends a system sleep request to sleep the motor vehicle system. The power management module detects that the system sleep request here does not belong to the preset sleep request that is strongly related to the user experience, and can determine the CPU to be frequency-increased and the target frequency to which the CPU is to be frequency-increased to be the operating frequency with the best energy efficiency ratio of the CPU.
[0296] Exemplarily, the operating frequency of each CPU with the best energy efficiency ratio is strongly related to the CPU hardware. The operating frequency of each CPU with the best energy efficiency ratio can be determined based on the power consumption test data of the CPU of a specific chip platform at each operating frequency.
[0297] Figure 4b The figure is a curve chart showing test data of the operating frequency of a CPU and the current of a battery.
[0298] like Figure 4b As shown, the operating frequency with the best energy efficiency ratio is Figure 4b The power consumption inflection point frequency is shown in the middle circle (for example, 918 MHz here).
[0299] It should be noted that Figure 4b The values in the horizontal and vertical axes are not used to limit the present invention. The power consumption test data is only shown here as an example, and is not used to limit the present application. Figure 4b There is no restriction on the specific value of the current at each operating frequency.
[0300] Exemplarily, the operating frequency of the best energy efficiency ratio of each CPU in the system may be a priori data, and the power management module may be configured with the operating frequency of the best energy efficiency ratio of each single-core CPU or each group of CPUs (including multi-core CPUs).
[0301] S502: The power management module increases the CPU frequency through the device driver module.
[0302] For example, Figure 3a The device driver module may include Figure 2a The core device driver module shown.
[0303] Exemplarily, the power management module can notify the core device driver module in the device driver module of the information of the CPU to be frequency-increased and the target frequency (the highest operating frequency or the operating frequency with the best energy efficiency ratio) to which the CPU is to be frequency-increased, so that the core device driver module can increase the operating frequency of the main core CPU and / or the slave core CPU to the corresponding target frequency.
[0304] Exemplarily, when the system sleep request is related to the user experience (for example, the system sleep request is a preset sleep request), the system of the present application can increase the CPU's operating frequency to its maximum operating frequency to maximize the user experience of the system sleep process; when the system sleep request is not related to the user experience (for example, the system sleep request is not a preset sleep request), the system of the present application can adjust the CPU's operating frequency to the operating frequency with the best energy efficiency ratio to maximize the saving of CPU power consumption.
[0305] For the specific implementation details of S501 and S502, reference may be made to step 11 and step 12 of embodiment 1. The principles are similar and will not be repeated here.
[0306] S503, the power management module freezes common tasks through the core processing module.
[0307] For example, the power management module can refer to Figure 5a , Figure 5b In the implementation process shown, S503 is implemented by a fast freezing task mechanism.
[0308] For example, Figure 5a As shown, the implementation process of the fast freezing task mechanism by the power management module may include the following steps:
[0309] S201 , the power management module traverses common tasks and sends a freeze signal to the common tasks.
[0310] Exemplarily, under a microkernel architecture, the power management module can traverse the system tasks in the system for filtering, and only traverse ordinary tasks, without traversing system tasks (which may include user-state system service tasks and kernel-state system tasks), and send a freeze signal to the traversed ordinary tasks, so that each ordinary task in the system can receive the freeze signal to freeze the ordinary tasks.
[0311] For example, under the kernel architecture (such as the Linux operating system), the power management module does not need to filter system tasks, but only needs to filter tasks in a blocked state (including system tasks and ordinary tasks), which can accelerate the task freezing process. Other processes for freezing tasks are similar to the processes for freezing tasks described in the embodiments of the present application, and will not be repeated here.
[0312] Exemplarily, ordinary tasks and system tasks are two types of tasks, which can be distinguished and identified by task identifiers.
[0313] Exemplarily, after receiving the freeze signal, the ordinary task can optionally mark the ordinary task as a frozen state. After the ordinary task receives the freeze signal, or after the ordinary task has the mark of the freeze state, when the ordinary task is not in a blocked state, the ordinary task can freeze itself. When freezing the ordinary task, the ordinary task can send a freeze instruction to the CPU, and the CPU executes the freeze instruction to freeze the ordinary task, so that the state of the ordinary task (e.g., running state) is updated to the frozen state.
[0314] Optionally, for example, when a common task receives a freeze signal, the common task is writing data. Then, after the common task completes the data writing operation, the common task sends a freeze instruction to the CPU to freeze the common task.
[0315] S202: The power management module traverses common tasks and checks the task status of the common tasks.
[0316] Illustratively, after S202 , the power management module may continue to traverse all common tasks in the system, and check the task status of the traversed common tasks.
[0317] S203, the power management module determines whether the task status is a blocked state.
[0318] Optionally, if the power management module detects that the task state is a blocked state, the power management module executes S204.
[0319] Optionally, S204, the power management module adds the common tasks in the blocked state to the blocked task linked list.
[0320] Exemplarily, a task in a blocked state indicates that the task is waiting to be run. If the task in a blocked state is not in a running state, in order to shorten the duration of freezing the task, the system of the present application does not need to freeze ordinary tasks in a blocked state.
[0321] Optionally, the power management module may also filter common tasks in a blocked state without storing them in a data structure (eg, the blocked task linked list).
[0322] Exemplarily, the power management module may be implemented with a task freezing filter, and the power management module may filter the tasks in a blocked state among the common tasks through the task freezing filter to accelerate the task freezing process. Optionally, the power management module may add the filtered tasks in a blocked state to a blocked task linked list (a linked list).
[0323] For example, there may be a large number of tasks in a blocked state in the system, so that the number of tasks in a blocked state accounts for a relatively large proportion. Considering that tasks in a blocked state do not participate in task scheduling, the system of the present application can filter the tasks in a blocked state without determining whether the tasks in a blocked state are in a frozen state, and does not need to freeze the tasks in a blocked state, thereby greatly improving the overall efficiency of freezing tasks and accelerating the process of freezing tasks.
[0324] Optionally, the power management module may send a freeze signal to all ordinary tasks, so that tasks in a blocked state among ordinary tasks may also receive the freeze signal. If the state of the task in the blocked state is switched to a non-blocking state before the step of entering the sleep state of non-core devices (such as peripherals), since the task has received the freeze signal, the task may first process the freeze signal to make the task enter the frozen state, thereby avoiding the situation where the task in the blocked state is not frozen after switching to the non-blocking state, thereby affecting the system sleep state.
[0325] Optionally, to prevent tasks in a blocked state (e.g., tasks added to a blocked task list), before the system hibernates non-core devices (e.g., enters Figure 3a Before S504 of S505) is switched to a non-blocking state (e.g., awakened), thereby causing the originally blocked task to be executed. In the embodiment of the present application, before the slave core CPU is offline, the core processing module will not migrate the timer (timer) on the slave core CPU and the tasks on the slave core CPU to other online CPUs.
[0326] In this way, the tasks in the blocked task list running on the slave core CPU will not be migrated to the running CPU. Then after the slave core CPU goes offline, the tasks in the blocked task list on the slave core CPU will not be executed even if they are updated from a blocked state to a non-blocked state, thereby ensuring that before the non-core device is dormant, the state of the tasks in the blocked task list, even if updated to a non-blocked state, will be frozen according to the received freeze signal and cannot run. Exemplary, for example, the task of the timer on the slave core CPU is in a blocked state and is added to the blocked task list. After the timer ends, the task corresponding to the timer can send an interrupt to the slave core CPU. However, since the slave core CPU has gone offline, the task corresponding to the timer has not been migrated to other running CPUs, so that after the system enters the kernel, it will no longer receive interrupts initiated by the tasks of the slave core CPU that have gone offline, and thus will not execute the tasks awakened after blocking, thereby ensuring the correctness of the blocked tasks not being frozen.
[0327] Optionally, before executing the step of taking the slave core CPU offline, for example, before executing Figure 3a Before S505 in the process, the power management module can check the task status of the tasks in the blocked task list to determine whether there are any tasks in the blocked task list that are in the running state. For example, before the task in the blocked task list is offline from the core CPU, the task is awakened and switched from the blocked state to the running state. Although the task in the blocked state has received the freeze signal in advance, the task in the blocked state is still running, resulting in the existence of tasks in the blocked task list that fail to freeze after awakening. If the current sleep process fails, the system sleep process can be re-executed (for example, return to Figure 3a In S501, the power management module re-processes the received system sleep request and the subsequent steps). On the contrary, if there is no task in the blocking task list that is in the running state, it means that the system can be frozen, so as to continue to execute Figure 3a In actual applications, it is rare that there are tasks in the blocked task list that fail to freeze after wakeup. This embodiment can be used as a solution for exception handling and ensuring system sleep reliability.
[0328] In addition, it should be noted that in this application Figure 5aIn the embodiment, the power management module first traverses the ordinary tasks and sends a freeze signal to the ordinary tasks, and then the power management module filters the tasks in the blocked state in the ordinary tasks (here, adding them to the linked list). In other embodiments, the power management module may also first filter the tasks in the blocked state for the ordinary tasks, and add the tasks in the blocked state to the linked list. Then, the power management module can traverse the ordinary tasks (including the tasks in the blocked task linked list) and send a freeze signal. The present application does not limit the execution order between the step of filtering the tasks in the blocked state and the step of sending a freeze signal to the ordinary tasks.
[0329] After S203 , if the power management module detects that the task state is not a blocked state, the power management module may execute S205 .
[0330] S205: The power management module determines whether the task state of the task that is not in the blocked state is in the frozen state.
[0331] Exemplarily, the power management module may determine whether a common task in a non-blocking state (for example, the task state is not a blocking state) has been frozen.
[0332] After S205, the power management module detects a task that is not in a blocked state (eg, the task state is not a blocked state), and the task state of the task is a frozen state, then the process goes to S202, and the power management module continues to traverse the task state of the next common task.
[0333] Exemplarily, when the power management module detects that an ordinary task in a non-blocking state has been frozen (i.e., the task state is a frozen state), the power management module may continue to traverse the task state of the next ordinary task to filter the traversed tasks in a blocked state, or determine whether the traversed tasks in a non-blocking state are in a frozen state.
[0334] After S205 , the power management module detects a task that is not in a blocked state and the task state of the task is not a frozen state, and the power management module executes S206 .
[0335] S206: The power management module adds the common task to the unfrozen task list.
[0336] Exemplarily, the common task traversed by the power management module is neither in a blocked state nor in a frozen state, which means that after a freeze signal is sent to the common task in S201, the common task has not processed the freeze signal to freeze the task.
[0337] For example, if the common task is executing a data write operation when receiving the freeze signal, the common task is still in the running state before the data write operation is completed. Alternatively, the CPU is in a busy state, so that the CPU does not execute the freeze instruction sent to the CPU by the common task that has received the freeze signal.
[0338] Then the power management module can add the common task which is not in the blocked state and not in the frozen state to the unfrozen task linked list (a linked list).
[0339] Exemplarily, the unfrozen task list is different from the blocked task list. Exemplarily, the unfrozen task list can be used to cache ordinary tasks that are not in a frozen state and not in a blocked state. Exemplarily, the blocked task list can be used to cache ordinary tasks that are in a blocked state.
[0340] Exemplarily, in the power management module, Figure 5a The process ends when the power management module traverses the task status of the common task (for example Figure 5a After the traversal process of S202 in Figure 5b As shown, the implementation process of the fast freezing task mechanism by the power management module may further include the following steps:
[0341] S301, the power management module loops through the unfrozen task list and checks the task status.
[0342] Exemplarily, the power management module may traverse the unfrozen task list in a loop and check the task status within a preset time period, thereby preventing the tasks in the unfrozen task list from being unfrozen for a long time and affecting the system sleep speed.
[0343] S302: The power management module determines whether the task state is a frozen state.
[0344] After S302, the power management module detects that the task state is frozen, and then switches to executing S303.
[0345] S303: The power management module deletes the task in the frozen state from the unfrozen task linked list.
[0346] After S303, if the unfrozen task list is not empty, the power management module continues to execute S301, so that the power management module continues to traverse the next task in the unfrozen task list until the unfrozen task list is empty, and the process ends.
[0347] If there are still tasks in the unfrozen task list, S301 may be executed cyclically until the unfrozen task list is empty, that is, all common tasks in the non-blocking state have been frozen and are in the frozen state.
[0348] In an embodiment of the present application, the power management module can add the traversed non-blocking and unfrozen ordinary tasks to the unfrozen task list. After the power management module traverses the task status of all ordinary tasks once, the power management module can cyclically traverse the task status of the tasks in the unfrozen task list until all the non-blocking tasks in the unfrozen task list are frozen. Among them, when the power management module cyclically traverses the unfrozen task list, when the task in the unfrozen task list traversed is in a frozen state, the power management module can delete the task from the unfrozen task list. When the power management module cyclically traverses the unfrozen task list, the unfrozen task list becomes shorter and shorter, which can avoid redundant checks on the task status of a large number of frozen tasks. When the power management module checks whether the status of the task is in a frozen state, the efficiency of the traversal check process is greatly improved, which can accelerate the task freezing efficiency.
[0349] Optionally, after S302, if the power management module detects that the task state is not a frozen state, the process goes to S304.
[0350] Optionally, in S304, the power management module waits for a preset time period.
[0351] After S304, the power management module switches to executing S301, so that the power management module continues to traverse the next task in the unfrozen task list until the unfrozen task list is empty, and the process ends.
[0352] Exemplarily, when the power management module traverses the unfrozen task list, if it detects that the task in the unfrozen task list is not in a frozen state, the power management module may wait for a preset time (e.g., 10 milliseconds) to execute S301 after the preset delay. Then, during the preset delay time of the power management module, the CPU that executes the instructions of the power management module may be idle, so that the CPU can execute the freeze instruction of the task in the unfrozen task list to freeze the task.
[0353] It should be noted that the preset duration can be flexibly configured according to the application scenario and is not limited to the 10 milliseconds used in the example.
[0354] Exemplarily, the unit of the preset time length may be milliseconds.
[0355] It is understandable that S304 is mainly for ensuring the reliability of system hibernation. In actual application scenarios, after S302, S303 can be executed, and S304 is rarely performed.
[0356] Under the microkernel architecture, the system of the present application can filter system tasks (including system service tasks in user mode and system tasks in kernel mode) when performing the system hibernation process, and only freeze the common tasks in user mode. Exemplarily, the number of driver-related system tasks is relatively large, about 200. By filtering the system tasks and freezing only the common tasks, the number of frozen tasks can be greatly reduced. In addition, some system tasks serve common tasks, so after the common tasks are frozen, these system tasks can no longer run, so that some system tasks are not scheduled. Then, when freezing tasks, by filtering the system tasks, the freezing operation of tasks that have not been scheduled can be reduced, and unnecessary task freezing operations can be reduced. In addition, another part of the system tasks is used to perform subsequent operations of system hibernation, such as hibernation devices, offline CPUs, etc., so these system tasks do not need to be frozen. Therefore, under the microkernel architecture, when the system is dormant, the slave core CPU can be offline, so the tasks on the slave core CPU will stop executing, so that only the system tasks running on the main core CPU (for example, for offline slave core CPUs) are left. Then, when the execution phase of the system sleep process enters the kernel state, the system tasks on the slave CPU will no longer be scheduled. The system of the present application does not need to freeze the system tasks, but only needs to freeze ordinary tasks, which can reduce the number of frozen tasks.
[0357] In one possible implementation, the system of the present application may adopt the highest priority guarantee of the stop machine mechanism, which can avoid stability issues (such as deadlock, etc.) in the execution of remaining tasks (such as driver-related system tasks) in the system after the core CPU goes offline.
[0358] S504: The power management module puts the external device into sleep mode via the device driver module.
[0359] For example, Figure 6a The implementation process of the runtime sleep wake-up mechanism implemented by the power management module is shown as an example. The power management module can be combined with Figure 6a The runtime sleep wake-up mechanism implemented by Figure 6b The process of putting the external device to sleep is shown to implement S504.
[0360] Exemplarily, the device driver module may include Figure 2a The peripheral modules shown are used to sleep or wake up external devices.
[0361] For example, Figure 6a As shown, the implementation process of the power management module for the runtime sleep wake-up mechanism may include:
[0362] S401, when the system is running, the power management module detects whether the external device is in operation.
[0363] For example, S401 may be executed when the power management module needs to periodically traverse the external device. Alternatively, S401 may be executed when the power management module needs to detect the status of the external device. This avoids adding a step of periodically or regularly detecting the operating status of the external device, thereby saving signaling overhead.
[0364] Exemplarily, the power management module can generate two linked lists after booting up. Linked list 1 is a dormant linked list, which is used to cache information of external devices in dormant state (this information is used to identify external devices, such as device identification). Linked list 2 is an awakened linked list, which is used to cache information of external devices in running state (this information is used to identify external devices, such as device identification). After booting up, the initialized linked lists 1 and 2 are both empty linked lists.
[0365] In addition, since there are sequential dependency requirements for devices when the devices are put to sleep or awakened, the sequential dependency between the external devices needs to be recorded in the power management module.
[0366] Exemplarily, the power management module may record the sequential dependency relationship between each external device in linked list 1 and linked list 2 respectively, for example, using device serial numbers to represent the sequential dependency relationship between devices.
[0367] For example, if the operation of device A depends on device B, when the system is in sleep mode, device A is put into sleep mode first, and then device B is put into sleep mode. Then in the sleep list, the device serial number of device A is 1, and the device serial number of device B is 2, where the device identifier of device A is A, and the device identifier of device B is B.
[0368] For example, if the operation of device A depends on device B, when the system wakes up, device B is woken up first, and then device A is put to sleep. Then in the woken-up list, the device serial number of device B is 1, and the device serial number of device A is 2, where the device identifier of device A is A, and the device identifier of device B is B.
[0369] Exemplarily, when the identification information of each dormant external device is stored in the linked list 1, the device may be sorted and stored according to the device serial number.
[0370] Exemplarily, when the identification information of each awakened external device is stored in the linked list 2, the device may be sorted and stored according to the device serial number.
[0371] In a possible implementation, when the power management module detects that the external device is in operation, S402 may be executed.
[0372] Optionally, S402, the power management module calls a wake-up callback function of the external device.
[0373] Optionally, S403, the power management module detects whether the dormant linked list includes identification information of the external device.
[0374] After S403, if the power management module detects that the dormant linked list does not include the identification information of the external device, the process goes to S405.
[0375] S405: The power management module writes the identification information of the external device into the awakened linked list.
[0376] After S403, if the power management module detects that the dormant linked list includes the identification information of the external device, the process goes to S404.
[0377] S404: The power management module transfers the identification information of the external device from the sleep linked list to the wake-up linked list.
[0378] In this embodiment, when the system is running, if the power management module detects that any external device is in a running state, the callback function for waking up the external device in the peripheral module can be called to wake up the external device. In addition, the power management module can also record the identification information of the external device into the awakened linked list. Exemplarily, when the identification information of the external device is not recorded in the sleep linked list, the identification information of the external device can be written into the awakened linked list. Exemplarily, when the identification information of the external device is recorded in the sleep linked list, the identification information of the external device can be transferred from the sleep linked list to the awakened linked list. In addition, the power management module can sort the position of the external device in the awakened linked list according to the device serial number of each external device, so as to perform peripheral sleep according to the sequential dependency relationship of each external device based on the position of each external device in the awakened linked list.
[0379] In a possible implementation, when the power management module detects that the external device is not in operation, S406 may be executed.
[0380] Optionally, S406, the power management module calls a callback function for the external device to sleep.
[0381] Optionally, S407, the power management module detects whether the wake-up list includes the identification information of the external device.
[0382] After S407, if the power management module detects that the awakened linked list does not include the identification information of the external device, the process goes to S409.
[0383] S409: The power management module writes the identification information of the external device into the dormant linked list.
[0384] After S407, if the power management module detects that the wake-up list includes the identification information of the external device, the process goes to S408.
[0385] S408: The power management module transfers the identification information of the external device from the awakened linked list to the dormant linked list.
[0386] In this embodiment, when the system is running, if the power management module detects that any external device is not in operation, the callback function for dormancy of the external device in the peripheral module may be called to put the external device into sleep mode. In addition, the power management module may also record the identification information of the external device into the sleep linked list. Exemplarily, when the identification information of the external device is not recorded in the awakened linked list, the identification information of the external device may be written into the sleep linked list. Exemplarily, when the identification information of the external device is recorded in the awakened linked list, the identification information of the external device may be transferred from the awakened linked list to the sleep linked list. In addition, the power management module may sort the positions of the external devices in the sleep linked list according to the device serial numbers of each external device, so as to wake up the external devices according to the sequential dependency of each external device based on the position of each external device in the sleep linked list.
[0387] Exemplarily, when the power management module receives a system sleep request and executes to the stage of sleeping peripherals in the system sleep process, such as Figure 6b As shown, when the external device starts to sleep, the power management module can traverse the awakened list and, based on the dependency order between the external devices in the awakened list (i.e., the above-mentioned sequential dependency relationship), call the callback function for sleep of the external device in sequence to shut down the external device in running state and put the external device into sleep mode.
[0388] Optionally, the power management module calls the callback function for sleeping of the external device to put the external device into sleep mode. If the external device is in sleep mode, the device ID of the external device can be written into the sleep list, or the device ID of the external device can be transferred from the wake-up list to the sleep list, thereby ensuring the integrity of the data recorded in the sleep list or the wake-up list.
[0389] Because the sleep processing of some peripherals has been completed when the system is running before the step of sleeping peripherals in the process of entering the system sleep. Then, during the system sleep process, when sleeping peripherals, the power management module does not need to traverse the sleep peripherals and call the sleep callback function of the peripherals, but only needs to call the corresponding sleep callback function for the peripherals other than the sleep peripherals (such as the running peripherals), which can greatly reduce the number of calls to the sleep callback function of the peripherals, and there is no need to perform sleep operation on the sleep peripherals, thereby improving the speed of sleeping peripherals.
[0390] In another embodiment, the power management module can implement the runtime sleep wake-up mechanism in the same manner as Figure 6a There are some differences in the schemes.
[0391] In this embodiment, the power management module can initialize and generate a linked list 3 after the host is turned on. After the host is turned on, the power management module can store the identification information of all external devices connected to the host (or other information that can be used to identify the external devices), and in the linked list 3, the status information (sleep state or wake-up state) of each external device can be marked. Exemplarily, the device being in the sleep state can mean that the device is not in the running state (for example, the shutdown state). The device being in the wake-up state can mean that the device is in the running state. This embodiment is different from Figure 6a The main difference between the embodiments is that the present embodiment can achieve the same effect of two linked lists (such as the above-mentioned dormant linked list and awakened linked list) by maintaining all external plug-in devices in a linked list and marking whether the external plug-in devices in the linked list are in running state, that is, when the system is running, the dormant or awakened state of the external plug-in devices is recorded, so that when entering the system dormant or awakening process, the external plug-in devices other than the dormant external devices (such as the external plug-in devices in running state) can be traversed and put into sleep to reduce the number of external plug-in devices to be dormant, or the external plug-in devices other than the awakened external devices (such as the external plug-in devices in closed state) can be traversed and awakened to reduce the number of external plug-in devices to be awakened, thereby shortening the time for dormant or awakening external plug-in devices.
[0392] Optionally, when entering the system sleep or wake-up process, after the peripheral device is put into sleep or wake-up, the state (sleep state or wake-up state) of the peripheral device may be updated to the linked list 3.
[0393] In addition, since there is a sequential dependency requirement for the devices when they are in sleep or wake-up mode, it is necessary to record the sequential dependency between the external devices in the power management module. The specific implementation principle can be described in detail in the following sections. Figure 6a The embodiments are similar and will not be described again here.
[0394] Exemplarily, the power management module may generate a linked list 3 when the operating system is started and when the device is initialized, including the identifiers of all external devices sorted by device serial numbers. Optionally, when the device is initialized, the power management module may mark the state of the external device in linked list 3 as a wake-up state based on the external device that has been started, and mark the state of the external device in linked list 3 as a sleep state for the unstarted external device.
[0395] When the system is running, the power management module can check whether the external device is in operation. Exemplarily, the power management module can perform the above-mentioned checking step when the power management module needs to periodically traverse the external device. Alternatively, the power management module can perform the above-mentioned checking step when the power management module needs to detect the status of the external device. This avoids adding a step of periodically or regularly detecting the operating status of the external device, thereby saving signaling overhead.
[0396] After the power management module detects that the state of the external device is in the running state or not in the running state, it can determine whether to update the state of the corresponding external device in the linked list 3 according to the detection result of the state of the external device.
[0397] For example, device 1 (a peripheral device) is marked as a dormant state in linked list 3. When the system is running, the power management module detects that device 1 is in a running state, and the power management module can update the state of device 1 in linked list 3 from the dormant state to the awake state (or running state). Optionally, the power management module can call a wake-up callback function for the driver of device 1 to wake up device 1.
[0398] For another example, device 1 is marked as awake in linked list 3. When the system is running, the power management module detects that device 1 is in running state. Then, the power management module does not need to update the state of device 1 in linked list 3.
[0399] For another example, if device 1 is marked as awake in linked list 3, and the power management module detects that device 1 is in an off state when the system is running, the power management module may update the state of device 1 in linked list 3 from awake to sleep. Optionally, the power management module may call a callback function for sleep on the driver of device 1 to put device 1 into sleep.
[0400] Then in this embodiment, exemplarily, when the power management module receives a system sleep request and executes to the stage of sleeping peripherals in the system sleep process, when starting to sleep the external device, the power management module can traverse the above-mentioned linked list 3 to determine at least one external device in the awake state. And based on the order dependency relationship corresponding to at least one external device, the callback function for sleep of at least one external device is called in sequence to shut down the external device in the running state to sleep the peripheral. Because before the step of sleeping peripherals in the system sleep process, the sleep processing process of some peripherals has been completed when the system is running. Then in the system sleep process, when sleeping peripherals, the power management module does not need to traverse the external devices that have been in sleep and call the callback function for sleep of the external device, but only needs to call the corresponding callback function for sleep for the external device in the running state, which can greatly reduce the number of calls to the callback function for sleep of the peripheral, and there is no need to perform sleep operation on the peripheral that has been in sleep, so as to improve the speed of sleeping peripherals.
[0401] Continue to refer to Figure 3a , after S504, S505, the power management module takes the slave core CPU offline through the core processing module.
[0402] Exemplarily, the implementation principle of S505 is similar to step 15 in the above-mentioned embodiment 1, and will not be repeated here.
[0403] In this embodiment, when the system is in hibernation, the slave core CPU can be taken offline. During the process of taking the slave core CPU offline, timer and task migration are not performed, and the stop machine mechanism is used to ensure the highest priority to avoid the problem of unstable system task execution after the slave core CPU is taken offline.
[0404] Continue to refer to Figure 3a ,After S505, S506, the kernel processing module puts the core device into sleep mode, and then, takes the main core CPU offline.
[0405] Exemplarily, the implementation principle of S506 is similar to step 16 and step 17 in the above-mentioned embodiment 1, and will not be repeated here.
[0406] After S506 , the interrupt is suspended.
[0407] Exemplarily, at this time, the execution phase of the system enters the kernel state, and the peripheral interrupt will not be triggered.
[0408] After S506, in S507, the kernel processing module notifies ATF (Arm Trusted Firmware) to hibernate the system.
[0409] Exemplarily, after the core device and the main core CPU are offline, the kernel processing module may notify the ATF system to enter a dormant state through a psci (power state coordination interface) interface.
[0410] The above process completes the system dormancy process of the instrument domain of the system of the present application.
[0411] The relevant steps in the above system hibernation process are similar to the corresponding steps in Example 1 in implementation principle. Therefore, in this embodiment, the same points are not described one by one. For specific details, please refer to Example 1 and Figure 2a , Figure 2b , Figure 2c Related description.
[0412] Figure 3b The figure is a schematic diagram showing an exemplary system wake-up process.
[0413] Figure 3b Taking the CDC of a motor vehicle as an application scenario, in this example, the CDC is divided into an instrument domain and an entertainment domain, where the instrument domain is a microkernel architecture (e.g. Figure 2a The system of the present application can run on an embedded platform.
[0414] like Figure 3b As shown, the system wake-up process may include the following steps:
[0415] S601: The power management module receives and processes a system wake-up request.
[0416] For example, the power management module can refer to Figure 4a The implementation process shown implements S601 through the CPU precise frequency increase mechanism.
[0417] For example, Figure 4a As shown, the implementation process of the CPU precise frequency increase mechanism by the power management module may include:
[0418] S101: A power management module receives a system wake-up request.
[0419] S102: The power management module determines whether the system wake-up request is a preset request.
[0420] For example, after the system of the CDC of the motor vehicle is dormant, the user presses the start engine button of the motor vehicle, and the power management module can receive a system wake-up request triggered by the user to wake up the operating system of the motor vehicle. The system wake-up request here is a preset wake-up request that is strongly related to the user experience.
[0421] For example, after the CDC system of a motor vehicle goes into sleep mode, the system periodically sends a heartbeat command to wake up the system to perform related operations. The heartbeat command here does not belong to the preset wake-up request that is strongly related to the user experience, because the user does not care about the speed of the wake-up process. Moreover, the wake-up process is imperceptible to the user.
[0422] Exemplarily, the system wake-up request may be in the form of an event, and the power management module may be configured with a second preset event representing the preset wake-up request. When the event triggering the system wake-up is the second preset event, the process may proceed to execute S103. When the event triggering the system wake-up is not the second preset event, the process may proceed to execute S104.
[0423] S103: When the power management module detects that the system wake-up request is a preset request, it can determine that the target frequency to be increased for the CPU is the highest operating frequency.
[0424] Exemplarily, the preset request may include a preset wake-up request.
[0425] For example, after the CDC system of a motor vehicle is in sleep mode, the user presses the engine start button of the motor vehicle and the user hopes that the motor vehicle system will run as soon as possible. Then the power management module can determine the CPU to be frequency-increased and the target frequency to which the CPU is to be frequency-increased, which is the maximum operating frequency of the CPU.
[0426] Exemplarily, the power management module may be configured with the maximum operating frequency of each single-core CPU or each group of CPUs (including multi-core CPUs).
[0427] S104: When the power management module detects that the system wake-up request is not a preset request, it can determine that the target frequency of the CPU to be increased is the operating frequency with the best energy efficiency ratio.
[0428] For example, after the CDC system of a motor vehicle is in sleep mode, the system periodically sends a heartbeat instruction for waking up the system to perform related operations, and the power management module may receive the heartbeat instruction. Figure 2c The interrupt subsystem sends a system wake-up request (heartbeat instruction here) to wake up the motor vehicle system. The power management module detects that the system wake-up request here does not belong to the preset wake-up request that is strongly related to the user experience, and can determine the CPU to be frequency-increased and the target frequency of the CPU to be frequency-increased to be the operating frequency with the best energy efficiency ratio of the CPU.
[0429] Exemplarily, the operating frequency of each CPU with the best energy efficiency ratio is strongly related to the CPU hardware. The operating frequency of each CPU with the best energy efficiency ratio can be determined based on the power consumption test data of the CPU of a specific chip platform at each operating frequency.
[0430] Continue to refer to Figure 3b, after S601, S602, the power management module notifies the kernel processing module to wake up the system.
[0431] After S602 , in S603 , the kernel processing module may notify ATF to wake up the system.
[0432] Exemplarily, the kernel processing module may notify the ATF system to enter the running state through the psci interface.
[0433] After S603, in S604, the kernel processing module goes online to the main core CPU, and then wakes up the core device.
[0434] Exemplarily, the implementation principle of S604 is similar to the implementation principle of step 22 and step 23 in the above-mentioned embodiment 2, and will not be repeated here.
[0435] After S604, in S605, the core processing module goes online to the slave core CPU.
[0436] Exemplarily, the implementation principle of S605 is similar to the implementation principle of step 24 in the above-mentioned embodiment 2, and will not be repeated here.
[0437] After S605 , in S606 , the power management module increases the frequency of the slave core CPU through the core processing module.
[0438] Exemplarily, the implementation principle of S606 is similar to the implementation principle of step 25 in the above-mentioned embodiment 2, and will not be repeated here.
[0439] After S606, in S607, the power management module wakes up the external device through the device driver module.
[0440] For example, Figure 6a The implementation process of the runtime sleep wake-up mechanism implemented by the power management module is shown as an example. The power management module can be combined with Figure 6a The runtime sleep wake-up mechanism implemented by Figure 6c The process of waking up the external device is shown to implement S607.
[0441] about Figure 6a For a description of the system sleep process, refer to Figure 6a The relevant description will not be repeated here.
[0442] Exemplarily, when the power management module receives a system wake-up request and executes to the stage of waking up the peripherals in the system wake-up process, such as Figure 6cAs shown, when starting to wake up the external device, the power management module can traverse the dormant linked list, and based on the dependency order between the external devices in the dormant linked list (i.e., the above-mentioned sequential dependency relationship), call the external device's callback function for waking up in sequence to start the external device in the closed state to wake up the peripheral. Because before entering the step of waking up the peripheral in the system wake-up process, the wake-up process of some peripherals has been completed when the system is running. Then in the system wake-up process, when waking up the peripheral, the power management module does not need to traverse the awakened external device and call the callback function for waking up the external device, but only needs to call the corresponding callback function for waking up the external device other than the awakened external device (for example, the external device in the closed state), which can greatly reduce the number of calls to the external device's callback function for waking up, and there is no need to traverse the awakened peripheral again to perform the wake-up operation, thereby improving the speed of waking up the peripheral.
[0443] Optionally, after the power management module wakes up the peripheral by calling the wake-up callback function of the external device, the peripheral is in the awakened state, and the device identification of the peripheral can be written into the awakened linked list, or the device identification of the peripheral can be transferred from the dormant linked list to the awakened linked list, thereby ensuring the integrity of the data recorded in the dormant linked list or the awakened linked list.
[0444] In another embodiment, the power management module can implement the runtime sleep wake-up mechanism in the same manner as Figure 6a There are some differences in the schemes.
[0445] In this implementation, the power management module can initialize and generate a linked list 3 after powering on. For specific implementation details of the implementation using linked list 3 as an example, reference can be made to the corresponding description during system hibernation, which will not be repeated here.
[0446] Then in this embodiment, exemplarily, when the power management module receives the system wake-up request and executes to the stage of waking up the peripheral device in the system wake-up process, when starting to wake up the external device, the power management module can traverse the above-mentioned example linked list 3 to determine at least one external device in a dormant state. And based on the order dependency relationship corresponding to at least one external device, the callback function for waking up the at least one external device is called in sequence to start the external device in the closed state to wake up the peripheral device. Because before entering the step of waking up the peripheral device in the system wake-up process, the wake-up processing process of some peripherals has been completed when the system is running. Then in the system wake-up process, when waking up the peripheral device, the power management module does not need to traverse the awakened external device and call the callback function for waking up the external device, but only needs to call the corresponding callback function for waking up the external device that is not in the running state, which can greatly reduce the number of calls to the callback function for waking up the peripheral device, and there is no need to perform a dormant operation on the awakened peripheral device, thereby improving the speed of waking up the peripheral device.
[0447] Continue back Figure 3b ,After S607, S608, the power management module unfreezes the common tasks through the kernel processing module.
[0448] Exemplarily, the power management module may send a thawing signal to a frozen common task. After receiving the thawing signal, the common task may send a thawing instruction to the core processing module to thaw the common task so that the frozen common task can continue to run and be in a running state.
[0449] Optionally, after S608, in S609, the power management module releases the frequency increase of the slave core CPU through the core processing module.
[0450] Exemplarily, the implementation details and principles of step S609 are similar to those of step 28 in Example 2, and are not described again here.
[0451] The above process completes the system wake-up process of the instrument domain of the system of the present application.
[0452] The relevant steps in the above system wake-up process are similar to the corresponding steps in Example 2 in implementation principle. Therefore, in this embodiment, the same points are not repeated one by one. For specific details, please refer to Example 2 and Figure 2a , Figure 2b , Figure 2c Related description.
[0453] It should be noted that the data structure used to store data in the embodiments of the present application is not limited to the linked lists exemplified in the above embodiments, but may also include but is not limited to: arrays, vectors, XML files, variables, key-value pairs, queues, stacks, trees, heaps, hash tables, etc.
[0454] It should be noted that, in the various embodiments of the present application, "going online" for an object can be used to indicate powering on the object, for example, going online a CPU indicates powering on the CPU. "Going offline" for an object can be used to indicate powering off the object, for example, powering off a CPU indicates powering off the CPU. Hibernation of a device can be used to indicate shutting down the device or powering off the device so that the device stops running. Wake-up of a device can be used to indicate starting the device or powering on the device so that the device runs.
[0455] In a possible implementation, the present application provides a system hibernation device. The system hibernation device includes: a filtering module, which is used to filter a first task in a blocked state in response to receiving a system hibernation request; a freezing module, which is used to freeze the filtered second task that is not in a blocked state; a hibernation device module, which is used to hibernate a first device of a first type based on device status information; wherein the device status information includes: a device status of at least one device of the first type, the device status being information used to indicate whether the device is in a running state; the first device is different from the second device, wherein the second device is a device that is not in a running state among the at least one device.
[0456] In a possible implementation, the system sleep device further includes: a first frequency increasing module, configured to increase the operating frequency of the CPU to a first frequency when it is detected that the system sleep request is a preset sleep request; wherein the first frequency is the maximum operating frequency of the CPU.
[0457] In a possible implementation, the system sleep device further includes: a second frequency increasing module, for increasing the operating frequency of the CPU to a second frequency when it is detected that the system sleep request is not a preset sleep request; wherein the second frequency is less than the first frequency, and wherein when the operating frequency of the CPU is the second frequency, the energy efficiency ratio of the CPU is the highest.
[0458] In a possible implementation, the filtering module is specifically configured to filter the first task in a blocked state among the second type of tasks; wherein the second type of tasks are tasks other than system tasks in the operating system.
[0459] In a possible implementation manner, the system hibernation device further includes: a signal sending module, configured to send a freeze signal to the second type of task, wherein the freeze signal is used to instruct the task to be frozen.
[0460] In a possible implementation, the system hibernation device further includes: a saving module, used to save the third task in the second task that is not in a frozen state to the first data structure; a traversal module, used to loop through the third task in the first data structure and detect the task status of the traversed third task; a deletion module, used to delete the third task in a frozen state from the first data structure when it is detected in the first data structure that the task status of the third task is the frozen state; the traversal module is also used to continue to loop through the first data structure when it is detected in the first data structure that the task status of the third task is not the frozen state until the first data structure is empty.
[0461] In one possible implementation, the CPU of the system is a multi-core CPU, and the multi-core CPU includes a master core CPU and at least one slave core CPU. The system hibernation device also includes: a reservation module, which is used to reserve the timers and tasks on the first slave core CPU without migrating them to the second CPU before powering off the first slave core CPU; wherein the second CPU is the second slave core CPU or the master core CPU; the at least one slave core CPU includes the first slave core CPU, or further includes the second slave core CPU.
[0462] In a possible implementation, the sleep device module is specifically configured to: filter the second device in the first type of devices based on the device status information to determine the first type of first device; and put the first device to sleep.
[0463] In a possible implementation, the system hibernation device further includes: a device status management module, used for: during the operation of the system, when it is detected that the third device of the first type is in an operating state, recording or updating the device status of the third device to a first state to generate or update the device status information; wherein the first state is information used to indicate that the third device is in an operating state; during the operation of the system, when it is detected that the fourth device of the first type is not in an operating state, recording or updating the device status of the fourth device to a second state to generate or update the device status information; wherein the second state is information used to indicate that the fourth device is not in an operating state; the device status is the first state or the second state; wherein the at least one device includes: the third device and / or the fourth device.
[0464] In a possible implementation manner, the device status management module is further configured to record or update the device status of the first device to the second status in the device status information.
[0465] The effects of the system hibernation devices of the above embodiments are similar to the effects of the system hibernation methods of the above embodiments, and will not be described in detail here.
[0466] In a possible implementation, the present application provides a system wake-up device. The system wake-up device includes: a wake-up device module, which is used to wake up a first device of a first type based on device status information in response to receiving a system wake-up request; wherein the device status information includes: a device status of at least one device of the first type, the device status being information used to indicate whether the device is in a running state; the first device is different from a second device, wherein the second device is a device in a running state among the at least one device; and a thawing module, which is used to thaw a first task in a frozen state; wherein the first task is not in a blocked state when frozen.
[0467] In a possible implementation, the system wake-up device further includes: a first frequency increasing module, which is used to increase the operating frequency of the CPU to a first frequency after the CPU comes online and when it is detected that the system wake-up request is a preset wake-up request; wherein the first frequency is the maximum operating frequency of the CPU.
[0468] In a possible implementation, the system wake-up device also includes: a second frequency increasing module, which is used to increase the operating frequency of the CPU to a second frequency after the CPU comes online and when it is detected that the system wake-up request is not a preset wake-up request; wherein the second frequency is less than the first frequency, and wherein when the operating frequency of the CPU is the second frequency, the energy efficiency ratio of the CPU is the highest.
[0469] In a possible implementation, the system wake-up device further includes: a frequency increase release module, configured to restore the frequency modulation strategy of the CPU to the original frequency modulation strategy; wherein the original frequency modulation strategy is the frequency modulation strategy of the CPU before receiving the system wake-up request.
[0470] In a possible implementation manner, the first task is a task that is not in a blocked state among tasks of the second type, wherein the second type of tasks are tasks other than system tasks in the operating system.
[0471] In a possible implementation manner, the device waking-up module is specifically configured to: filter the second device in the first type of devices based on the device status information to determine the first type of first device; and wake up the first device.
[0472] In a possible implementation, the system wake-up device also includes: a device status management module, used to: during the operation of the system, when it is detected that the third device of the first type is in an operating state, record or update the device status of the third device to a first state to generate or update the device status information; wherein the first state is information used to indicate that the third device is in an operating state; during the operation of the system, when it is detected that the fourth device of the first type is not in an operating state, record or update the device status of the fourth device to a second state to generate or update the device status information; wherein the second state is information used to indicate that the fourth device is not in an operating state; the device status is the first state or the second state; wherein the at least one device includes: the third device and / or the fourth device.
[0473] In a possible implementation manner, the device status management module is further configured to record or update the device status of the first device to the first status in the device status information.
[0474] The effects of the system awakening devices of the above embodiments are similar to the effects of the system awakening methods of the above embodiments, and will not be described in detail here.
[0475] In one possible implementation, Figure 7a This is a schematic diagram of the structure of a system dormancy device provided in an embodiment of the present application. Figure 7a As shown, the system hibernation device 500 may include: a processor 501 , a transceiver 505 , and optionally a memory 502 .
[0476] The transceiver 505 may be referred to as a transceiver unit, a transceiver, or a transceiver circuit, etc., and may be used to implement a transceiver function. The transceiver 505 may include a receiver and a transmitter, wherein the receiver may be referred to as a receiver or a receiving circuit, etc., and may be used to implement a receiving function; and the transmitter may be referred to as a transmitter or a transmitting circuit, etc., and may be used to implement a transmitting function.
[0477] The memory 502 may store a computer program or software code or instruction 504, which may also be referred to as firmware. The processor 501 may control the MAC layer and the PHY layer by running the computer program or software code or instruction 503 therein, or by calling the computer program or software code or instruction 504 stored in the memory 502, so as to implement the system sleep method provided in each embodiment of the present application. The processor 501 may be a central processing unit (CPU), and the memory 502 may be, for example, a read-only memory (ROM) or a random access memory (RAM).
[0478] The processor 501 and transceiver 505 described in the present application can be implemented on an integrated circuit (IC), an analog IC, a radio frequency integrated circuit RFIC, a mixed signal IC, an application specific integrated circuit (ASIC), a printed circuit board (PCB), an electronic device, etc.
[0479] The system sleep device 500 may further include an antenna 506. The modules included in the system sleep device 500 are only examples, and the present application does not limit this.
[0480] In another possible implementation, Figure 7b This is a schematic diagram of the structure of a system wake-up device provided in an embodiment of the present application. Figure 7b As shown, the system wake-up device 500 may include: a processor 501 , a transceiver 505 , and optionally a memory 502 .
[0481] The transceiver 505 may be referred to as a transceiver unit, a transceiver, or a transceiver circuit, etc., and may be used to implement a transceiver function. The transceiver 505 may include a receiver and a transmitter, wherein the receiver may be referred to as a receiver or a receiving circuit, etc., and may be used to implement a receiving function; and the transmitter may be referred to as a transmitter or a transmitting circuit, etc., and may be used to implement a transmitting function.
[0482] The memory 502 may store a computer program or software code or instruction 504, which may also be referred to as firmware. The processor 501 may control the MAC layer and the PHY layer by running the computer program or software code or instruction 503 therein, or by calling the computer program or software code or instruction 504 stored in the memory 502, so as to implement the system wake-up method provided in each embodiment of the present application. The processor 501 may be a central processing unit (CPU), and the memory 502 may be, for example, a read-only memory (ROM) or a random access memory (RAM).
[0483] The processor 501 and transceiver 505 described in the present application can be implemented on an integrated circuit (IC), an analog IC, a radio frequency integrated circuit RFIC, a mixed signal IC, an application specific integrated circuit (ASIC), a printed circuit board (PCB), an electronic device, etc.
[0484] The system awakening device 500 may further include an antenna 506. The modules included in the system awakening device 500 are only examples, and the present application does not limit this.
[0485] The structure of the system sleep device can be unaffected by Figure 7a The structure of the system wake-up device can be free from restrictions. Figure 7b The system sleep device and the system wake-up device may be independent devices or may be part of a larger device. For example, the system sleep device or the system wake-up device may be implemented in the following forms:
[0486] (1) An independent integrated circuit IC, or chip, or chip system or subsystem; (2) A collection of one or more ICs, optionally, the IC collection may also include a storage component for storing data and instructions; (3) A module that can be embedded in other devices; (4) In-vehicle equipment, etc.; (5) Others, etc.
[0487] For the case where the system sleep device or the system wake-up device is implemented in the form of a chip or a chip system, see Figure 8 Schematic diagram of the chip structure shown. Figure 8The chip shown includes a processor 601 and an interface 602 . The number of the processor 601 may be one or more, and the number of the interface 602 may be multiple. Optionally, the chip or chip system may include a memory 603 .
[0488] Among them, all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module, and will not be repeated here.
[0489] Based on the same technical concept, an embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. The computer program includes at least one section of code, and the at least one section of code can be executed by a computer to control the computer to implement the above-mentioned system sleep method or system wake-up method embodiment.
[0490] Based on the same technical concept, an embodiment of the present application also provides a computer program, which, when executed by a terminal device, is used to implement the above-mentioned system sleep method or system wake-up method embodiment.
[0491] The program may be stored in whole or in part on a storage medium packaged together with the processor, or may be stored in whole or in part on a memory not packaged together with the processor.
[0492] Based on the same technical concept, the embodiment of the present application further provides a chip, including a network port controller and a processor. The network port controller and the processor can implement the above-mentioned system sleep method or system wake-up method embodiment.
[0493] The steps of the method or algorithm described in conjunction with the disclosure of the embodiments of the present application can be implemented in a hardware manner, or can be implemented by a processor executing a software instruction. The software instruction can be composed of corresponding software modules, and the software module can be stored in a random access memory (Random Access Memory, RAM), a flash memory, a read-only memory (Read Only Memory, ROM), an erasable programmable read-only memory (Erasable Programmable ROM, EPROM), an electrically erasable programmable read-only memory (Electrically EPROM, EEPROM), a register, a hard disk, a mobile hard disk, a CD-ROM (CD-ROM) or any other form of storage medium known in the art. An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and can write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC.
[0494] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented with hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein the communication media include any media that facilitates the transmission of a computer program from one place to another. The storage medium can be any available medium that a general or special-purpose computer can access.
[0495] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A system hibernation method, characterized in that: The method comprises: In response to receiving a system sleep request, filtering a first task in a blocked state; Freeze the filtered second tasks that are not in a blocked state; Putting a first device of a first type into hibernation based on the device status information; The device status information includes: a device status of at least one device of the first type, wherein the device status is information indicating whether the device is in an operating state; The first device is different from the second device, wherein the second device is a device that is not in operation among the at least one device; After filtering the first task in a blocked state and before putting the first device of the first type into hibernation based on the device state information, the method further includes: Saving the third tasks in the second tasks that are not in a frozen state to the first data structure; Looping through the third task in the first data structure, and detecting the task status of the traversed third task; When it is detected in the first data structure that the task state of the third task is the frozen state, deleting the third task in the frozen state from the first data structure; When it is detected in the first data structure that the task state of the third task is not the frozen state, the first data structure is continuously looped through until the first data structure is empty.
2. The method according to claim 1, characterized in that Before filtering the first task in a blocked state, the method further includes: When it is detected that the system sleep request is a preset sleep request, increasing the operating frequency of the CPU to a first frequency; The first frequency is the maximum operating frequency of the CPU.
3. The method according to claim 2, characterized in that Before filtering the first task in a blocked state, the method further includes: When it is detected that the system sleep request is not a preset sleep request, increasing the operating frequency of the CPU to a second frequency; The second frequency is lower than the first frequency, and when the operating frequency of the CPU is the second frequency, the energy efficiency ratio of the CPU is the highest.
4. The method according to any one of claims 1 to 3, characterized in that The filtering of the first task in a blocked state comprises: Among the tasks of the second type, filtering the first tasks that are in a blocked state; The second type of tasks are tasks other than system tasks in the operating system.
5. The method according to any one of claims 1 to 3, characterized in that: The step of putting a first device of a first type into hibernation based on the device status information includes: filtering the second device in the first type of devices based on the device status information to determine the first type of first device; The first device is put into sleep mode.
6. A system wake-up method, characterized in that: The method comprises: In response to receiving the system wake-up request, waking up a first device of the first type based on the device status information; The device status information includes: a device status of at least one device of the first type, wherein the device status is information indicating whether the device is in an operating state; The first device is different from the second device, wherein the second device is a device in operation among the at least one device; Unfreeze the first task in a frozen state; wherein the first task is not in a blocked state when frozen; The first task in the frozen state is obtained by following the steps: Saving the second task that is not in a frozen state among the first tasks to a first data structure; Loop through the second tasks in the first data structure, and detect task states of the traversed second tasks; When it is detected in the first data structure that the task state of the second task is the frozen state, deleting the second task in the frozen state from the first data structure; When it is detected in the first data structure that the task state of the second task is not the frozen state, the first data structure is continuously looped through until the first data structure is empty.
7. The method according to claim 6, characterized in that Before waking up the first device of the first type based on the device status information, the method further includes: After the CPU comes online, when it is detected that the system wake-up request is a preset wake-up request, increasing the operating frequency of the CPU to a first frequency; The first frequency is the maximum operating frequency of the CPU.
8. The method according to claim 7, characterized in that Before waking up the first device of the first type based on the device status information, the method further includes: After the CPU comes online, when it is detected that the system wake-up request is not a preset wake-up request, increasing the operating frequency of the CPU to a second frequency; The second frequency is lower than the first frequency, and when the operating frequency of the CPU is the second frequency, the energy efficiency ratio of the CPU is the highest.
9. The method according to any one of claims 6 to 8, characterized in that The first task is a task that is not in a blocked state among the tasks of the second type, wherein the tasks of the second type are tasks other than system tasks in the operating system.
10. The method according to any one of claims 6 to 8, characterized in that The step of waking up a first device of the first type based on the device status information includes: filtering the second device in the first type of devices based on the device status information to determine the first type of first device; The first device is woken up.
11. A system hibernation device, characterized in that: A filtering module, configured to filter the first task in a blocked state in response to receiving a system sleep request; A freezing module, used for freezing the filtered second tasks that are not in a blocked state; A sleep device module, configured to put a first device of a first type into sleep mode based on the device status information; The device status information includes: a device status of at least one device of the first type, wherein the device status is information indicating whether the device is in an operating state; The first device is different from the second device, wherein the second device is a device that is not in operation among the at least one device; The freezing module is further used to save the third task in the second task that is not in a frozen state to the first data structure; Looping through the third task in the first data structure, and detecting the task status of the traversed third task; When it is detected in the first data structure that the task state of the third task is the frozen state, deleting the third task in the frozen state from the first data structure; When it is detected in the first data structure that the task state of the third task is not the frozen state, the first data structure is continuously looped through until the first data structure is empty.
12. The device according to claim 11, characterized in that The device also includes: A first frequency increasing module, configured to increase the operating frequency of the CPU to a first frequency when detecting that the system sleep request is a preset sleep request; The first frequency is the maximum operating frequency of the CPU.
13. The device according to claim 12, characterized in that The device also includes: A second frequency increasing module, configured to increase the operating frequency of the CPU to a second frequency when it is detected that the system sleep request is not a preset sleep request; The second frequency is lower than the first frequency, and when the operating frequency of the CPU is the second frequency, the energy efficiency ratio of the CPU is the highest.
14. The device according to any one of claims 11 to 13, characterized in that The filtering module is specifically used to filter the first task in a blocked state among the tasks of the second type; The second type of tasks are tasks other than system tasks in the operating system.
15. A system wake-up device, characterized in that: The device comprises: a device waking-up module, configured to wake up a first device of a first type based on device status information in response to receiving a system wake-up request; The device status information includes: a device status of at least one device of the first type, wherein the device status is information indicating whether the device is in an operating state; The first device is different from the second device, wherein the second device is a device in operation among the at least one device; A thawing module, used for thawing the first task in a frozen state; wherein the first task is not in a blocked state when frozen; The first task in the frozen state is obtained by following the steps: Saving the second task that is not in a frozen state among the first tasks to a first data structure; Loop through the second tasks in the first data structure, and detect task states of the traversed second tasks; When it is detected in the first data structure that the task state of the second task is the frozen state, deleting the second task in the frozen state from the first data structure; When it is detected in the first data structure that the task state of the second task is not the frozen state, the first data structure is continuously looped through until the first data structure is empty.
16. The device according to claim 15, characterized in that The device also includes: A first frequency increasing module is used for increasing the operating frequency of the CPU to a first frequency after the CPU comes online and when detecting that the system wake-up request is a preset wake-up request; The first frequency is the maximum operating frequency of the CPU.
17. The device according to claim 16, characterized in that The device also includes: A second frequency increasing module is used for increasing the operating frequency of the CPU to a second frequency after the CPU comes online and when it is detected that the system wake-up request is not a preset wake-up request; The second frequency is lower than the first frequency, and when the operating frequency of the CPU is the second frequency, the energy efficiency ratio of the CPU is the highest.
18. The device according to any one of claims 15 to 17, characterized in that The first task is a task that is not in a blocked state among the tasks of the second type, wherein the tasks of the second type are tasks other than system tasks in the operating system.
19. A computer-readable storage medium, characterized in that: The method comprises a computer program, which, when running on a computer or a processor, enables the computer or the processor to execute the method according to any one of claims 1 to 5 or claims 6 to 10.
20. A system hibernation device, characterized in that: It comprises one or more interface circuits and one or more processors; the interface circuit is used to receive a signal from a memory and send the signal to the processor, the signal comprising a computer instruction stored in the memory; when the processor executes the computer instruction, the processor is used to execute the method as claimed in any one of claims 1 to 5.
21. A system wake-up device, characterized in that: It comprises one or more interface circuits and one or more processors; the interface circuit is used to receive a signal from a memory and send the signal to the processor, the signal including a computer instruction stored in the memory; when the processor executes the computer instruction, the processor is used to execute the method as claimed in any one of claims 6 to 10.
22. A computer program product, characterized in that The computer program product comprises a software program, and when the software program is executed by a computer or a processor, the steps of the method described in any one of claims 1 to 5 or claims 6 to 10 are performed.
