WO2024046088A1 - 任务调度方法及相关设备 - Google Patents

任务调度方法及相关设备 Download PDF

Info

Publication number
WO2024046088A1
WO2024046088A1 PCT/CN2023/112509 CN2023112509W WO2024046088A1 WO 2024046088 A1 WO2024046088 A1 WO 2024046088A1 CN 2023112509 W CN2023112509 W CN 2023112509W WO 2024046088 A1 WO2024046088 A1 WO 2024046088A1
Authority
WO
WIPO (PCT)
Prior art keywords
task
cpu
electronic device
frequency
load
Prior art date
Application number
PCT/CN2023/112509
Other languages
English (en)
French (fr)
Inventor
徐宽
姚艳霞
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2024046088A1 publication Critical patent/WO2024046088A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/32Means for saving power
    • G06F1/3203Power management, i.e. event-based initiation of a power-saving mode
    • G06F1/3234Power saving characterised by the action undertaken
    • G06F1/329Power saving characterised by the action undertaken by task scheduling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/32Means for saving power
    • G06F1/3203Power management, i.e. event-based initiation of a power-saving mode
    • G06F1/3234Power saving characterised by the action undertaken
    • G06F1/3293Power saving characterised by the action undertaken by switching to a less power-consuming processor, e.g. sub-CPU
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the present application relates to the field of intelligent terminal technology, and in particular, to a task scheduling method and related equipment.
  • the first aspect of the embodiment of the present application provides a task scheduling method, which includes: when an application process generates a task, determine whether the task is a non-urgent task; if the task is a non-urgent task, obtain the central processing unit CPU of the electronic device frequency and load; determine the normalized frequency of the CPU based on the frequency and load of the CPU, and the normalized frequency is the frequency corresponding to the CPU load of 100%; determine whether the normalized frequency is less than or equal to the preset frequency; if the normalized frequency is less than or equal to the preset frequency, determine whether the electronic device is in a sleep state; if the electronic device is in a sleep state, adjust the frequency of the CPU so that The load of the CPU is a first preset value, consistent with the optimal energy efficiency ratio of the CPU, and the non-urgent task is executed.
  • determining whether a task is a non-urgent task includes: when an application process generates a task, determining whether the application process is a background application process; if the application process is a background application process, determining whether the task is a non-urgent task. .
  • determining whether the application process is a background application process includes: calling the activities of the application process through the ActivityLifecycleCallbacks program, determining whether the activities of the application process are running in the background, and if the activities of the application process are running in the background, determining whether the application process is running in the background.
  • the process is a background application process.
  • determining whether the application process is a background application process includes: calling the foreground application process through the UsageStatsManager program, and judging whether the called foreground application process contains the application process. If the called foreground application process does not Contains the application process, and determines that the application process is a background process. Using this technical solution, it is possible to accurately determine whether an application process is a background application process.
  • determining whether a task is a non-urgent task includes: when an application process generates a task, determining whether the application process is a background application process, and determining whether the task has expired; if the application process is a background application process, If the application process is running and the task has not expired, the task is determined to be a non-urgent task.
  • determining whether a task is a non-urgent task includes: when an application process generates a task, determining whether the application process is a background application process, and determining whether the task is a high-load task; if the application process is a background application process, Apply the process and the task is a high-load task, and determine that the task is a non-urgent task.
  • determining whether a task is a non-urgent task includes: when an application process generates a task, determining whether the application process is a background application process, and determining whether the task is a high-load task; if the application process is a background application process, Apply the process and the task is a high-load task, and determine that the task is a non-urgent task.
  • determining whether a task is a high-load task includes: obtaining the associated information of the task, and sending the associated information of the task to the kernel layer; querying the historical load information of the task through the kernel layer, and determining the historical load information of the task. Whether it is greater than or equal to the load threshold; if the historical load information of the task is greater than or equal to the load threshold, the task is determined to be a high-load task; or if the historical load information of the task is less than the load threshold, the task is determined not to be a high-load task.
  • this technical solution it is possible to accurately determine whether the tasks generated by the application process are high-load tasks.
  • obtaining the frequency and load of the central processing unit CPU of the electronic device includes: obtaining the current CPU small core frequency point and the overall load of the CPU small core through a resource scheduling service process of the electronic device. .
  • the frequency and load of the CPU small core can be accurately obtained, and the CPU power consumption when processing non-urgent tasks can be reduced.
  • the electronic device is preset with an energy efficiency ratio table of the CPU, and determining the normalized frequency of the CPU based on the frequency and load of the CPU includes: querying the energy efficiency ratio table Determine the performance score corresponding to the current frequency of the CPU; determine the performance score when the load is 100% based on the performance score corresponding to the current frequency and the current load; determine the performance score corresponding to the load 100% by querying the energy efficiency ratio table frequency to obtain the current normalized frequency of the CPU.
  • the normalized frequency of the CPU can be accurately determined.
  • the method further includes: determining whether the number of times the normalized frequency is continuously greater than the preset frequency is greater than or equal to the second preset value; if the number of times the normalized frequency is continuously greater than the preset frequency is greater than or equal to the second preset value; Or equal to the second preset value, the preset frequency is increased.
  • the preset frequency setting can be made more consistent with system requirements.
  • determining whether the electronic device is in the sleep state includes: determining whether the display screen is off; if the display screen is off, determining that the electronic device is in the sleep state; or if the display screen is on, determining that the electronic device is not in the sleep state. Sleep state. Using this technical solution, it is possible to accurately determine whether the electronic device is in a dormant state.
  • determining whether the electronic device is in a sleep state includes: determining whether the display screen is off and whether the electronic device is in a distributed scene; if the display screen is off and the electronic device is not in a distributed scene , confirm that the electronic device is in a dormant state; or if the display screen is on and/or the electronic device is in a distributed scene, confirm that the electronic device is not in a dormant state.
  • determining whether the electronic device is in a sleep state includes: determining whether the display screen is off and whether the electronic device is in a distributed scene; if the display screen is off and the electronic device is not in a distributed scene , confirm that the electronic device is in a dormant state; or if the display screen is on and/or the electronic device is in a distributed scene, confirm that the electronic device is not in a dormant state.
  • determining whether the electronic device is in a distributed scenario includes: determining whether the electronic device is in a collaborative working mode with at least one terminal device; if the electronic device is in a collaborative working mode with at least one terminal device, determining whether the electronic device is in a collaborative working mode with at least one terminal device. The device is in a distributed scenario; or if the electronic device is not in a collaborative working mode with at least one terminal device, it is determined that the electronic device is not in a distributed scenario. Using this technical solution, it is possible to accurately determine whether an electronic device is in a distributed scenario.
  • adjusting the frequency of the CPU so that the load of the CPU reaches the first preset value includes: writing the CPU frequency value to be adjusted to the kernel node to adjust the CPU frequency. frequency until the load of the CPU reaches the first preset value.
  • the method further includes: if the load of the CPU is adjusted to the first preset value, determining whether the energy efficiency ratio of the CPU is the optimal energy efficiency ratio. ; If the energy efficiency ratio of the CPU is the optimal energy efficiency ratio, execute the non-urgent task when the load of the CPU is the first preset value; or if the energy efficiency ratio of the CPU is not the optimal energy efficiency ratio, Continue to adjust the frequency of the CPU until the energy efficiency of the CPU ratio is the optimal energy efficiency ratio. Using this technical solution, non-urgent tasks can be processed under the optimal energy efficiency ratio of the CPU, thereby reducing system power consumption.
  • the method further includes: if the load of the CPU is adjusted to the first preset value, determine the energy efficiency ratio of the CPU and the optimal energy efficiency ratio. whether the difference between the energy efficiency ratio of the CPU and the optimal energy efficiency ratio is less than or equal to the third preset value, when the load of the CPU Execute the non-urgent task when it is the first preset value; or if the difference between the energy efficiency ratio of the CPU and the optimal energy efficiency ratio is greater than the third preset value, continue to adjust the CPU frequency until the difference between the energy efficiency ratio of the CPU and the optimal energy efficiency ratio is less than or equal to the third preset value.
  • non-urgent tasks can be processed when the CPU is close to the optimal energy efficiency ratio, thereby reducing system power consumption.
  • the method further includes: if the electronic device is in a sleep state, setting the non-urgent task as the first priority; or if the electronic device is not in a sleep state, setting the non-urgent task to Set to the second priority, the first priority is higher than the second priority.
  • non-urgent tasks can be prioritized.
  • the method further includes: if the electronic device is not in the sleep state, determining whether the system is in the promotion state; if the system is not in the promotion state, setting the non-urgent task to the second priority; If the system is in an elevated state, the non-urgent task is set to the third priority level, the first priority level is higher than the second priority level, and the second priority level is higher than the third priority level.
  • non-urgent tasks can be prioritized.
  • embodiments of the present application provide a computer-readable storage medium that includes computer instructions.
  • the computer instructions When the computer instructions are run on an electronic device, the electronic device causes the electronic device to execute the task scheduling method described in the first aspect.
  • inventions of the present application provide an electronic device.
  • the electronic device includes a processor and a memory.
  • the memory is used to store instructions, and the processor is used to call instructions in the memory, so that the electronic device performs task scheduling as described in the first aspect. method.
  • embodiments of the present application provide a computer program product.
  • the computer program product When the computer program product is run on a computer, it causes the computer to execute the task scheduling method as described in the first aspect.
  • a fifth aspect provides a device that has the function of realizing the behavior of the electronic device in the method provided in the first aspect.
  • Functions can be implemented by hardware, or by hardware executing corresponding software.
  • Hardware or software includes one or more modules corresponding to the above functions.
  • the computer-readable storage medium described in the second aspect, the electronic device described in the third aspect, the computer program product described in the fourth aspect, and the device described in the fifth aspect are all the same as the above-mentioned first aspect. Therefore, the beneficial effects that can be achieved can be referred to the beneficial effects in the corresponding methods provided above, and will not be described again here.
  • FIG. 1 is a schematic structural diagram of an electronic device provided by an embodiment of the present application.
  • FIG. 2 is a schematic diagram of the software structure of an electronic device provided by an embodiment of the present application.
  • FIG. 3A is a schematic diagram of an application scenario of a task scheduling method provided by an embodiment of the present application.
  • FIG. 3B is a schematic diagram of another application scenario of the task scheduling method provided by an embodiment of the present application.
  • FIG. 3C is a schematic diagram of another application scenario of the task scheduling method provided by an embodiment of the present application.
  • Figure 3D is a schematic diagram of another application scenario of the task scheduling method provided by an embodiment of the present application.
  • Figure 4 is a schematic flowchart of a task scheduling method provided by an embodiment of the present application.
  • FIG. 5 is a schematic flowchart of determining whether a task is a non-urgent task according to an embodiment of the present application.
  • FIG. 6 is a schematic flowchart of determining whether a task is a non-urgent task according to another embodiment of the present application.
  • FIG. 7 is a schematic flowchart of determining whether a task is a non-urgent task according to another embodiment of the present application.
  • FIG. 8 is a schematic diagram of a CPU energy efficiency ratio table provided by an embodiment of the present application.
  • Figure 9 is a schematic flowchart of a task scheduling method provided by another embodiment of the present application.
  • Figure 10 is a schematic flowchart of a task scheduling method provided by another embodiment of the present application.
  • Figure 11 is a schematic flowchart of a task scheduling method provided by another embodiment of the present application.
  • Figure 12 is a schematic diagram of an application scenario of a task scheduling method provided by an embodiment of the present application.
  • OS Operating System
  • Kernel Establishes a communication platform between computer software and hardware.
  • the kernel provides system services, such as file management, virtual memory, device input/output (Input/Output, I/O), etc.
  • Process It is a running activity of a program in a computer on a certain data set. It is the basic unit of resource allocation and scheduling in the system and the basis of the operating system structure.
  • the process is the basic execution entity of the program; in the contemporary thread-oriented computer structure, the process is the container of the thread.
  • a program is a description of instructions, data and their organization, and a process is the entity of the program.
  • a process can be regarded as an independent program, with its complete data space and code space in memory. The data and variables owned by a process belong only to itself.
  • Thread It is the smallest unit for performing operations in a process, that is, the basic unit for executing processor scheduling. If a process is understood as a task logically performed by the operating system, then a thread represents one of the many possible subtasks that complete that task. In other words, threads exist within processes. A process consists of one or more threads, and each thread shares the same code and global data.
  • Task includes various actions performed by the user when operating the computer and corresponding response events (such as mouse click, right-click, opening a dialog box, closing a file, starting a program, etc.).
  • a task is a general A term that refers to an activity performed by software.
  • a task can be either a process or a thread. Simply put, it refers to a series of operations that work together to achieve a certain goal. For example, reading data and putting the data into memory.
  • This task can be implemented as a process or as a thread (or as an interrupt task).
  • Boost CPU (central processing unit, central processing unit) performance and frequency improvement stage.
  • the electronic device applied in the embodiments of this application may be a communication device, such as a server or a terminal device.
  • Terminal devices may include mobile phones, foldable electronic devices, tablet computers, personal computers (PC), laptop computers, handheld computers, notebook computers, ultra-mobile personal computers (UMPC), netbooks, Cellular phones, personal digital assistants (PDAs), augmented reality (AR) devices, virtual reality (VR) devices, artificial intelligence (AI) devices, wearable devices, vehicles At least one of equipment, smart home equipment, and smart city equipment.
  • the embodiments of this application do not place special restrictions on the specific type of electronic equipment.
  • the communication network can be a wired network or a wireless network.
  • the communication network may be a local area network (LAN) or a wide area network (WAN), such as the Internet.
  • the communication network may be a wireless fidelity (Wi-Fi) hotspot network, a Wi-Fi P2P network, a Bluetooth network, a zigbee network or a near field communication (NFC) network, etc.
  • Near Field Communication Network When the communication network is a wide area network, for example, the communication network may be a 3rd-generation wireless telephone technology (3G) network or the 4th generation mobile communication technology (4G) network.
  • 3G 3rd-generation wireless telephone technology
  • 4G 4th generation mobile communication technology
  • 5G fifth-generation mobile communication technology
  • future evolved public land mobile network public land mobile network, PLMN
  • Internet etc.
  • the electronic device can install one or more APPs (Applications).
  • APP can be referred to as application, which is a software program that can realize one or more specific functions.
  • instant messaging applications may include, for example, SMS applications, WhatsApp Photo sharing Kakao wait.
  • Image capturing applications may include, for example, camera applications (system cameras or third-party camera applications).
  • Video applications for example, can include etc.
  • Audio applications for example, may include etc.
  • the applications mentioned in the following embodiments may be system applications installed when the electronic device leaves the factory, or may be third-party applications downloaded from the Internet or obtained by the user from other electronic devices during the use of the electronic device.
  • Electronic equipment includes but is not limited to carrying Windows or other operating systems.
  • FIG. 1 illustrates a schematic structural diagram of an electronic device 10 .
  • the electronic device 10 may include a processor 110, an external memory interface 120, an internal memory 121, an antenna 1, an antenna 2, a mobile communication module 130, a wireless communication module 140, an audio module 150, a sensor module 160, a camera module 170, and a display screen 180. wait.
  • the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 10 .
  • the electronic device 10 may include more or less components than shown in the figures, or some components may be combined, some components may be separated, or some components may be arranged differently.
  • the components illustrated may be implemented in hardware, software, or a combination of software and hardware.
  • the processor 110 may include one or more processing units.
  • the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processing unit (GPU), and an image signal processor. (image signal processor, ISP), controller, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural network processor (neural-network processing unit, NPU), etc.
  • application processor application processor, AP
  • modem processor graphics processing unit
  • GPU graphics processing unit
  • image signal processor image signal processor
  • ISP image signal processor
  • controller video codec
  • digital signal processor digital signal processor
  • DSP digital signal processor
  • baseband processor baseband processor
  • neural network processor neural-network processing unit
  • the processor can generate operation control signals based on the instruction opcode and timing signals to complete the control of fetching and executing instructions.
  • the processor 110 may also be provided with a memory for storing instructions and data.
  • the memory in processor 110 may be a cache memory.
  • the memory may store instructions or data that have been used by the processor 110 or are used more frequently. If the processor 110 needs to use the instruction or data, it can be directly called from the memory, which avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
  • processor 110 may include one or more interfaces. Interfaces may include integrated circuit (inter-integrated circuit, I2C) interface, integrated circuit built-in audio (inter-integrated circuit sound, I2S) interface, pulse code modulation (pulse code modulation, PCM) interface, universal asynchronous receiver and transmitter (universal asynchronous receiver/transmitter (UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and /or universal serial bus (USB) interface, etc.
  • the processor 110 can connect to modules such as audio modules, wireless communication modules, displays, and cameras through at least one of the above interfaces.
  • the interface connection relationships between the modules illustrated in the embodiments of this application are only schematic illustrations. It does not constitute a structural limitation on the electronic device 10 . In other embodiments of the present application, the electronic device 10 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
  • the wireless communication function of the electronic device 10 can be implemented through the antenna 1, the antenna 2, the mobile communication module 130, the wireless communication module 140, the modem processor and the baseband processor.
  • Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in electronic device 10 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.
  • Antenna 1 can be reused as a diversity antenna for a wireless LAN. In other embodiments, antennas may be used in conjunction with tuning switches.
  • the mobile communication module 130 can provide wireless communication solutions including 2G/3G/4G/5G applied on the electronic device 10 .
  • the mobile communication module 130 may include at least one filter, switch, power amplifier, low noise amplifier, etc.
  • the mobile communication module 130 can receive electromagnetic waves through the antenna 1, perform filtering, amplification and other processing on the received electromagnetic waves, and transmit them to the modem processor for demodulation.
  • the mobile communication module 130 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves through the antenna 1 for radiation.
  • at least part of the functional modules of the mobile communication module 130 may be disposed in the processor 110 .
  • at least part of the functional modules of the mobile communication module 130 and at least part of the modules of the processor 110 may be provided in the same device.
  • a modem processor may include a modulator and a demodulator.
  • the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal.
  • the demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal.
  • the demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing.
  • the application processor outputs sound signals through the audio module, or displays images or videos through the display screen 180 .
  • the modem processor may be a stand-alone device.
  • the modem processor may be independent of the processor 110 and may be provided in the same device as the mobile communication module 130 or other functional modules.
  • the wireless communication module 140 can provide applications on the electronic device 10 including wireless local area networks (WLAN), Bluetooth (bluetooth, BT), Bluetooth low energy (bluetooth low energy, BLE), ultra wide band (ultra wide band) , UWB), global navigation satellite system (GNSS), frequency modulation (FM), NFC, infrared technology (infrared, IR) and other wireless communication solutions.
  • the wireless communication module 140 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 140 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 .
  • the wireless communication module 140 can also receive the signal to be sent from the processor 110, frequency modulate it, amplify it, and convert it into electromagnetic waves through the antenna 2 for radiation.
  • the antenna 1 of the electronic device 10 is coupled to the mobile communication module 130, and the antenna 2 is coupled to the wireless communication module 140, so that the electronic device 10 can communicate with the network and other electronic devices through wireless communication technology.
  • the wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (code division multiple access, CDMA), broadband code Wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (long term evolution, LTE), BT, GNSS, WLAN, NFC, FM, and/or IR technology, etc.
  • the GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), Beidou navigation satellite system (BDS), quasi-zenith satellite system (quasi- zenith satellite system (QZSS) and/or satellite based augmentation systems (SBAS).
  • GPS global positioning system
  • GLONASS global navigation satellite system
  • BDS Beidou navigation satellite system
  • QZSS quasi-zenith satellite system
  • SBAS satellite based augmentation systems
  • the electronic device 10 can implement display functions through a GPU, a display screen 180, an application processor, and the like.
  • the GPU is an image processing microprocessor and is connected to the display screen 180 and the application processor. GPUs are used to perform mathematical and geometric calculations for graphics rendering.
  • Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
  • Sensor modules include touch sensors, pressure sensors, fingerprint sensors, etc.
  • the camera module 170 includes a camera head.
  • the display screen 180 is used to display images, videos, etc.
  • Display 180 includes a display panel.
  • the display panel can use a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light emitting diode or an active matrix organic light emitting diode (active-matrix organic light).
  • electronic device 10 may include one or more display screens 180 .
  • the electronic device 10 can realize the camera function through the camera module 170, ISP, video codec, GPU, display screen 180, application processor AP, neural network processor NPU, etc.
  • Digital signal processors are used to process digital signals and can also process other digital signals. For example, when the electronic device 10 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
  • Video codecs are used to compress or decompress digital video.
  • Electronic device 10 may support one or more video codecs. In this way, the electronic device 10 can play or record videos in multiple encoding formats, such as: moving picture experts group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
  • MPEG moving picture experts group
  • MPEG2 MPEG2, MPEG3, MPEG4, etc.
  • NPU is a neural network (NN) computing processor.
  • NN neural network
  • Intelligent cognitive applications of the electronic device 10 can be implemented through the NPU, such as image recognition, face recognition, speech recognition, text understanding, etc.
  • the external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 10 .
  • the external memory card communicates with the processor 110 through the external memory interface 120 to implement the data storage function. Such as saving music, videos, etc. files in external memory card. Or transfer music, video and other files from electronic devices to external memory cards.
  • Internal memory 121 may be used to store computer executable program code, which includes instructions.
  • the internal memory 121 may include a program storage area and a data storage area.
  • the stored program area can store an operating system, at least one application program required for a function (such as a sound playback function, an image playback function, etc.).
  • the storage data area may store data created during use of the electronic device 10 (such as audio data, phone book, etc.).
  • the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.
  • the processor 110 executes various functional methods or data processing of the electronic device 10 by executing instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor.
  • the audio module 150 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. Audio module 150 may also be used to encode and decode audio signals. In some embodiments, the audio module 150 may be disposed in the processor 110 , or some functional modules of the audio module 150 may be disposed in the processor 110 .
  • the software system of the electronic device 10 may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture.
  • the embodiment of this application takes the Android system with a layered architecture as an example to illustrate the software structure of the electronic device 10 .
  • FIG. 2 is a software structure block diagram of the electronic device 10 according to the embodiment of the present application.
  • the layered architecture divides the software into several layers, and each layer has clear roles and division of labor.
  • the layers communicate through software interfaces.
  • the Android system is divided into five layers, from top to bottom: application layer, application framework layer, Android runtime (Android runtime, ART) and native C/C++ library, hardware abstraction layer (Hardware Abstract Layer, HAL) and the kernel layer.
  • the application layer can include a series of application packages.
  • the application package can include camera, gallery, calendar, calling, map, navigation, WLAN, Bluetooth, music, video, short message and other applications.
  • the application framework layer provides an application programming interface (API) and programming framework for applications in the application layer.
  • API application programming interface
  • the application framework layer includes some predefined functions.
  • the application framework layer can include window managers, content providers, view systems, resources Manager, notification manager, activity manager, input manager, etc.
  • the window manager provides window management service (Window Manager Service, WMS).
  • WMS can be used for window management, window animation management, surface management, and as a transfer station for the input system.
  • Content providers are used to store and retrieve data and make this data accessible to applications.
  • This data can include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
  • the view system includes visual controls, such as controls that display text, controls that display pictures, etc.
  • a view system can be used to build applications.
  • the display interface can be composed of one or more views.
  • a display interface including a text message notification icon may include a view for displaying text and a view for displaying pictures.
  • the resource manager provides various resources to applications, such as localized strings, icons, pictures, layout files, video files, etc.
  • the notification manager allows applications to display notification information in the status bar, which can be used to convey notification-type messages and can automatically disappear after a short stay without user interaction.
  • the notification manager is used to notify download completion, message reminders, etc.
  • the notification manager can also be notifications that appear in the status bar at the top of the system in the form of charts or scroll bar text, such as notifications for applications running in the background, or notifications that appear on the screen in the form of conversation windows. For example, text information is prompted in the status bar, a beep sounds, the electronic device vibrates, the indicator light flashes, etc.
  • the input manager can provide input management service (Input Manager Service, IMS).
  • IMS can be used to manage system input, such as touch screen input, key input, sensor input, etc.
  • IMS takes out events from the input device node and distributes the events to appropriate windows through interaction with WMS.
  • the Android runtime includes core libraries and Android runtime.
  • the Android runtime is responsible for converting source code into machine code.
  • the Android runtime mainly includes the use of ahead of time (ahead or time, AOT) compilation technology and just in time (just in time, JIT) compilation technology.
  • the core library is mainly used to provide basic Java class library functions, such as basic data structures, mathematics, IO, tools, databases, networks and other libraries.
  • the core library provides APIs for users to develop Android applications.
  • Native C/C++ libraries can include multiple function modules. For example: surface manager (surface manager), media framework (Media Framework), libc, OpenGL ES, SQLite, Webkit, etc.
  • the surface manager is used to manage the display subsystem and provides the integration of 2D and 3D layers for multiple applications.
  • the media framework supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc.
  • the media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
  • OpenGL ES provides the drawing and manipulation of 2D graphics and 3D graphics in applications. SQLite provides a lightweight relational database for electronic device 10 applications.
  • the hardware abstraction layer runs in user space, encapsulates the kernel layer driver, and provides a calling interface to the upper layer.
  • the kernel layer is the layer between hardware and software.
  • the kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.
  • FIGS. 3A-3D a schematic diagram of the application scenario of the task scheduling method provided by the embodiment of the present application is introduced below with reference to FIGS. 3A-3D.
  • the electronic device 10 may be installed with an operating system and an application program.
  • the application program may provide business services or Or a user-oriented program, and the application program can also be other types of programs, which is not limited in this application.
  • the electronic device 10 is a server, and the application program may refer to a business program installed on the server.
  • the electronic device 10 is a mobile phone, and the application program may refer to an APP installed on the mobile phone.
  • the application thread that responds to the input operation is a foreground application thread, which is used to perform foreground tasks. For example, if the user starts an application, the opening task of the application is a foreground task.
  • the application thread before receiving the input operation is a background application thread, which is used to perform background tasks. For example, refreshing the application interface running in the background is a background task.
  • a foreground application thread is established for performing foreground tasks.
  • the foreground application generates tasks and the foreground application thread executes the tasks.
  • the background application thread is idle.
  • the background application generates tasks and the background application thread executes the tasks.
  • the foreground application thread is blocked by the background application thread.
  • the foreground application thread cannot execute the task in time. This may cause the system to freeze and be unable to respond to user operations in a timely manner, thus affecting the user experience.
  • the application thread needs to rely on system services to collaboratively process the task.
  • the execution of the interface refresh task requires the participation of the window management service (WindowManagerService) and the drawing and rendering service (SurfaceFlinger).
  • the data collection task of sports and health-type applications depends on the sensor management service (SensorManagerService).
  • a foreground application thread is established for performing foreground tasks.
  • the foreground application generates tasks, and the foreground application thread and the system service thread collaborate to execute the task.
  • the background application thread is idle.
  • the background application generates tasks and the background application thread executes the tasks.
  • the system service thread is blocked by the background application thread.
  • the foreground application thread cannot coordinate with the system service thread.
  • the task is executed, which may cause the system to freeze, thus affecting the user experience.
  • the download and upload tasks can be uniformly executed through the proxy process, thereby reducing the occupation of system resources by background application threads.
  • the background tasks of the agent process itself lack control and are still executed at will, thus affecting the normal execution of foreground tasks, which may cause system lags and thus affect the user experience.
  • embodiments of the present application provide a task scheduling method.
  • the following is a schematic flowchart of a task scheduling method provided by an embodiment of the present application as an example with reference to FIG. 4 .
  • the method is applied to electronic equipment, and the task scheduling method includes:
  • the application process is preset with an importance attribute
  • determining whether an application process is a background application process includes: The ActivityLifecycleCallbacks program calls the activity of the application process (Activity) and determines whether the activity of the application process is running in the background. If the activity of the application process is running in the background, it is determined that the application process is a background application process.
  • determining whether an application process is a background application process includes: calling a foreground application process through the UsageStatsManager program, and judging whether the called foreground application process includes the application process. If the called foreground application process The application process is not included, and the application process is determined to be a background application process.
  • the process if it is determined that the task is a non-urgent task, the process proceeds to S12; if it is determined that the task is not a non-urgent task, the process continues to S11.
  • Figure 6 the detailed process for determining whether a task is a non-urgent task is shown in Figure 6, which specifically includes:
  • each task generated by the application process has an expected processing time.
  • the expected processing time is the time when the task is expected to be executed.
  • the basis of the expected processing time is the time in milliseconds (ms) starting from the time the electronic device is turned on. ) as the unit of time. For example, if the expected processing time of task task 1 is 100 ms, that is, the expected processing time of task task 1 is the 100 ms after the electronic device is turned on.
  • determining whether the task has expired includes: determining whether the timing time after the electronic device is powered on exceeds the expected processing time of the task. If the timing time after the electronic device is powered on exceeds the expected processing time of the task, time, it is determined that the task has expired; if the timing time after the electronic device is turned on does not exceed the expected processing time of the task, it is determined that the task has not expired.
  • the timing time after the electronic device is turned on is 120ms and the expected processing time of the task is 130ms, then the timing time after the electronic device is turned on does not exceed the expected processing time of the task, and it is determined that the task has not expired.
  • the timing time after the electronic device is powered on is 150ms and the expected processing time of the task is 130ms, then the timing time after the electronic device is powered on exceeds the expected processing time of the task, and it is determined that the task has expired.
  • the kernel layer records historical load information of all tasks performed by the electronic device system.
  • the load information includes the highest load and/or average load during the execution of the task.
  • the load It may include, but is not limited to, one or more of the following: CPU usage, memory usage, or pressure stall information (PSI).
  • PSI program is an open source program used to evaluate system resource pressure. PSI is used to represent the task execution pause time caused by resource pressure, quantify the task execution interruption caused by tight hardware resources, and count the tasks waiting for hardware resources in the system. time. PSI is used as an indicator to measure the pressure on hardware resources. The longer the pause time, the greater the resource pressure.
  • hardware resources can include resources such as CPU, memory, and IO (Input/Output, input and output).
  • determining whether a task is a high-load task includes: obtaining the associated information of the task, and sending the associated information of the task to the kernel layer; querying the historical load information of the task through the kernel layer, and determining the task's associated information. Whether the historical load information is greater than or equal to the load threshold. If the historical load information of the task is greater than or equal to the load threshold, the task is determined to be a high-load task; if the historical load information of the task is less than the load threshold, the task is determined not to be a high-load task. For example, if the load information is CPU usage, the load threshold can be 20%; if the load information is memory usage, the load threshold can be 20%; if the load information is PSI, the load threshold can be 0.1 seconds.
  • determining whether a task is a high-load task includes: obtaining the associated information of the task and sending the associated information of the task to the kernel layer; querying through the kernel layer whether the task is a task that has been executed by the system. If so, The above tasks are tasks executed by the system. Query the historical load information of the task and determine the historical load information of the task. Whether it is greater than or equal to the load threshold. If the load information of the task is greater than or equal to the load threshold, the task is determined to be a high-load task. If the load information of the task is less than the load threshold, the task is determined not to be a high-load task. If the task is a task that has not been executed by the system, it is determined that the task is not a high-load task.
  • the kernel layer queries the task of the same type as the task, queries the historical load information of the task of the same type, and determines the historical load information of the task of the same type. Whether the load information is greater than or equal to the load threshold. If the historical load information of tasks of the same type is greater than or equal to the load threshold, the task is determined to be a high-load task. If the historical load information of tasks of the same type is less than the load threshold, the task is determined to be a high-load task. Not a high load task.
  • determining whether a task is a high-load task includes: obtaining the associated information of the task, determining whether the task has a high-load task tag, and if the task has a high-load task tag, determining whether the task has a high-load task tag. It is a high-load task. If the task does not have a high-load task mark, it is determined that the task is not a high-load task.
  • the task is marked as a high-load task by adding a high-load task mark to the task.
  • the load information of each task during execution is monitored. If the load information of a task when executed within the first preset time period is greater than or equal to the load threshold the number of times is greater than or equal to the preset number of times, the task is given Add a high load task tag to mark the task as a high load task. If the number of times the load information of the task with the high load task mark is greater than or equal to the load threshold when executed within the second preset time period is less than the preset number of times, the high load task mark of the task is canceled.
  • the first preset time period is one week
  • the second preset time period is one month
  • the preset number of times is 10.
  • the CPU frequency is obtained by obtaining the CPU frequency point, where the frequency point is a fixed frequency number, and the load is the CPU occupancy rate.
  • the CPU of electronic equipment is preset with multiple frequency points, each frequency point corresponds to a frequency, and the CPU can work at the frequency corresponding to each frequency point.
  • the CPU has three preset frequency points.
  • the frequency corresponding to frequency point 1 is 3.13GHz
  • the frequency corresponding to frequency point 2 is 2.54GHz
  • the frequency corresponding to frequency point 3 is 2.04GHz.
  • the CPU can operate at 3.13GHz, 2.54GHz or Works at a frequency of 2.04GHz.
  • the core of the CPU may include a large core and a small core, or a large core, a medium core, and a small core.
  • the performance of the large core, the medium core, and the small core decreases in order.
  • Perceivable tasks such as interface refresh tasks
  • tasks that do not require fast response or are not perceptible by users such as download and upload tasks
  • CPU medium or small cores For users who require fast response or Perceivable tasks (such as interface refresh tasks) can be processed by large CPU cores, and tasks that do not require fast response or are not perceptible by users (such as download and upload tasks) can be processed by CPU medium or small cores.
  • obtaining the frequency and load of the CPU includes: obtaining the current CPU small core frequency and the overall load of the CPU small core through the resource scheduling service process of the system. It can be understood that in order to prevent non-urgent tasks from occupying too many CPU resources and causing the CPU to be unable to process key tasks in time, non-urgent tasks are processed through the CPU small core. In this way, only the frequency and load of the CPU small core need to be obtained. In other embodiments, non-urgent tasks can also be processed by the CPU large core or medium core as needed. In this way, the frequency and load of the CPU large core or medium core can be obtained through the resource scheduling service process of the system.
  • the normalized frequency is the frequency corresponding to when the CPU load is 100%.
  • the electronic device has a CPU energy efficiency ratio table stored in advance.
  • the CPU energy efficiency ratio table records the correspondence between the frequency, power consumption and performance scores of the CPU.
  • the CPU energy efficiency ratio is provided by the system side of the electronic device. Refer to FIG. 8 , which is a schematic diagram of a CPU energy efficiency ratio table provided by an embodiment of the present application. For example, when the CPU frequency is 884MHz, the corresponding power consumption is 30.68mW and the performance score is 339.15 points.
  • the CPU energy efficiency ratio is the ratio between the CPU's performance score and power consumption, or is the ratio between the CPU's frequency and power consumption.
  • Determining the normalized frequency of the CPU based on the frequency and load of the CPU includes: determining the performance score corresponding to the current frequency of the CPU by querying the energy efficiency ratio table of the CPU, and determining the performance score at 100% load based on the performance score corresponding to the current frequency and the current load. , by querying the CPU energy efficiency ratio table to determine the frequency corresponding to the performance score when the load is 100%, thereby obtaining the current normalized frequency of the CPU.
  • the performance score corresponding to the current frequency is 367.10 points obtained by querying the energy efficiency ratio table.
  • the energy efficiency ratio table of the CPU it is determined that the frequency corresponding to the performance score of 183.55 points is 412MHz, that is, the current normalized frequency of the CPU is 412MHz.
  • the preset frequency is 0.5GHz. Determine whether the current system status allows the execution of non-emergency tasks by judging whether the normalized frequency is less than or equal to the preset frequency. If the normalized frequency is less than or equal to the preset frequency, it means that the current system status is relatively idle. Determine whether the current system status allows Perform non-urgent tasks. If the normalized frequency is greater than the preset frequency, it means that the current system status is relatively busy, and it is determined that the current system status does not allow the execution of non-urgent tasks.
  • the method further includes: determining whether the number of times the normalized frequency is continuously greater than the preset frequency is greater than or equal to the second preset value, and if the number of times the normalized frequency is continuously greater than the preset frequency is greater than Or equal to the second preset value, increase the preset frequency.
  • the second preset value is 5.
  • the preset frequency may be set too small, thereby increasing the preset frequency by one level, so that the current return value of the CPU Unified frequency makes it easier to meet conditions, and the system state makes it easier to allow non-urgent tasks to be performed, so that non-urgent tasks can be processed when necessary.
  • the preset frequency can be adjusted according to a preset adjustment range or gears corresponding to different frequencies.
  • the preset adjustment range or one gear can be 0.1GHz. If the preset frequency is 0.5GHz and the second preset value is 5, when the number of times the normalized frequency is continuously greater than 0.5GHz is greater than or equal to 5, the preset frequency is increased by one level, and the preset frequency of 0.5GHz is increased by 0.1GHz. to 0.6GHz.
  • determining whether the electronic device is in a sleep state includes: determining whether the display screen is off (screen off). If the display screen is off, determine that the electronic device is in a sleep state. If the display screen is on, determine whether the electronic device is in a sleep state. The device is not sleeping.
  • determining whether the display screen is off includes: determining whether the brightness of the display screen is 0, if the brightness of the display screen is not 0, determining that the display screen is on, and if the brightness of the display screen is 0, determining The display goes off.
  • determining whether the electronic device is in a sleep state includes: determining whether the display screen is off, and determining whether the electronic device is in a distributed scene. If the display screen is off and the electronic device is not in a distributed scene, Make sure that the electronic device is in a dormant state. If the display screen is on and/or the electronic device is in a distributed scene, make sure that the electronic device is not in a dormant state.
  • determining whether the electronic device is in a distributed scenario includes: determining whether the electronic device is in a collaborative working mode with at least one terminal device. If the electronic device and at least one terminal device are in a collaborative working mode, determine The electronic device is in a distributed scenario. If the electronic device is not in a cooperative working mode with at least one terminal device, it is determined that the electronic device is not in a distributed scenario.
  • the collaborative working mode may be a multi-screen collaborative working mode, in which the electronic device is in a running state, but the interface content is displayed by other terminal devices that are communicatively connected to the electronic device. For example, when an electronic device receives a voice call, the voice interaction is performed by a tablet computer connected to the electronic device. At this time, the screen of the electronic device itself turns off, but it still needs to be in a running state to transmit voice to the receiving end.
  • the electronic device If the electronic device is in a sleep state, adjust the CPU frequency so that the CPU load is the first preset value, consistent with the optimal energy efficiency ratio of the CPU, and execute the non-urgent task.
  • the first preset value is 90%.
  • the electronic device if the electronic device is in the sleep state, it means that the electronic device is in the idle state and can perform non-urgent tasks. Before executing the non-urgent task, the CPU frequency is adjusted so that the CPU load is the first preset value.
  • adjusting the CPU frequency so that the CPU load is a first preset value and meeting the optimal energy efficiency ratio of the CPU includes: writing the CPU frequency value to be adjusted into the kernel node to adjust the CPU frequency. , until the CPU load is adjusted to the first preset value and the CPU frequency is consistent with the optimal energy efficiency ratio of the CPU.
  • the optimal energy efficiency ratio may be the highest energy efficiency ratio, the highest energy efficiency ratio determined through the CPU energy efficiency ratio table, or the highest energy efficiency ratio set in advance.
  • the first preset value may be preset so that the CPU frequency The percentage value that meets the optimal energy efficiency ratio.
  • the CPU frequency is reduced so that the CPU load is the first preset value, so that the CPU frequency meets the optimal energy efficiency ratio of the CPU. That is, the reduced CPU frequency value is written into the kernel node to reduce the CPU frequency until the CPU load is adjusted to the first preset value and makes the CPU frequency comply with the optimal energy efficiency ratio of the CPU. It is understandable that if the CPU frequency is reduced, the CPU load needs to be increased when processing the same tasks, but reducing the CPU frequency can reduce CPU power consumption, thereby improving energy efficiency.
  • adjusting the CPU frequency so that the CPU load is the first preset value includes: writing the CPU frequency point to be adjusted into the kernel node to adjust the CPU frequency until the CPU load is adjusted to the first preset value. Set value. Specifically, the reduced CPU frequency point is written into the kernel node to reduce the CPU frequency until the CPU load is adjusted to the first preset value and the CPU frequency meets the optimal energy efficiency ratio of the CPU.
  • the method further includes: if the CPU load is adjusted to the first preset value, determine whether the energy efficiency ratio of the CPU is the optimal energy efficiency ratio; if the energy efficiency ratio of the CPU is the optimal energy efficiency ratio, The non-urgent task is executed when the CPU load is the first preset value; if the energy efficiency ratio of the CPU is not the optimal energy efficiency ratio, the CPU frequency continues to be adjusted until the energy efficiency ratio of the CPU is the optimal energy efficiency ratio.
  • the method further includes: if the CPU load is adjusted to the first preset value, determining whether the difference between the CPU's energy efficiency ratio and the optimal energy efficiency ratio is less than or equal to the third preset value. value, if the difference between the energy efficiency ratio of the CPU and the optimal energy efficiency ratio is less than or equal to the third preset value, the non-urgent task is executed when the CPU load is the first preset value; if the energy efficiency ratio of the CPU is less than the optimal energy efficiency ratio, If the difference between the optimal energy efficiency ratio is greater than the third preset value, the CPU frequency continues to be adjusted until the difference between the CPU's energy efficiency ratio and the optimal energy efficiency ratio is less than or equal to the third preset value.
  • FIG. 9 is a schematic flowchart of a task scheduling method provided by another embodiment of the present application.
  • the method is applied to electronic equipment, and the task scheduling method includes:
  • the first priority is higher than the second priority.
  • the first priority is high priority and the second priority is low priority.
  • the electronic device can preset a high-priority task pool and a low-priority task pool. If the electronic device is in sleep state, non-urgent tasks will be added to the high-priority task pool. The non-urgent tasks in the high-priority task pool will be added in sequence according to the time they are added. Executed in sequence. If the electronic device is not in sleep state, add non-urgent tasks to the low-priority task pool. The non-urgent tasks in the low-priority task pool need to be added to the low-priority tasks after the tasks in the high-priority task pool are completed. The pools are executed sequentially in time sequence.
  • S29 Adjust the CPU frequency so that the CPU load is the first preset value, consistent with the optimal energy efficiency ratio of the CPU, and execute the non-urgent task.
  • the first preset value is 90%.
  • the actual runtime and virtual runtime (wagntime) of non-urgent tasks of different priorities can be calculated based on the Completely Fair Schedule (CFS) algorithm, and based on the corresponding Actual running time and virtual running time process non-urgent tasks of different priorities.
  • CFS Completely Fair Schedule
  • processing non-urgent tasks includes: determining the priority value of non-urgent tasks based on the priority of non-urgent tasks. There is a one-to-one correspondence between the priority value and weight of tasks. Determining the weight of non-urgent tasks based on the priority value, and determining the weight of non-urgent tasks based on the priority value.
  • the weight of the task and the scheduling cycle of the CPU determine the actual running time and virtual running time of non-urgent tasks.
  • the scheduling cycle of the CPU is the time to schedule all tasks in the current system. The system always selects the non-urgent task with the smallest virtual running time. The non-urgent tasks are processed within the corresponding actual running time.
  • the actual running time runtime CPU scheduling cycle * task weight / sum of the weights of all tasks
  • virtual running time vruntime actual running time * weight corresponding to priority value 0 / task weight
  • the weight corresponding to priority value 0 is 1024.
  • the CPU scheduling cycle is 6ms
  • the priority value range is [-20,19]. The smaller the priority value, the higher the priority.
  • the system currently includes two tasks A and B to be executed.
  • the priority value of task A is 0 and its corresponding weight is 1024.
  • the priority value of task B is 1 and its corresponding weight is 820.
  • task B has a higher priority and a smaller virtual running time, and can be prioritized by the system for processing. In this way, based on the completely fair scheduling algorithm, high-priority tasks can be processed first.
  • FIG. 10 is a schematic flowchart of a task scheduling method provided by another embodiment of the present application.
  • the method is applied to electronic equipment, and the task scheduling method includes:
  • determining whether the system is in the promotion state includes: determining whether the system is responding to the user's input operation. If the system is responding to the user's input operation, determining that the system is in the promotion state. If the system is not responding to the user's input operation, , to make sure the system is not in an elevated state.
  • the input operation can be responded to quickly is one of the key factors that affects the user experience. If the system receives the user's input operation, it can enter the promotion state to improve system performance and respond quickly to the user's input operation.
  • the third priority is lower than the second priority, for example, the third priority is a restricted priority.
  • Electronic equipment is also preset with a restricted priority task pool. If the system is in an elevated state, non-urgent tasks are added to the restricted priority task pool. Non-urgent tasks in the restricted priority task pool need to be executed in tasks in the low-priority task pool. After completion, the tasks will be executed in order according to the time when they are added to the restricted priority task pool.
  • non-urgent tasks of the third priority level can also be processed based on a completely fair scheduling algorithm.
  • S40 Adjust the CPU frequency so that the CPU load is a first preset value, consistent with the optimal energy efficiency ratio of the CPU, and execute the non-urgent task.
  • the first preset value is 90%.
  • FIG. 11 is a schematic flowchart of a task scheduling method provided by another embodiment of the present application.
  • the method is applied to electronic equipment, and the task scheduling method includes:
  • S404 determine whether the normalized frequency point is less than or equal to the preset frequency. If the normalized frequency point is less than or equal to the preset frequency, it means that background activities are allowed, and the process proceeds to S405; if the condition is not met N times, the process proceeds to S411.
  • S405 determine whether the screen of the electronic device is on. If the electronic device turns off the screen and is in a non-distributed scene, the process proceeds to S406; if the electronic device turns on the screen or is in a non-distributed scene, the process proceeds to S407.
  • S407 determine whether the system is in an improved state. If the system is not in the upgrade state, the process proceeds to S408; if the system is in the upgrade state, the process proceeds to S409.
  • S411 increase the preset frequency by one gear, and return to S402, continue to read the current frequency point and load of the CPU.
  • Embodiments of this application include: when background tasks need to be run, the resource scheduling service process of the system can read the current small-core CPU frequency point and the overall load of the small core; calculate the normalized frequency point through the frequency point and load, that is, According to the chip energy efficiency ratio table, calculate the CPU frequency corresponding to 100% load of the CPU; then determine whether the current system status allows background tasks to run based on the normalized frequency; if it is judged that the activity conditions are met (for example, the current system status allows the background task running), you can allow background activities to further determine whether the current system has received user operations. If no user operations are received, increase the thread scheduling priority and reduce the frequency until the overall CPU usage of the task is 90%. If the current user operation stage is in progress, try to reduce the priority of background tasks at this time, and try to adjust the frequency so that the CPU occupancy rate is around 90% to achieve the optimal energy efficiency ratio frequency under the current system status.
  • the embodiment of this application performs specialized scheduling on non-urgent background tasks and separates them from foreground operation tasks to reduce the impact on foreground operations.
  • the non-urgent background tasks are reasonably arranged to be executed at a reasonable time, and when the CPU is relatively High energy efficiency frequency point execution to reduce system power consumption and improve the battery life of electronic devices. For example, as shown in Figure 12, non-urgent tasks can be performed while the system is inactive.
  • Embodiments of the present application also provide a computer storage medium that stores computer instructions.
  • the electronic device When the computer instructions are run on an electronic device, the electronic device causes the electronic device to execute the above related methods to implement the task scheduling method in the above embodiments.
  • An embodiment of the present application also provides a computer program product.
  • the computer program product When the computer program product is run on a computer, it causes the computer to execute the task scheduling method in the above embodiment.
  • inventions of the present application also provide a device.
  • This device may be a chip, a component or a module.
  • the device may include a connected processor and a memory.
  • the memory is used to store computer execution instructions.
  • the processor can execute computer execution instructions stored in the memory, so that the chip executes the task scheduling method in each of the above method embodiments.
  • the electronic devices, computer storage media, computer program products or chips provided by the embodiments of the present application are all used to execute the corresponding methods provided above. Therefore, the beneficial effects they can achieve can be referred to the corresponding methods provided above. The beneficial effects of this method will not be repeated here.
  • the disclosed devices and methods can be implemented in other ways.
  • the device embodiments described above are schematic.
  • the division of modules or units is a logical functional division.
  • multiple units or components may be combined or may be integrated into another device, or some features can be ignored, or not implemented.
  • the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.
  • the unit described as a separate component may or may not be physically separate.
  • the component shown as a unit may be one physical unit or multiple physical units, that is, it may be located in one place, or it may be distributed to multiple different places. Some or all of the units can be selected according to actual needs to implement the solution of this embodiment. Purpose.
  • each functional unit in each embodiment of the present application can be integrated into one processing unit, each unit can exist physically alone, or two or more units can be integrated into one unit.
  • the above integrated units can be implemented in the form of hardware or software functional units.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium.
  • the technical solutions of the embodiments of the present application are essentially or contribute to the existing technology, or all or part of the technical solution can be embodied in the form of a software product, and the software product is stored in a storage medium , including several instructions to cause a device (which can be a microcontroller, a chip, etc.) or a processor to execute all or part of the steps of the methods described in various embodiments of this application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program code. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Stored Programmes (AREA)

Abstract

本申请实施例提供一种任务调度方法及相关设备,涉及智能终端技术领域。所述方法包括:在应用进程产生任务时,判断任务是否为非紧急任务;若任务为非紧急任务,获取电子设备CPU的频率和负载;基于CPU的频率和负载确定CPU的归一化频率,归一化频率为CPU负载100%时对应的频率;判断归一化频率是否小于或等于预设频率;若归一化频率小于或等于预设频率,判断电子设备是否处于休眠状态;若电子设备处于休眠状态,通过调整CPU的频率使得CPU的负载为第一预设值,符合CPU的最优能效比,并执行非紧急任务。本申请实施例在系统状态符合需求且电子设备休眠时对非紧急任务进行处理,保障执行前台任务时的系统资源,避免系统出现卡顿,提升用户体验。

Description

任务调度方法及相关设备
本申请要求于2022年08月29日提交中国专利局,申请号为202211043554.0、申请名称为“任务调度方法及相关设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及智能终端技术领域,尤其涉及一种任务调度方法及相关设备。
背景技术
应用程序在电子设备(例如移动终端、个人电脑、物联网设备、服务器等)中的运行过程中,会产生大量任务。其中,前台应用线程和后台应用线程产生的任务同步处理,后台应用线程产生的非紧急任务会抢占系统资源和系统服务,导致用于处理前台应用线程产生的任务的系统资源不足,进而导致前台应用程序出现卡顿,从而影响用户体验。
发明内容
有鉴于此,有必要提供一种任务调度方法,解决后台非紧急任务占用系统资源和系统服务导致处理前台任务的系统资源不足的问题。
本申请实施例第一方面提供一种任务调度方法,包括:在应用进程产生任务时,判断所述任务是否为非紧急任务;若所述任务为非紧急任务,获取电子设备的中央处理器CPU的频率和负载;基于所述CPU的频率和负载确定所述CPU的归一化频率,所述归一化频率为所述CPU负载100%时对应的频率;判断所述归一化频率是否小于或等于预设频率;若所述归一化频率小于或等于所述预设频率,判断所述电子设备是否处于休眠状态;若所述电子设备处于休眠状态,通过调整所述CPU的频率使得所述CPU的负载为第一预设值,符合所述CPU的最优能效比,并执行所述非紧急任务。
采用该技术方案,可以根据CPU的归一化频率精确地确定电子设备的系统是否允许执行非紧急任务,再基于电子设备是否处于休眠状态确定是否执行非紧急任务,以及在CPU频率符合最优能效比时对非紧急任务进行处理,如此,可以降低系统功耗,同时,避免后台任务对系统资源的占用率过高,保障前台任务占用的系统资源,避免系统出现卡顿,有效提升用户体验。
在一种可能的实现方式中,所述判断任务是否为非紧急任务包括:在应用进程产生任务时,判断应用进程是否为后台应用进程;若应用进程为后台应用进程,确定任务为非紧急任务。采用该技术方案,可以精确地确定应用进程产生的任务是否为非紧急任务。
在一种可能的实现方式中,判断应用进程是否为后台应用进程包括:通过ActivityLifecycleCallbacks程序调取应用进程的活动,判断应用进程的活动是否在后台运行,若应用进程的活动在后台运行,确定应用进程为后台应用进程。采用该技术方案,可以精确地确定应用进程是否为后台应用进程。
在一种可能的实现方式中,判断应用进程是否为后台应用进程包括:通过UsageStatsManager程序调取前台应用进程,判断调取的前台应用进程是否包含所述应用进程,若调取的前台应用进程不包含所述应用进程,确定所述应用进程为后台进程。采用该技术方案,可以精确地确定应用进程是否为后台应用进程。
在一种可能的实现方式中,所述判断任务是否为非紧急任务包括:在应用进程产生任务时,判断应用进程是否为后台应用进程,以及判断任务是否到期;若应用进程为后 台应用进程且任务未到期,确定任务为非紧急任务。采用该技术方案,可以精确地确定应用进程产生的任务是否为非紧急任务。
在一种可能的实现方式中,所述判断任务是否为非紧急任务包括:在应用进程产生任务时,判断应用进程是否为后台应用进程,以及判断任务是否为高负载任务;若应用进程为后台应用进程且任务为高负载任务,确定任务为非紧急任务。采用该技术方案,可以精确地确定应用进程产生的任务是否为非紧急任务。
在一种可能的实现方式中,判断任务是否为高负载任务包括:获取任务的关联信息,将任务的关联信息发送至内核层;通过内核层查询任务的历史负载信息,判断任务的历史负载信息是否大于或等于负载阈值;若任务的历史负载信息大于或等于负载阈值,确定任务为高负载任务;或若任务的历史负载信息小于负载阈值,确定任务不是高负载任务。采用该技术方案,可以精确地确定应用进程产生的任务是否为高负载任务。
在一种可能的实现方式中,所述获取电子设备的中央处理器CPU的频率和负载包括:通过所述电子设备的资源调度服务进程获取当前的CPU小核频点和CPU小核整体的负载。采用该技术方案,可以精确地获取CPU小核的频率和负载,并降低处理非紧急任务时的CPU功耗。
在一种可能的实现方式中,所述电子设备预设有所述CPU的能效比表格,所述基于所述CPU的频率和负载确定CPU的归一化频率包括:通过查询所述能效比表格确定所述CPU的当前频率对应的性能分数;根据所述当前频率对应的性能分数和当前负载确定负载100%时的性能分数;通过查询所述能效比表格确定负载100%时的性能分数对应的频率,得到所述CPU当前的归一化频率。采用该技术方案,可以精确地确定CPU的归一化频率。
在一种可能的实现方式中,所述方法还包括:判断归一化频率连续大于预设频率的次数是否大于或等于第二预设值;若归一化频率连续大于预设频率的次数大于或等于第二预设值,提高所述预设频率。采用该技术方案,可以使得预设频率的设置更加符合系统需求。
在一种可能的实现方式中,判断电子设备是否处于休眠状态包括:判断显示屏是否灭屏;若显示屏灭屏,确定电子设备处于休眠状态;或若显示屏亮屏,确定电子设备未处于休眠状态。采用该技术方案,可以精确地确定电子设备是否处于休眠状态。
在一种可能的实现方式中,所述判断电子设备是否处于休眠状态包括:判断显示屏是否灭屏,以及判断电子设备是否处于分布式场景;若显示屏灭屏且电子设备未处于分布式场景,确定电子设备处于休眠状态;或若显示屏亮屏及/或电子设备处于分布式场景,确定电子设备未处于休眠状态。采用该技术方案,可以精确地确定电子设备是否处于休眠状态。
在一种可能的实现方式中,所述判断电子设备是否处于分布式场景包括:判断电子设备是否与至少一终端设备处于协同工作模式;若电子设备与至少一终端设备处于协同工作模式,确定电子设备处于分布式场景;或若电子设备未与至少一终端设备处于协同工作模式,确定电子设备未处于分布式场景。采用该技术方案,可以精确地确定电子设备是否处于分布式场景。
在一种可能的实现方式中,所述通过调整所述CPU的频率使得所述CPU的负载为第一预设值包括:将待调整的CPU频率值写入内核节点,以调整所述CPU的频率,直至所述CPU的负载为所述第一预设值。采用该技术方案,可以在CPU的最优能效比下对非紧急任务进行处理,从而减少系统功耗。
在一种可能的实现方式中,所述方法还包括:所述方法还包括:若所述CPU的负载调整为所述第一预设值,判断所述CPU的能效比是否为最优能效比;若所述CPU的能效比为最优能效比,在所述CPU的负载为所述第一预设值时执行所述非紧急任务;或若所述CPU的能效比不是最优能效比,继续调整所述CPU的频率,直至所述CPU的能效 比为最优能效比。采用该技术方案,可以在CPU的最优能效比下对非紧急任务进行处理,从而减少系统功耗。
在一种可能的实现方式中,所述方法还包括:所述方法还包括:若所述CPU的负载调整为所述第一预设值,判断所述CPU的能效比与最优能效比之间的差值是否小于或等于第三预设值;若所述CPU的能效比与所述最优能效比之间的差值小于或等于所述第三预设值,在所述CPU的负载为所述第一预设值时执行所述非紧急任务;或若所述CPU的能效比与所述最优能效比之间的差值大于所述第三预设值,继续调整所述CPU的频率,直至所述CPU的能效比与最优能效比之间的差值小于或等于第三预设值。采用该技术方案,可以在CPU接近最优能效比时对非紧急任务进行处理,从而减少系统功耗。
在一种可能的实现方式中,所述方法还包括:若电子设备处于休眠状态,将所述非紧急任务设置为第一优先级;或若电子设备未处于休眠状态,将所述非紧急任务设置为第二优先级,第一优先级高于第二优先级。采用该技术方案,可以对非紧急任务进行分优先级处理。
在一种可能的实现方式中,所述方法还包括:若电子设备未处于休眠状态,判断系统是否处于提升状态;若系统未处于提升状态,将所述非紧急任务设置为第二优先级;若系统处于提升状态,将所述非紧急任务设置为第三优先级,第一优先级高于第二优先级,第二优先级高于第三优先级。采用该技术方案,可以对非紧急任务进行分优先级处理。
第二方面,本申请实施例提供一种计算机可读存储介质,包括计算机指令,当计算机指令在电子设备上运行时,使得电子设备执行如第一方面所述的任务调度方法。
第三方面,本申请实施例提供一种电子设备,电子设备包括处理器和存储器,存储器用于存储指令,处理器用于调用存储器中的指令,使得电子设备执行如第一方面所述的任务调度方法。
第四方面,本申请实施例提供一种计算机程序产品,当计算机程序产品在计算机上运行时,使得计算机执行如第一方面所述的任务调度方法。
第五方面,提供一种装置,该装置具有实现上述第一方面所提供的方法中电子设备行为的功能。功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。硬件或软件包括一个或多个与上述功能相对应的模块。
可以理解地,上述提供的第二方面所述的计算机可读存储介质,第三方面所述的电子设备,第四方面所述的计算机程序产品,第五方面所述的装置均与上述第一方面的方法对应,因此,其所能达到的有益效果可参考上文所提供的对应的方法中的有益效果,此处不再赘述。
附图说明
图1为本申请一实施例提供的一种电子设备的结构示意图。
图2为本申请一实施例提供的一种电子设备的软件结构示意图。
图3A为本申请一实施例提供的任务调度方法的应用场景示意图。
图3B为本申请一实施例提供的任务调度方法的另一应用场景示意图。
图3C为本申请一实施例提供的任务调度方法的另一应用场景示意图。
图3D为本申请一实施例提供的任务调度方法的另一应用场景示意图。
图4为本申请一实施例提供的任务调度方法的流程示意图。
图5为本申请一实施例提供的判断任务是否为非紧急任务的流程示意图。
图6为本申请另一实施例提供的判断任务是否为非紧急任务的流程示意图。
图7为本申请另一实施例提供的判断任务是否为非紧急任务的流程示意图。
图8为本申请一实施例提供的CPU能效比表格的示意图。
图9为本申请另一实施例提供的任务调度方法的流程示意图。
图10为本申请另一实施例提供的任务调度方法的流程示意图。
图11为本申请另一实施例提供的任务调度方法的流程示意图。
图12为本申请一实施例提供的任务调度方法的应用场景示意图。
具体实施方式
需要说明的是,本申请中“至少一个”是指一个或者多个,“多个”是指两个或多于两个。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B可以表示:单独存在A,同时存在A和B,单独存在B的情况,其中A,B可以是单数或者复数。本申请的说明书和权利要求书及附图中的术语“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不是用于描述特定的顺序或先后次序。
在本申请实施例中,“示例性的”或者“例如”等词用于表示作例子、例证或说明。本申请实施例中被描述为“示例性的”或者“例如”的任何实施例或设计方案不应被解释为比其它实施例或设计方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。在不冲突的情况下,下述的实施例及实施例中的特征可以相互组合。
为了便于理解,示例性的给出了部分与本申请实施例相关概念的说明以供参考。
操作系统(Operating System,OS):管理计算机硬件与软件资源的程序,是计算机系统的内核与基石。
内核:建立了计算机软件与硬件之间通讯的平台,内核提供系统服务,比如文件管理、虚拟内存、设备输入/输出(Input/Output,I/O)等。
进程(Process):是计算机中的程序关于某数据集合上的一次运行活动,是系统进行资源分配和调度的基本单位,是操作系统结构的基础。进程是程序的基本执行实体;在当代面向线程设计的计算机结构中,进程是线程的容器。程序是指令、数据及其组织形式的描述,进程是程序的实体。可以把一个进程看成是一个独立的程序,在内存中有其完备的数据空间和代码空间。一个进程所拥有的数据和变量只属于它自己。
线程:是进程中执行运算的最小单位,亦即执行处理机调度的基本单位。如果把进程理解为在逻辑上操作系统所完成的任务,那么线程表示完成该任务的许多可能的子任务之一。也就是说,线程存在于进程之中。一个进程由一个或多个线程构成,各线程共享相同的代码和全局数据。
任务(task):包括用户对计算机操作时的各个动作及所对应的响应事件(如鼠标单击、右击、打开一个对话框、关闭一个文件、启动一个程序等),任务是一个一般性的术语,指由软件完成的一个活动。在本申请实施例中,一个任务既可以是一个进程,也可以是一个线程。简而言之,它指的是一系列共同达到某一目的的操作。例如,读取数据并将数据放入内存中。这个任务可以作为一个进程来实现,也可以作为一个线程(或作为一个中断任务)来实现。
提升(Boost):CPU(central processing unit,中央处理器)性能和频率提升阶段。
电子设备可以通过通信网络与其他电子设备或服务器进行通信。本申请实施例应用的电子设备可以是通信设备,例如可以是服务器、或者终端设备。终端设备可以包括手机、可折叠电子设备、平板电脑、个人电脑(personal computer,PC)、膝上型计算机、手持计算机、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本、蜂窝电话、个人数字助理(personal digital assistant,PDA)、增强现实(augmented reality,AR)设备、虚拟现实(virtual reality,VR)设备、人工智能(artificial intelligence,AI)设备、可穿戴式设备、车载设备、智能家居设备、及智慧城市设备中的至少一种,本申请实施例对电子设备的具体类型不作特殊限制。通信网络可以是有线网络,也可以是无线网络。例如,通信网络可以是局域网(local area networks,LAN),也可以是广域网(wide area networks,WAN),例如互联网。当该通信网络为局域 网时,示例性的,该通信网络可以是无线保真(wireless fidelity,Wi-Fi)热点网络、Wi-Fi P2P网络、蓝牙网络、zigbee网络或近场通信(near field communication,NFC)网络等近距离通信网络。当该通信网络为广域网时,示例性的,该通信网络可以是第三代移动通信技术(3rd-generation wireless telephone technology,3G)网络、第四代移动通信技术(the4th generation mobile communication technology,4G)网络、第五代移动通信技术(5th-generation mobile communication technology,5G)网络、未来演进的公共陆地移动网络(public land mobile network,PLMN)或因特网等。
在一些实施例中,电子设备可以安装一个或多个APP(Application)。APP可以简称应用,为能够实现某项或多项特定功能的软件程序。例如,即时通讯类应用、视频类应用、音频类应用、图像拍摄类应用、云桌面类应用等等。其中,即时通信类应用,例如可以包括短信应用、WhatsApp照片分享Kakao等。图像拍摄类应用,例如可以包括相机应用(系统相机或第三方相机应用)。视频类应用,例如可以包括 等等。音频类应用,例如可以包括 等等。以下实施例中提到的应用,可以是电子设备出厂时已安装的系统应用,也可以是用户在使用电子设备的过程中从网络下载或其他电子设备获取的第三方应用。
电子设备包括但不限于搭载Windows 或其他操作系统。
图1示意了一种电子设备10的结构示意图。
电子设备10可以包括处理器110,外部存储器接口120,内部存储器121,天线1,天线2,移动通信模块130,无线通信模块140,音频模块150,传感器模块160,摄像模组170,显示屏180等。
可以理解的是,本申请实施例示意的结构并不构成对电子设备10的具体限定。在本申请另一些实施例中,电子设备10可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。
处理器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器可以为高速缓冲存储器。该存储器可以保存处理器110用过或使用频率较高的指令或数据。如果处理器110需要使用该指令或数据,可从该存储器中直接调用,避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。处理器110可以通过以上至少一种接口连接音频模块、无线通信模块、显示器、摄像头等模块。
可以理解的是,本申请实施例示意的各模块间的接口连接关系,只是示意性说明, 并不构成对电子设备10的结构限定。在本申请另一些实施例中,电子设备10也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。
电子设备10的无线通信功能可以通过天线1,天线2,移动通信模块130,无线通信模块140,调制解调处理器以及基带处理器等实现。
天线1和天线2用于发射和接收电磁波信号。电子设备10中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。
移动通信模块130可以提供应用在电子设备10上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块130可以包括至少一个滤波器,开关,功率放大器,低噪声放大器等。移动通信模块130可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块130还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块130的至少部分功能模块可以被设置于处理器110中。在一些实施例中,移动通信模块130的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频模块输出声音信号,或通过显示屏180显示图像或视频。在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块130或其他功能模块设置在同一个器件中。
无线通信模块140可以提供应用在电子设备10上的包括无线局域网(wireless local area networks,WLAN),蓝牙(bluetooth,BT),蓝牙低功耗(bluetooth low energy,BLE),超宽带(ultra wide band,UWB),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),NFC,红外技术(infrared,IR)等无线通信的解决方案。无线通信模块140可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块140经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块140还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。
在一些实施例中,电子设备10的天线1和移动通信模块130耦合,天线2和无线通信模块140耦合,使得电子设备10可以通过无线通信技术与网络和其他电子设备通信。该无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。该GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。
电子设备10可以通过GPU,显示屏180,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏180和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。
传感器模组包括触摸传感器、压力传感器、指纹传感器等。摄像模组170包括摄像 头。显示屏180用于显示图像,视频等。显示屏180包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一些实施例中,电子设备10可以包括1个或多个显示屏180。
电子设备10可以通过摄像模组170,ISP,视频编解码器,GPU,显示屏180以及应用处理器AP、神经网络处理器NPU等实现摄像功能。
数字信号处理器用于处理数字信号,还可以处理其他数字信号。例如,当电子设备10在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。
视频编解码器用于对数字视频压缩或解压缩。电子设备10可以支持一种或多种视频编解码器。这样,电子设备10可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备10的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备10的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。或将音乐,视频等文件从电子设备传输至外部存储卡中。
内部存储器121可以用于存储计算机可执行程序代码,该可执行程序代码包括指令。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储电子设备10使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。处理器110通过运行存储在内部存储器121的指令,和/或存储在设置于处理器中的存储器的指令,执行电子设备10的各种功能方法或数据处理。
音频模块150用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块150还可以用于对音频信号编码和解码。在一些实施例中,音频模块150可以设置于处理器110中,或将音频模块150的部分功能模块设置于处理器110中。
电子设备10的软件系统可以采用分层架构,事件驱动架构,微核架构,微服务架构,或云架构。本申请实施例以分层架构的Android系统为例,示例性说明电子设备10的软件结构。
图2是本申请实施例的电子设备10的软件结构框图。
分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android系统分为五层,从上至下分别为应用程序层,应用程序框架层,安卓运行时(Android runtime,ART)和原生C/C++库,硬件抽象层(Hardware Abstract Layer,HAL)以及内核层。
应用程序层可以包括一系列应用程序包。
如图2所示,应用程序包可以包括相机,图库,日历,通话,地图,导航,WLAN,蓝牙,音乐,视频,短信息等应用程序。
应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。
如图2所示,应用程序框架层可以包括窗口管理器,内容提供器,视图系统,资源 管理器,通知管理器,活动管理器,输入管理器等。
窗口管理器提供窗口管理服务(Window Manager Service,WMS),WMS可以用于窗口管理、窗口动画管理、surface管理以及作为输入系统的中转站。
内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。该数据可以包括视频,图像,音频,拨打和接听的电话,浏览历史和书签,电话簿等。
视图系统包括可视控件,例如显示文字的控件,显示图片的控件等。视图系统可用于构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。
资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。
通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于告知下载完成,消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在系统顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话窗口形式出现在屏幕上的通知。例如在状态栏提示文本信息,发出提示音,电子设备振动,指示灯闪烁等。
活动管理器可以提供活动管理服务(Activity Manager Service,AMS),AMS可以用于系统组件(例如活动、服务、内容提供者、广播接收器)的启动、切换、调度以及应用进程的管理和调度工作。
输入管理器可以提供输入管理服务(Input Manager Service,IMS),IMS可以用于管理系统的输入,例如触摸屏输入、按键输入、传感器输入等。IMS从输入设备节点取出事件,通过和WMS的交互,将事件分配至合适的窗口。
安卓运行时包括核心库和安卓运行时。安卓运行时负责将源代码转换为机器码。安卓运行时主要包括采用提前(ahead or time,AOT)编译技术和及时(just in time,JIT)编译技术。
核心库主要用于提供基本的Java类库的功能,例如基础数据结构、数学、IO、工具、数据库、网络等库。核心库为用户进行安卓应用开发提供了API。
原生C/C++库可以包括多个功能模块。例如:表面管理器(surface manager),媒体框架(Media Framework),libc,OpenGL ES、SQLite、Webkit等。
其中,表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D和3D图层的融合。媒体框架支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。OpenGL ES提供应用程序中2D图形和3D图形的绘制和操作。SQLite为电子设备10的应用程序提供轻量级关系型数据库。
硬件抽象层运行于用户空间(user space),对内核层驱动进行封装,向上层提供调用接口。
内核层是硬件和软件之间的层。内核层至少包含显示驱动,摄像头驱动,音频驱动,传感器驱动。
随着智能电子设备如智能手机、个人电脑等的配置越来越高,用户对智能电子设备的性能要求也越来越高,尤其在人机交互较为频繁、视觉感知较为明显的前台场景,例如启动应用程序、指纹识别、点亮显示屏等场景,应用程序启动快、指纹识别速度快、显示屏快速亮屏可以给用户带来更好的性能体验。然而,在人机交互的过程中,系统除了执行前台进程的任务,还需要执行后台进程产生的任务,若后台进程产生的任务的数量过多,或者包括高负载任务,会占用大量的系统资源,如CPU资源、存储资源等,导致给前台产生的任务所分配的系统资源不足,造成系统卡顿,从而影响用户体验。
为了更好地理解本申请实施例提供的任务调度方法,下面结合图3A-3D示例性的介绍本申请实施例提供的任务调度方法的应用场景示意图。
电子设备10可以安装有操作系统及应用程序,应用程序可以是指提供业务服务或 者面向用户的程序,应用程序也可以是其他类型的程序,本申请对此不作限定。例如,电子设备10为服务器,应用程序可以是指服务器安装的业务程序,电子设备10为手机,应用程序可以是指手机安装的APP。当电子设备接收到用户的输入操作时,响应输入操作的应用线程为前台应用线程,用于执行前台任务,例如,用户开启一个应用程序,应用程序的开启任务为前台任务。在接收到输入操作之前的应用线程为后台应用线程,用于执行后台任务,例如,在后台运行的应用程序界面的刷新为后台任务。
参阅图3A所示,在电子设备接收到用户的输入操作后,响应于输入操作,建立前台应用线程,用于执行前台任务。在阶段1,前台应用程序产生任务,前台应用线程执行任务,此时后台应用线程处于闲置状态。在阶段2,后台应用程序产生任务,后台应用线程执行任务,此时,由于系统资源有限,前台应用线程被后台应用线程阻塞,前台应用程序产生任务后,前台应用线程无法及时对任务进行执行,如此,可能导致系统产生卡顿,无法及时响应用户操作,从而影响用户体验。
参阅图3B所示,应用程序在产生任务后,应用线程需要依赖于系统服务对任务进行协同处理。例如,界面刷新任务的执行需要窗口管理服务(WindowManagerService)和绘制渲染服务(SurfaceFlinger)参与,运动健康类型应用程序的数据采集任务依赖于传感器管理服务(SensorManagerService)。在电子设备接收到用户的输入操作后,响应于输入操作,建立前台应用线程,用于执行前台任务。在阶段1,前台应用程序产生任务,前台应用线程与系统服务线程协同执行任务,此时后台应用线程处于闲置状态。在阶段2,后台应用程序产生任务,后台应用线程执行任务,此时,由于系统资源有限,系统服务线程被后台应用线程阻塞,前台应用程序产生任务后,前台应用线程无法与系统服务线程协同对任务进行执行,如此,可能导致系统产生卡顿,从而影响用户体验。
参阅图3C所示,为避免后台任务的执行占用系统资源而导致前台任务得不到及时处理,可以给第三方应用程序设置执行后台任务的时间,例如,给每个第三方应用程序配额600秒用于执行后台任务,如此第三方应用程序处理后台任务的配额时间有限,可以减少后台处理任务(例如非可感知任务)的时间,从而降低前台应用线程被阻塞的概率,缓解前台应用线程被阻塞的现象。然而,后台任务的执行仍可能与前台应用线程执行任务相冲突,并且,限制后台任务执行的时间,限定了后台应用的行为,可能导致部分后台任务无法及时处理,让后台应用发挥空间受限,难以满足用户需求,从而影响用户体验。
参阅图3D所示,为避免后台下载和上传任务的执行占用系统资源而导致前台任务得不到及时处理,可以将下载和上传任务通过代理进程统一执行,从而减少后台应用线程对系统资源的占用,然而,代理进程本身的后台任务缺乏管控,仍然随意执行,从而影响前台任务的正常执行,可能导致系统产生卡顿,从而影响用户体验。
为了避免后台任务对系统资源的占用率过高,导致前台任务占用的系统资源不足,从而造成系统卡顿,影响用户体验,本申请实施例提供一种任务调度方法。下面结合图4示例性地介绍本申请一实施例提供的任务调度方法的流程示意图。所述方法应用于电子设备中,所述任务调度方法包括:
S11,在应用进程产生任务时,判断任务是否为非紧急任务。
在本申请的一实施例中,判断任务是否为非紧急任务的细化流程如图5所示,具体包括:
S111,在应用进程产生任务时,判断应用进程是否为后台应用进程。
在本申请的一实施例中,应用进程预设有importance属性,前台应用进程和后台应用进程分别包括多个预设importance属性。判断应用进程是否为后台应用进程包括:通过RunningProcess程序获取应用进程的importance属性,判断应用进程的importance属性是否为后台应用进程的预设属性之一,若应用进程的importance属性为后台应用进程的预设属性之一,确定应用进程为后台应用进程。
在本申请的另一实施例中,判断应用进程是否为后台应用进程包括:通过 ActivityLifecycleCallbacks程序调取应用进程的活动(Activity),判断应用进程的活动是否在后台运行,若应用进程的活动在后台运行,确定应用进程为后台应用进程。
在本申请的另一实施例中,判断应用进程是否为后台应用进程包括:通过UsageStatsManager程序调取前台应用进程,判断调取的前台应用进程是否包含所述应用进程,若调取的前台应用进程不包含所述应用进程,确定所述应用进程为后台应用进程。
S112,若应用进程为后台应用进程,确定任务为非紧急任务。
在本申请的一实施例中,若确定任务为非紧急任务,流程进入S12;若确定任务不是非紧急任务,流程继续S11。
在本申请的另一实施例中,判断任务是否为非紧急任务的细化流程如图6所示,具体包括:
S113,在应用进程产生任务时,判断应用进程是否为后台应用进程,以及判断任务是否到期。
在本申请的一实施例中,应用进程产生的每个任务具有预期处理时间,预期处理时间为任务期望被执行的时间,预期处理时间的基准为从电子设备开机后开始计时的以毫秒(ms)为单位的时间。例如,若任务task1的预期处理时间为100ms,即,任务task1的预期处理时间为电子设备开机后的第100ms。
在本申请的一实施例中,判断任务是否已到期包括:判断电子设备开机后的计时时间是否超过所述任务的预期处理时间,若电子设备开机后的计时时间超过所述任务的预期处理时间,确定任务已到期;若电子设备开机后的计时时间未超过所述任务的预期处理时间,确定任务未到期。
例如,若电子设备开机后的计时时间为120ms,任务的预期处理时间为130ms,则电子设备开机后的计时时间未超过所述任务的预期处理时间,确定任务未到期。再例如,若电子设备开机后的计时时间为150ms,任务的预期处理时间为130ms,则电子设备开机后的计时时间超过所述任务的预期处理时间,确定任务已到期。
S114,若应用进程为后台应用进程且任务未到期,确定任务为非紧急任务。
在本申请的另一实施例中,判断任务是否为非紧急任务的细化流程如图7所示,具体包括:
S115,在应用进程产生任务时,判断应用进程是否为后台应用进程,以及判断任务是否为高负载任务。
在本申请的所述另一实施例中,内核层记录有电子设备系统执行过的所有任务的历史负载信息,所述负载信息包括执行任务过程中的最高负载及/或平均负载,所述负载可以包括,但不限于如下的一种或多种:CPU占用率、内存占用率或压力停顿信息(Pressure Stall Information,PSI)。PSI程序是一种开源的用于评估系统资源压力的程序,PSI用于表示由于资源压力造成的任务执行停顿时间,量化了由于硬件资源紧张造成的任务执行中断,统计了系统中任务等待硬件资源的时间。通过将PSI作为指标来衡量硬件资源的压力情况,停顿的时间越长,说明资源压力越大。其中,硬件资源可以包括CPU、内存及IO(Input/Output,输入输出)等资源。
在本申请的所述另一实施例中,判断任务是否为高负载任务包括:获取任务的关联信息,将任务的关联信息发送至内核层;通过内核层查询任务的历史负载信息,判断任务的历史负载信息是否大于或等于负载阈值。若任务的历史负载信息大于或等于负载阈值,确定任务为高负载任务;若任务的历史负载信息小于负载阈值,确定任务不是高负载任务。例如,若负载信息为CPU使用率,负载阈值可以是20%,若负载信息为内存使用率,负载阈值可以是20%,若负载信息为PSI,负载阈值可以是0.1秒。
在本申请的另一实施例中,判断任务是否为高负载任务包括:获取任务的关联信息,将任务的关联信息发送至内核层;通过内核层查询任务是否为系统执行过的任务,若所述任务为系统执行过的任务,查询任务的历史负载信息,判断任务的历史负载信息 是否大于或等于负载阈值,若任务的负载信息大于或等于负载阈值,确定任务为高负载任务,若任务的负载信息小于负载阈值,确定任务不是高负载任务。若所述任务为系统未执行过的任务,确定所述任务不是高负载任务。
在其他实施例中,若所述任务为系统未执行过的任务,内核层查询与所述任务类型相同的任务,并查询所述类型相同的任务的历史负载信息,判断类型相同的任务的历史负载信息是否大于或等于负载阈值,若类型相同的任务的历史负载信息大于或等于负载阈值,确定所述任务为高负载任务,若类型相同的任务的历史负载信息小于负载阈值,确定所述任务不是高负载任务。
在本申请的另一实施例中,判断任务是否为高负载任务包括:获取任务的关联信息,判断所述任务是否具有高负载任务标记,若所述任务具有高负载任务标记,确定所述任务为高负载任务,若所述任务不具有高负载任务标记,确定所述任务不是高负载任务。
在本申请的所述另一实施例中,通过给任务添加高负载任务标记,从而将所述任务标记为高负载任务。具体地,监控每个任务在执行过程中的负载信息,若一任务在第一预设时间段内被执行时的负载信息大于或等于负载阈值的次数大于或等于预设次数,给所述任务添加高负载任务标记,从而将所述任务标记为高负载任务。若具有高负载任务标记的任务在第二预设时间段内被执行时的负载信息大于或等于负载阈值的次数小于预设次数,取消所述任务的高负载任务标记。可选地,第一预设时间段为一周,第二预设时间段为一个月,预设次数为10。
S116,若应用进程为后台应用进程且任务为高负载任务,确定任务为非紧急任务。
S12,若任务为非紧急任务,获取CPU的频率和负载。
在本申请的一实施例中,通过获取CPU频点获取CPU频率,频点为固定频率的编号,负载为CPU占用率。需要说明的是,电子设备的CPU预设有多个频点,每个频点对应一个频率,CPU可以在各个频点对应的频率下工作。例如,CPU预设有三个频点,频点1对应的频率为3.13GHz,频点2对应的频率为2.54GHz,频点3对应的频率为2.04GHz,则CPU可以在3.13GHz、2.54GHz或2.04GHz的频率下工作。
在本申请的一实施例中,根据需求,CPU的核心可以包括大核和小核,或者大核、中核和小核,大核、中核和小核的性能依次降低,对于需要快速响应或用户可感知的任务(例如界面刷新任务)可以采用CPU大核进行处理,对于不需要快速响应或用户不可感知的任务(例如下载、上传任务)可以采用CPU中核或小核进行处理。
在本申请的一实施例中,获取CPU的频率和负载包括:通过系统的资源调度服务进程获取当前的CPU小核频率和CPU小核整体的负载。可以理解,为避免非紧急任务占用过多的CPU资源,导致CPU无法及时处理关键任务,通过CPU小核对非紧急任务进行处理,如此,只需要获取CPU小核的频率和负载。在其他实施例中,根据需要,也可以通过CPU大核或中核处理非紧急任务,如此,可以通过系统的资源调度服务进程获取CPU大核或中核的频率和负载。
S13,基于CPU的频率和负载确定CPU的归一化频率。
在本申请的一实施例中,归一化频率为CPU负载100%时对应的频率。电子设备预先存储有CPU能效比表格,所述CPU能效比表格记录有CPU的频率、功耗及性能分数之间的对应关系,CPU能效比由电子设备的系统侧提供。参阅图8所示,为本申请实施例提供的CPU能效比表格的示意图。例如,CPU频率为884MHz时对应的功耗为30.68mW,性能分数为339.15分。
在本申请的一实施例中,CPU能效比为CPU的性能分数与功耗之间的比值,或者,为CPU的频率与功耗之间的比值。基于CPU的频率和负载确定CPU的归一化频率包括:通过查询CPU的能效比表格确定CPU的当前频率对应的性能分数,根据当前频率对应的性能分数和当前负载确定负载100%时的性能分数,通过查询CPU的能效比表格确定负载100%时的性能分数对应的频率,从而得到CPU当前的归一化频率。例如, 若CPU的当前频率为960MHz,当前负载为50%,通过查询能效比表格得到当前频率对应的性能分数为367.10分,CPU的负载从50%增加到100%时,性能分数可以等比例降低,因此,负载为100%时,CPU的性能分数为367.10/2分=183.55分,通过查询CPU的能效比表格确定性能分数183.55分对应的频率为412MHz,即,CPU当前的归一化频率为412MHz。
S14,判断归一化频率是否小于或等于预设频率。
可选地,预设频率为0.5GHz。通过判断归一化频率是否小于或等于预设频率来判断当前系统状态是否允许执行非紧急任务,若归一化频率小于或等于预设频率,说明当前的系统状态较为空闲,确定当前系统状态允许执行非紧急任务。若归一化频率大于预设频率,说明当前的系统状态较为繁忙,确定当前系统状态不允许执行非紧急任务。
在本申请的一实施例中,所述方法还包括:判断归一化频率连续大于预设频率的次数是否大于或等于第二预设值,若归一化频率连续大于预设频率的次数大于或等于第二预设值,提高所述预设频率。可选地,第二预设值为5。可以理解,若归一化频率连续大于预设频率的次数大于或等于第二预设值,说明预设频率可能设置得过小,从而将所述预设频率提高一档,使得CPU当前的归一化频率更容易满足条件,系统状态更容易允许执行非紧急任务,使得非紧急任务可以在必要时得到处理。
在本申请的一实施例中,可以根据预设调整幅度或者与不同频率对应的档位,对所述预设频率进行调整。例如,预设调整幅度或一个档位可以是0.1GHz。若预设频率为0.5GHz,第二预设值为5,当归一化频率连续大于0.5GHz的次数大于或等于5,将所述预设频率提高一档,将预设频率0.5GHz提高0.1GHz至0.6GHz。
S15,若归一化频率小于或等于预设频率,判断电子设备是否处于休眠状态。
在本申请的一实施例中,判断电子设备是否处于休眠状态包括:判断显示屏是否灭屏(熄屏),若显示屏灭屏,确定电子设备处于休眠状态,若显示屏亮屏,确定电子设备未处于休眠状态。
在本申请的一实施例中,判断显示屏是否灭屏包括:判断显示屏的亮度是否为0,若显示屏的亮度不为0,确定显示屏亮屏,若显示屏的亮度为0,确定显示屏灭屏。
在本申请的另一实施例中,判断电子设备是否处于休眠状态包括:判断显示屏是否灭屏,以及判断电子设备是否处于分布式场景,若显示屏灭屏且电子设备未处于分布式场景,确定电子设备处于休眠状态,若显示屏亮屏及/或电子设备处于分布式场景,确定电子设备未处于休眠状态。
在本申请的所述另一实施例中,判断电子设备是否处于分布式场景包括:判断电子设备是否与至少一终端设备处于协同工作模式,若电子设备与至少一终端设备处于协同工作模式,确定电子设备处于分布式场景,若电子设备未与至少一终端设备处于协同工作模式,确定电子设备未处于分布式场景。其中,协同工作模式可以是多屏协同工作模式,电子设备处于运行状态,但界面内容由与电子设备通信连接的其他终端设备显示。例如,电子设备在接收到语音通话时,语音交互由与电子设备通信连接的平板电脑执行,此时电子设备本身灭屏,但仍需要处于运行状态,将语音传输至受话端。
S16,若电子设备处于休眠状态,通过调整CPU频率使得CPU负载为第一预设值,符合CPU的最优能效比,并执行所述非紧急任务。可选地,第一预设值为90%。
在本申请的一实施例中,若电子设备处于休眠状态,说明电子设备处于空闲状态,可以执行非紧急任务。在执行非紧急任务之前,通过调整CPU频率使得CPU负载为第一预设值。
在本申请的一实施例中,通过调整CPU频率使得CPU负载为第一预设值,符合所述CPU的最优能效比包括:将待调整的CPU频率值写入内核节点,以调整CPU频率,直至CPU负载调整为第一预设值,并使得CPU频率符合CPU的最优能效比。在本申请的一实施例中,最优能效比可以是最高能效比,是通过CPU能效比表格确定的最高能效比,也可以是预先设置的最高能效比。所述第一预设值可以是预设的可以使得CPU频率 符合最优能效比的百分比数值。
具体地,通过降低CPU频率使得CPU负载为第一预设值,使得CPU频率符合CPU的最优能效比。即,将降低的CPU频率值写入内核节点,以降低CPU频率,直至CPU负载调整为第一预设值,并使得CPU频率符合CPU的最优能效比。可以理解,若CPU频率降低,在处理相同的任务时,CPU负载需要提高,但是CPU频率降低可以降低CPU功耗,从而提高能效比。
在本申请的另一实施例中,通过调整CPU频率使得CPU负载为第一预设值包括:将待调整的CPU频点写入内核节点,以调整CPU频率,直至CPU负载调整为第一预设值。具体地,将降低的CPU频点写入内核节点,以降低CPU频率,直至CPU负载调整为第一预设值,并使得CPU频率符合CPU的最优能效比。
在本申请的一实施例中,所述方法还包括:若CPU负载调整为第一预设值,判断CPU的能效比是否为最优能效比,若CPU的能效比为最优能效比,在CPU负载为第一预设值时执行所述非紧急任务;若CPU的能效比不是最优能效比,继续调整CPU频率,直至CPU的能效比为最优能效比。
在本申请的另一实施例中,所述方法还包括:若CPU负载调整为第一预设值,判断CPU的能效比与最优能效比之间的差值是否小于或等于第三预设值,若CPU的能效比与最优能效比之间的差值小于或等于第三预设值,在CPU负载为第一预设值时执行所述非紧急任务;若CPU的能效比与最优能效比之间的差值大于第三预设值,继续调整CPU频率,直至CPU的能效比与最优能效比之间的差值小于或等于第三预设值。
参阅图9所示,为本申请另一实施例提供的任务调度方法的流程示意图。所述方法应用于电子设备中,所述任务调度方法包括:
S21,在应用进程产生任务时,判断任务是否为非紧急任务。
S22,若所述任务为非紧急任务,获取CPU的频率和负载。
S23,基于CPU的频率和负载确定CPU的归一化频率。
S24,判断归一化频率是否小于或等于预设频率。
S25,若归一化频率小于或等于预设频率,判断电子设备是否处于休眠状态。
S26,若电子设备处于休眠状态,将所述非紧急任务设置为第一优先级。
S27,若电子设备未处于休眠状态,将所述非紧急任务设置为第二优先级。
在本申请的一实施例中,第一优先级高于第二优先级,例如第一优先级为高优先级,第二优先级为低优先级。电子设备可以预设高优先级任务池和低优先级任务池,若电子设备处于休眠状态,将非紧急任务加入高优先级任务池,高优先级任务池中的非紧急任务根据加入的时间先后顺序进行执行。若电子设备未处于休眠状态,将非紧急任务加入低优先级任务池,低优先级任务池中的非紧急任务需要在高优先级任务池中的任务执行完成后,再根据加入低优先级任务池的时间先后顺序进行执行。
S29,通过调整CPU频率使得CPU负载为第一预设值,符合CPU的最优能效比,并执行所述非紧急任务。可选地,第一预设值为90%。
在本申请的另一实施例中,可以基于完全公平调度(Completely Fair Schedule,CFS)算法计算不同优先级的非紧急任务的实际运行时间runtime和虚拟运行时间virtual runtime(vruntime),并基于对应的实际运行时间和虚拟运行时间对不同优先级的非紧急任务进行处理。
在本申请的所述另一实施例中,基于完全公平调度算法计算不同优先级的非紧急任务的实际运行时间和虚拟运行时间,并基于对应的实际运行时间和虚拟运行时间对不同优先级的非紧急任务进行处理包括:根据非紧急任务的优先级确定非紧急任务的优先值,任务的优先值和权重之间具有一一对应的关系,根据优先值确定非紧急任务的权重,根据非紧急任务的权重和CPU的调度周期确定非紧急任务的实际运行时间和虚拟运行时间,CPU的调度周期为对当前系统所有任务进行调度的时间,系统总是选择具有最小虚拟运行时间的非紧急任务,在对应的实际运行时间内对所述非紧急任务进行处理。
其中,实际运行时间runtime=CPU调度周期*任务权重/所有任务的权重之和,虚拟运行时间vruntime=实际运行时间*优先值0对应的权重/任务权重,优先值0对应的权重为1024。可选地,CPU的调度周期为6ms,优先值的取值范围为[-20,19],优先值越小代表优先级越高。
例如,系统当前包括两个待执行的任务A和B,任务A的优先值为0,其对应的权重为1024,任务B的优先值为1,其对应的权重为820,则任务A的实际运行时间RTA=6*1024/(1024+820)=3.3ms,任务A的虚拟运行时间VRTA=3.3*1024/1024=3.3ms,任务B的实际运行时间RTB=6x820/(1024+820)=2.7ms,任务B的虚拟运行时间VRTB=2.4*1024/820=3ms。由此可见,相较于任务A,任务B的优先级较高,虚拟运行时间较小,可以被系统优先选择进行处理。如此,基于完全公平调度算法,高优先级的任务可以得到优先处理。
参阅图10所示,为本申请另一实施例提供的任务调度方法的流程示意图。所述方法应用于电子设备中,所述任务调度方法包括:
S31,在应用进程产生任务时,判断任务是否为非紧急任务。
S32,若所述任务为非紧急任务,获取CPU的频率和负载。
S33,基于CPU的频率和负载确定CPU的归一化频率。
S34,判断归一化频率是否小于或等于预设频率。
S35,若归一化频率小于或等于预设频率,判断电子设备是否处于休眠状态。
S36,若电子设备处于休眠状态,将所述非紧急任务设置为第一优先级。
S37,若电子设备未处于休眠状态,判断系统是否处于提升(Boost)状态。
在本申请的一实施例中,判断系统是否处于提升状态包括:判断系统是否正在响应用户的输入操作,若系统正在响应用户的输入操作,确定系统处于提升状态,若系统不在响应用户的输入操作,确定系统未处于提升状态。
可以理解的是,输入操作是否可以得到快速响应是影响用户体验的关键因素之一,若系统接收到用户的输入操作,可以进入提升状态,以提升系统性能,从而快速响应用户的输入操作。
S38,若系统未处于提升状态,将所述非紧急任务设置为第二优先级。
S39,若系统处于提升状态,将所述非紧急任务设置为第三优先级。
在本申请的一实施例中,第三优先级低于第二优先级,例如第三优先级为限制优先级。电子设备还预设有限制优先级任务池,若系统处于提升状态,将非紧急任务加入限制优先级任务池,限制优先级任务池中的非紧急任务需要在低优先级任务池中的任务执行完成后,再根据加入限制优先级任务池的时间先后顺序进行执行。在本申请的另一实施例中,也可以基于完全公平调度算法对第三优先级的非紧急任务进行处理。
S40,通过调整CPU频率使得CPU负载为第一预设值,符合CPU的最优能效比,并执行所述非紧急任务。可选地,第一预设值为90%。
参阅图11所示,为本申请另一实施例提供的任务调度方法的流程示意图。所述方法应用于电子设备中,所述任务调度方法包括:
S401,检测到后台任务。
S402,读取CPU的当前频点和负载。
S403,根据能效比转换计算出CPU占用率100%时对应的频点。
S404,判断归一化频点是否小于或等于预设频率。若归一化频点小于或等于预设频率,说明允许后台活动,流程进入S405;若N次不满足条件,流程进入S411。
S405,判断电子设备是否亮屏。若电子设备灭屏且处于非分布式场景,流程进入S406;若电子设备亮屏或处于非分布式场景,流程进入S407。
S406,将后台任务的优先级设为高优先级(prioHigh)。
S407,判断系统是否处于提升状态。若系统未处于提升状态,流程进入S408;若系统处于提升状态,流程进入S409。
S408,将后台任务的优先级设为低优先级(prioLow)。
S409,将后台任务的优先级设为限制优先级(prioLimit)。
S410,设置后台任务的优先级后,在执行后台任务时,调整CPU频点,使得CPU占用率维持在90%或调整CPU频点至符合CPU最优能效比。
S411,将预设频率提升一个档位,并返回S402,继续读取CPU的当前频点和负载。
本申请实施例包括:当后台任务需要运行时,系统的资源调度服务进程可以读取当前的小核CPU频点和小核整体的负载;通过频点和负载计算出归一化频点,即根据芯片能效比表格,计算出CPU 100%负载时所对应的CPU频点;之后根据归一化频点判定当前系统状态是否允许后台任务运行;如果判断满足活动条件(例如,当前系统状态允许后台任务运行),可以允许后台活动,进一步判断当前系统是否接收到用户操作,如果未接收到用户操作,则提高线程调度优先级,并且降低频点,直到该任务运行的CPU整体占用率在90%左右;而如果当前是用户操作阶段,此时尽量降低后台任务优先级,也尽量调整频点让CPU占用率在90%左右运行,以达到当前系统状态下的最优能效比频点。
本申请实施例将非紧急的后台任务,进行特殊化调度,与前台操作类任务区分开,以减少对前台操作的影响,并对非紧急的后台任务,合理安排时间执行,并且在CPU处于相对高能效比的频点执行,以降低系统功耗,提升电子设备的续航。例如,参阅图12所示,非紧急任务可以在系统无操作的状态下执行。应用本申请实施前提供的任务调度方法,后台进行资源下载、上传、应用更新、图库训练、照片后台美颜优化、视频压缩等场景下,再操作前台刷微博、微信、抖音、浏览新闻等,可以有效减少系统卡顿、降低系统功耗、提高用户响应度。
本申请实施例还提供一种计算机存储介质,该计算机存储介质中存储有计算机指令,当该计算机指令在电子设备上运行时,使得电子设备执行上述相关方法实现上述实施例中的任务调度方法。
本申请实施例还提供了一种计算机程序产品,当该计算机程序产品在计算机上运行时,使得计算机执行上述实施例中的任务调度方法。
另外,本申请的实施例还提供一种装置,这个装置具体可以是芯片,组件或模块,该装置可包括相连的处理器和存储器;其中,存储器用于存储计算机执行指令,当装置运行时,处理器可执行存储器存储的计算机执行指令,以使芯片执行上述各方法实施例中的任务调度方法。
其中,本申请实施例提供的电子设备、计算机存储介质、计算机程序产品或芯片均用于执行上文所提供的对应的方法,因此,其所能达到的有益效果可参考上文所提供的对应的方法中的有益效果,此处不再赘述。
通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例是示意性的,例如,该模块或单元的划分,为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个装置,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
该作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是一个物理单元或多个物理单元,即可以位于一个地方,或者也可以分布到多个不同地方。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的 目的。
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
该集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该软件产品存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
最后应说明的是,以上实施例仅用以说明本申请的技术方案而非限制,尽管参照较佳实施例对本申请进行了详细说明,本领域的普通技术人员应当理解,可以对本申请的技术方案进行修改或等同替换,而不脱离本申请技术方案的精神和范围。

Claims (21)

  1. 一种任务调度方法,其特征在于,所述任务调度方法包括:
    在应用进程产生任务时,判断所述任务是否为非紧急任务;
    若所述任务为非紧急任务,获取电子设备的中央处理器CPU的频率和负载;
    基于所述CPU的频率和负载确定所述CPU的归一化频率,所述归一化频率为所述CPU负载100%时对应的频率;
    判断所述归一化频率是否小于或等于预设频率;
    若所述归一化频率小于或等于所述预设频率,判断所述电子设备是否处于休眠状态;
    若所述电子设备处于休眠状态,通过调整所述CPU的频率使得所述CPU的负载为第一预设值,符合所述CPU的最优能效比,并执行所述非紧急任务。
  2. 如权利要求1所述的任务调度方法,其特征在于,所述判断任务是否为非紧急任务包括:
    在所述应用进程产生任务时,判断所述应用进程是否为后台应用进程;
    若所述应用进程为后台应用进程,确定所述任务为非紧急任务。
  3. 如权利要求2所述的任务调度方法,其特征在于,判断所述应用进程是否为后台应用进程包括:
    通过ActivityLifecycleCallbacks程序调取所述应用进程的活动,判断所述应用进程的活动是否在后台运行,若所述应用进程的活动在后台运行,确定所述应用进程为后台应用进程。
  4. 如权利要求2所述的任务调度方法,其特征在于,判断所述应用进程是否为后台应用进程包括:
    通过UsageStatsManager程序调取前台应用进程,判断调取的所述前台应用进程是否包含所述应用进程,若调取的前台应用进程不包含所述应用进程,确定所述应用进程为后台应用进程。
  5. 如权利要求2所述的任务调度方法,其特征在于,所述判断任务是否为非紧急任务包括:
    在所述应用进程产生任务时,判断所述应用进程是否为后台应用进程,以及判断所述任务是否到期;
    若所述应用进程为后台应用进程且所述任务未到期,确定所述任务为非紧急任务。
  6. 如权利要求2所述的任务调度方法,其特征在于,所述判断任务是否为非紧急任务包括:
    在所述应用进程产生任务时,判断所述应用进程是否为后台应用进程,以及判断所述任务是否为高负载任务;
    若所述应用进程为后台应用进程且所述任务为高负载任务,确定所述任务为非紧急任务。
  7. 如权利要求6所述的任务调度方法,其特征在于,判断任务是否为高负载任务包括:
    获取所述任务的关联信息,将所述任务的关联信息发送至内核层;
    通过所述内核层查询所述任务的历史负载信息,判断所述任务的历史负载信息是否大于或等于负载阈值;
    若所述任务的历史负载信息大于或等于负载阈值,确定任务为高负载任务;或
    若所述任务的历史负载信息小于负载阈值,确定任务不是高负载任务。
  8. 如权利要求1所述的任务调度方法,其特征在于,所述获取电子设备的中央处理器CPU的频率和负载包括:
    通过所述电子设备的资源调度服务进程获取当前的CPU小核频点和CPU小核整体 的负载。
  9. 如权利要求1所述的任务调度方法,其特征在于,所述电子设备预设有所述CPU的能效比表格,所述基于所述CPU的频率和负载确定CPU的归一化频率包括:
    通过查询所述能效比表格确定所述CPU的当前频率对应的性能分数;
    根据所述当前频率对应的性能分数和当前负载确定负载100%时的性能分数;
    通过查询所述能效比表格确定负载100%时的性能分数对应的频率,得到所述CPU当前的归一化频率。
  10. 如权利要求1所述的任务调度方法,其特征在于,所述方法还包括:
    判断所述归一化频率连续大于所述预设频率的次数是否大于或等于第二预设值;
    若所述归一化频率连续大于所述预设频率的次数大于或等于第二预设值,提高所述预设频率。
  11. 如权利要求1所述的任务调度方法,其特征在于,判断所述电子设备是否处于休眠状态包括:
    判断所述电子设备的显示屏是否灭屏;
    若所述显示屏灭屏,确定所述电子设备处于休眠状态;或
    若所述显示屏亮屏,确定所述电子设备未处于休眠状态。
  12. 如权利要求11所述的任务调度方法,其特征在于,所述判断所述电子设备是否处于休眠状态包括:
    判断所述电子设备的显示屏是否灭屏,以及判断所述电子设备是否处于分布式场景;
    若所述显示屏灭屏且所述电子设备未处于分布式场景,确定所述电子设备处于休眠状态;或
    若所述显示屏亮屏及/或所述电子设备处于分布式场景,确定所述电子设备未处于休眠状态。
  13. 如权利要求12所述的任务调度方法,其特征在于,所述判断所述电子设备是否处于分布式场景包括:
    判断所述电子设备是否与至少一终端设备处于协同工作模式;
    若所述电子设备与所述至少一终端设备处于协同工作模式,确定所述电子设备处于分布式场景;或
    若所述电子设备未与所述至少一终端设备处于协同工作模式,确定所述电子设备未处于分布式场景。
  14. 如权利要求1所述的任务调度方法,其特征在于,所述通过调整所述CPU的频率使得所述CPU的负载为第一预设值包括:
    将待调整的CPU频率值写入内核节点,以调整所述CPU的频率,直至所述CPU的负载为所述第一预设值。
  15. 如权利要求14所述的任务调度方法,其特征在于,所述方法还包括:
    若所述CPU的负载调整为所述第一预设值,判断所述CPU的能效比是否为最优能效比;
    若所述CPU的能效比为最优能效比,在所述CPU的负载为所述第一预设值时执行所述非紧急任务;或
    若所述CPU的能效比不是最优能效比,继续调整所述CPU的频率,直至所述CPU的能效比为最优能效比。
  16. 如权利要求14所述的任务调度方法,其特征在于,所述方法还包括:
    若所述CPU的负载调整为所述第一预设值,判断所述CPU的能效比与最优能效比之间的差值是否小于或等于第三预设值;
    若所述CPU的能效比与所述最优能效比之间的差值小于或等于所述第三预设值,在所述CPU的负载为所述第一预设值时执行所述非紧急任务;或
    若所述CPU的能效比与所述最优能效比之间的差值大于所述第三预设值,继续调整所述CPU的频率,直至所述CPU的能效比与最优能效比之间的差值小于或等于第三预设值。
  17. 如权利要求1所述的任务调度方法,其特征在于,所述方法还包括:
    若所述电子设备处于休眠状态,将所述非紧急任务设置为第一优先级;或
    若所述电子设备未处于休眠状态,将所述非紧急任务设置为第二优先级,所述第一优先级高于所述第二优先级。
  18. 如权利要求17所述的任务调度方法,其特征在于,所述方法还包括:
    若所述电子设备未处于休眠状态,判断所述电子设备的系统是否处于提升状态;
    若所述系统未处于提升状态,将所述非紧急任务设置为所述第二优先级;
    若所述系统处于提升状态,将所述非紧急任务设置为第三优先级,所述第一优先级高于所述第二优先级,所述第二优先级高于所述第三优先级。
  19. 一种计算机可读存储介质,其特征在于,包括计算机指令,当所述计算机指令在电子设备上运行时,使得所述电子设备执行如权利要求1至权利要求18中任一项所述的任务调度方法。
  20. 一种电子设备,其特征在于,所述电子设备包括处理器和存储器,所述存储器用于存储指令,所述处理器用于调用所述存储器中的指令,使得所述电子设备执行权利要求1至权利要求18中任一项所述的任务调度方法。
  21. 一种芯片,与电子设备中的存储器耦合,其特征在于,所述芯片用于控制所述电子设备执行权利要求1至权利要求18中任一项所述的任务调度方法。
PCT/CN2023/112509 2022-08-29 2023-08-11 任务调度方法及相关设备 WO2024046088A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211043554.0A CN117666755A (zh) 2022-08-29 2022-08-29 任务调度方法及相关设备
CN202211043554.0 2022-08-29

Publications (1)

Publication Number Publication Date
WO2024046088A1 true WO2024046088A1 (zh) 2024-03-07

Family

ID=90075714

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/112509 WO2024046088A1 (zh) 2022-08-29 2023-08-11 任务调度方法及相关设备

Country Status (2)

Country Link
CN (1) CN117666755A (zh)
WO (1) WO2024046088A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117931461A (zh) * 2024-03-25 2024-04-26 荣耀终端有限公司 一种计算资源的调度方法、策略网络的训练方法以及装置

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140019986A1 (en) * 2012-07-16 2014-01-16 Sony Pictures Technologies Inc. Managing multi-threaded operations in a multimedia authoring environment
US20150346800A1 (en) * 2014-05-30 2015-12-03 Apple Inc. Thermally adaptive quality-of-service
CN105190555A (zh) * 2013-02-15 2015-12-23 苹果公司 集中式任务调度
CN107391259A (zh) * 2017-07-25 2017-11-24 广东欧珀移动通信有限公司 资源处理方法和装置、计算机可读存储介质、移动终端
CN111104209A (zh) * 2019-11-25 2020-05-05 华为技术有限公司 一种处理任务的方法及相关设备
WO2022039744A1 (en) * 2020-08-20 2022-02-24 Hewlett-Packard Development Company, L.P. Temperature control of computing device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140019986A1 (en) * 2012-07-16 2014-01-16 Sony Pictures Technologies Inc. Managing multi-threaded operations in a multimedia authoring environment
CN105190555A (zh) * 2013-02-15 2015-12-23 苹果公司 集中式任务调度
US20150346800A1 (en) * 2014-05-30 2015-12-03 Apple Inc. Thermally adaptive quality-of-service
CN107391259A (zh) * 2017-07-25 2017-11-24 广东欧珀移动通信有限公司 资源处理方法和装置、计算机可读存储介质、移动终端
CN111104209A (zh) * 2019-11-25 2020-05-05 华为技术有限公司 一种处理任务的方法及相关设备
WO2022039744A1 (en) * 2020-08-20 2022-02-24 Hewlett-Packard Development Company, L.P. Temperature control of computing device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
EL SAYED MANAL A., SAAD EL SAYED M., ALY RASHA F., HABASHY SHAHIRA M.: "Energy-Efficient Task Partitioning for Real-Time Scheduling on Multi-Core Platforms", COMPUTERS, MDPI AG, vol. 10, no. 1, 1 January 2021 (2021-01-01), pages 10, XP093145026, ISSN: 2073-431X, DOI: 10.3390/computers10010010 *

Also Published As

Publication number Publication date
CN117666755A (zh) 2024-03-08

Similar Documents

Publication Publication Date Title
US11361734B2 (en) Display driving method and electronic device including the display driver integrated circuit for supporting the same
WO2021052263A1 (zh) 语音助手显示方法及装置
WO2020238774A1 (zh) 一种通知消息的预览方法及电子设备
WO2020108356A1 (zh) 一种应用显示方法及电子设备
WO2021208627A1 (zh) 一种任务调度方法、装置及电子设备
CN113553130B (zh) 应用执行绘制操作的方法及电子设备
WO2021244154A1 (zh) 自适应生成卡片的方法、终端设备和服务器
WO2023065916A1 (zh) 通知处理方法、芯片、电子设备及计算机可读存储介质
WO2021121052A1 (zh) 一种多屏协同方法、系统及电子设备
WO2024046088A1 (zh) 任务调度方法及相关设备
WO2023066395A1 (zh) 一种应用运行方法以及相关设备
WO2023142906A1 (zh) 一种功耗控制方法及装置
WO2023103800A1 (zh) 绘制方法及电子设备
CN113760192B (zh) 数据读取方法、装置、存储介质和程序产品
WO2024027391A1 (zh) 任务管理方法及相关设备
CN115220881A (zh) 进程管理方法、电子设备、进程管理系统以及存储介质
WO2023051036A1 (zh) 加载着色器的方法和装置
WO2023051056A1 (zh) 内存管理方法、电子设备、计算机存储介质和程序产品
WO2022179283A1 (zh) 推送消息的发送方法、电子设备及可读介质
WO2024032430A1 (zh) 管理内存的方法和电子设备
US20240236863A9 (en) Power Consumption Control Method and Apparatus
WO2024114778A1 (zh) 一种表盘界面绘制方法及电子设备
CN116709557B (zh) 业务处理方法、设备及存储介质
WO2022155848A1 (zh) 虚拟机性能优化的方法及相关装置
WO2024093431A1 (zh) 一种图像绘制方法及电子设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23859122

Country of ref document: EP

Kind code of ref document: A1