System service management method and electronic equipment
By modifying the attribution relationship between system services and processes, the frequency of communication between processes is reduced, the problem of increased system power consumption is solved, and the system performance is improved.
Patent Information
- Application Number
- CN202311252046.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-26
- Publication Date
- 2025-03-28
AI Technical Summary
With the enrichment of electronic equipment functions, the calls to system services between processes increase, resulting in frequent inter-process communication, increasing system power consumption, affecting system performance.
By modifying the attribution relationship between system services and processes, the system services are transferred from high-communication frequency processes to low-communication frequency processes, so that the calls to system services between processes are reduced, thereby reducing system energy consumption and improving system performance.
It effectively reduces the number of inter-process communication times, reduces system energy consumption, and improves system performance.
Smart Images

Figure CN119718702A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of terminal technology, and in particular to a system service management method and an electronic device. Background Art
[0002] With the development of terminal technology, the functions provided by the applications of electronic devices are becoming more and more abundant. In order to realize different functions, when the electronic device is running an application, the application process may need to call system services in other processes to complete various functions.
[0003] For example, during the operation of a live broadcast application, the live broadcast application process may need to call different system services of other processes to implement corresponding functions. For example, during the operation of a live broadcast application, the live broadcast application process needs to call the camera-related system services in the camera process to perform image acquisition functions, needs to call the system services in the text editing-related processes to implement the chat message editing function, and needs to call the relevant system services in the payment process to implement transaction functions. In order to realize more and more functions in the application, electronic devices will generate a large number of inter-process calls to system services. This will generate a large amount of inter-process communication and considerable system power consumption, affecting system performance. Summary of the invention
[0004] In order to solve the above technical problems, the present application provides a system service management method and electronic device. The technical solution provided by the present application reduces the calls to the system service between processes by modifying the ownership relationship between the system service and the process, thereby reducing the number of inter-process communications, reducing system energy consumption, and improving system performance.
[0005] In order to achieve the above technical objectives, this application provides the following technical solutions:
[0006] In a first aspect, a system service management method is provided, which is applied to an electronic device, and the method includes: running a first process. Obtaining the number of communications of the system service in the first process, the communication number including the first number of communications of the system service in the first process within the first process, and the second number of communications between the system service in the first process and the second process. Modifying a first configuration file of the first process and a second configuration file of a target process, modifying a first system service in the system service in the first process from belonging to the first process to belonging to the target process, the first number of communications of the first system service being less than the second number of communications of the first system service, and the target process being a process in the second process that meets a preset condition.
[0007] In this way, when the first communication number of the first system service is less than the second communication number of the first system service and the target process meets the preset conditions, the electronic device changes the first system service from belonging to the first process to belonging to the target process, thereby reducing inter-process communication, thereby reducing system consumption and improving system performance.
[0008] According to the first aspect, the preset condition is to use the process among the second processes that communicates with the first system service the most times as the target process.
[0009] In this way, the electronic device modifies the ownership of the first system service to the process that communicates with the first system service the most times, which can effectively reduce the calls to the first system service between processes, thereby reducing the number of communications between processes, reducing system consumption, and improving system performance.
[0010] According to the first aspect, or any implementation of the first aspect above, if the first system service belongs to the target process, the third communication number of the first system service within the target process is greater than the fourth communication number of the first system service with other processes, and the fourth communication number is less than the second communication number of the first system service.
[0011] In this way, after the electronic device determines to modify the ownership of the first system service to belong to the target process, the number of inter-process communications of the first system service can be reduced, and the number of inter-process communications of the first system service after modification is less than the number of intra-process communications. Inter-process communications in electronic devices can be converted to intra-process communications as much as possible, reducing the number of inter-process communications, thereby saving system consumption and improving system performance.
[0012] According to the first aspect, or any implementation of the first aspect above, before modifying the first configuration file of the first process and the second configuration file of the target process, and changing the first system service in the system services in the first process from belonging to the first process to belonging to the target process, the method further includes: obtaining the second system service in the first process, the first communication number of the second system service is less than the second communication number of the second system service. Obtaining a first number of first system services in the second system services, the second communication number of the first number of first system services is greater than the second communication number of other system services in the second system services.
[0013] According to the first aspect, or any implementation of the first aspect, after sorting the second system services in descending order according to the second communication times of the second system services, a first number of second system services are selected from the first ones in sequence as the first system services.
[0014] In this way, the electronic device only modifies the ownership relationship between system services and processes that have more cross-process communications, which can reduce unnecessary system changes and save system resources.
[0015] According to the first aspect, or any implementation of the first aspect above, if the difference between the second communication number of the third system service and the first communication number is greater than the first preset value, the third system service is determined to be the first system service that needs to modify the process ownership relationship.
[0016] In this way, the electronic device only modifies the ownership relationship between the system services and processes whose inter-process communication is more frequent than the intra-process communication, which can reduce unnecessary system changes and save system resources.
[0017] According to the first aspect, or any implementation method of the first aspect above, after sorting the fourth system services in descending order according to the difference between the second communication number of the fourth system service and the first communication number, the second number of fifth system services are selected from the first one in the fourth system services as the first system services whose process ownership relationship needs to be modified.
[0018] In this way, the electronic device selects a preset number of system services from the second system services, whose inter-process communication is more than intra-process communication, and only modifies their ownership relationship with the processes, which can reduce unnecessary system changes and save system resources.
[0019] According to the first aspect, or any implementation of the first aspect above, the first communication number of the first system service is the sum of the communication numbers of the first system service in the first process. The second communication number of the first system service is the sum of the communication numbers of the first system service and the second process.
[0020] Thus, the electronic device compares the first communication times and the second communication times of the system service to obtain the frequency of intra-process and inter-process communication of the system service, and then obtains the system service whose inter-process communication is more frequent than the intra-process communication as the system service whose attribution relationship is to be modified.
[0021] According to the first aspect, or any implementation method of the first aspect above, modify the first configuration file of the first process and the second configuration file of the target process, and change the first system service in the system services in the first process from belonging to the first process to belonging to the target process, including: determining the first system service and the target process according to a preset period, and modifying the first configuration file and the second configuration file.
[0022] In this way, the electronic device determines the first system service and the target process whose attribution relationship needs to be modified according to the preset period, and modifies the attribution relationship between the system service and the target process. The attribution relationship between the system service and the target process of the electronic device can be adjusted according to the real-time usage of the electronic device by the user. The attribution relationship between the system service and the target process corresponds to the real-time usage of the electronic device by the user, thereby reducing the number of cross-process communications of the electronic device, reducing system energy consumption, and improving system performance and user experience.
[0023] According to the first aspect, or any implementation of the first aspect above, the first system service that meets the second preset condition in the previous cycle is retained as the first system service in this cycle. The first system service that meets the second preset condition is a third number of first system services selected in descending order from the first system services according to the size of the second communication number of the first system service.
[0024] In this way, when the electronic device alternates between cycles, the electronic device retains the first system service with more frequent inter-process communication determined in the previous cycle as the first system service of this cycle, and re-determines some of the first system services in the current cycle. This avoids possible repeated calculations of certain system services, reduces the amount of calculations of the electronic device, and ensures system stability. In addition, it can also effectively deal with the situation where the first system service obtained in this cycle is not the system service that the electronic device will frequently call through inter-process communication next time due to a brief suspension of the electronic device in this cycle or other situations. Therefore, the electronic device modifies the attribution relationship between the first system service and the process in this cycle, and cannot reduce the subsequent inter-process communication.
[0025] According to the first aspect, or any implementation of the first aspect above, the method further includes: after restarting the electronic device, the modified first configuration file and the modified second configuration file take effect.
[0026] In this way, the electronic device sets the modified configuration file to take effect after the electronic device is restarted, which can avoid the electronic device reading the configuration file before modification and then reading the modified configuration file, which may cause overload of calculation, thereby ensuring the stability of the operation of the electronic device.
[0027] In a second aspect, an electronic device is provided, comprising: a processor and a memory, the memory being coupled to the processor, the memory being used to store computer program code, the computer program code comprising computer instructions, and when the processor reads the computer instructions from the memory, the electronic device executes: running a first process. Obtaining the number of communications of a system service in the first process, the number of communications comprising a first number of communications of the system service in the first process within the first process, and a second number of communications between the system service in the first process and the second process. Modifying a first configuration file of the first process and a second configuration file of a target process, modifying a first system service in the system service in the first process from belonging to the first process to belonging to the target process, the first number of communications of the first system service being less than the second number of communications of the first system service, and the target process being a process in the second process that meets a preset condition.
[0028] According to the second aspect, the preset condition is to use the process among the second processes that communicates with the first system service the most times as the target process.
[0029] According to the second aspect, or any implementation of the second aspect above, if the first system service belongs to the target process, the third communication number of the first system service within the target process is greater than the fourth communication number between the first system service and other processes, and the fourth communication number is less than the second communication number of the first system service.
[0030] According to the second aspect, or any implementation of the second aspect above, when the processor reads the computer instruction from the memory, the electronic device is also caused to execute: obtaining a second system service in the first process, the first communication number of the second system service is less than the second communication number of the second system service. Obtaining a first number of first system services in the second system service, the second communication number of the first number of first system services is greater than the second communication number of other system services in the second system service.
[0031] According to the second aspect, or any implementation of the second aspect, after sorting the second system services in descending order according to the second communication times of the second system services, a first number of second system services are selected from the first ones in sequence as the first system services.
[0032] According to the second aspect, or any implementation of the second aspect above, if the difference between the second communication number of the third system service and the first communication number is greater than the first preset value, the third system service is determined to be the first system service that needs to modify the process ownership relationship.
[0033] According to the second aspect, or any implementation method of the second aspect above, after sorting the fourth system services in descending order according to the difference between the second communication number of the fourth system service and the first communication number, the second number of fifth system services are selected from the first one in the fourth system services as the first system services whose process ownership relationship needs to be modified.
[0034] According to the second aspect, or any implementation of the second aspect above, the first communication number of the first system service is the sum of the communication numbers of the first system service in the first process. The second communication number of the first system service is the sum of the communication numbers of the first system service and the second process.
[0035] According to the second aspect, or any implementation method of the second aspect above, modify the first configuration file of the first process and the second configuration file of the target process, and change the first system service in the system services in the first process from belonging to the first process to belonging to the target process, including: determining the first system service and the target process according to a preset period, and modifying the first configuration file and the second configuration file.
[0036] According to the second aspect, or any implementation of the second aspect above, the first system services that meet the second preset condition in the previous cycle are retained as the first system services in this cycle. The first system services that meet the second preset condition are a third number of first system services selected in descending order from the first system services according to the size of the second communication number of the first system services.
[0037] According to the second aspect, or any implementation of the second aspect above, when the processor reads the computer instruction from the memory, the electronic device is also caused to execute: after the electronic device is restarted, the modified first configuration file and the modified second configuration file take effect.
[0038] In a third aspect, an electronic device is provided, which has the function of implementing the system service management method in the first aspect and any possible implementation thereof. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.
[0039] In a fourth aspect, a computer-readable storage medium is provided. The computer-readable storage medium stores a computer program (also referred to as an instruction or code), and when the computer program is executed by an electronic device, the electronic device executes the method of the first aspect or any one of the implementations of the first aspect.
[0040] According to a fifth aspect, a computer program product is provided. When the computer program product is run on an electronic device, the electronic device executes the method according to the first aspect or any one of the implementations of the first aspect.
[0041] According to a sixth aspect, a circuit system is provided, the circuit system comprising a processing circuit, wherein the processing circuit is configured to execute the method according to the first aspect or any one of the embodiments of the first aspect.
[0042] In the seventh aspect, a chip system is provided, comprising at least one processor and at least one interface circuit, wherein the at least one interface circuit is used to perform transceiver functions and send instructions to the at least one processor, and when the at least one processor executes the instructions, the at least one processor executes the method of the first aspect or any one of the embodiments of the first aspect.
[0043] The technical effects of the aforementioned aspects can be referenced to each other and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 A schematic diagram of a process for calling a system service through inter-process communication provided by an embodiment of the present application;
[0045] Figure 2 A schematic diagram of an interface for a shooting scene in a social application provided in an embodiment of the present application;
[0046] Figure 3 A schematic diagram of the structure of an electronic device 100 provided in an embodiment of the present application;
[0047] Figure 4 A software structure block diagram of the electronic device 100 provided in an embodiment of the present application;
[0048] Figure 5 A flowchart of a system service management method provided in an embodiment of the present application;
[0049] Figure 6 A flowchart of a system service management method provided in an embodiment of the present application;
[0050] Figure 7 A flowchart of a system service management method provided in an embodiment of the present application;
[0051] Figure 8 A flowchart of a system service management method provided in an embodiment of the present application;
[0052] Fig. 9 A flowchart of a system service management method provided in an embodiment of the present application;
[0053] Fig.10 A flowchart of a system service management method provided in an embodiment of the present application;
[0054] Fig.11A flowchart of a system service management method provided in an embodiment of the present application;
[0055] Fig.12 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0056] The technical solutions in the embodiments of the present application are described below in conjunction with the accompanying drawings in the embodiments of the present application. Wherein, in the description of the embodiments of the present application, the terms used in the following embodiments are only for the purpose of describing specific embodiments, and are not intended to be used as limitations on the present application. As used in the specification and the appended claims of the present application, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to include expressions such as "one or more", unless there is a clear indication to the contrary in the context. It should also be understood that in the following embodiments of the present application, "at least one", "one or more" refer to one or more (including two).
[0057] References to "one embodiment" or "some embodiments" etc. described in this specification mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Thus, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways. The term "connection" includes direct connection and indirect connection, unless otherwise specified. "First" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated.
[0058] In the embodiments of the present application, the words "exemplarily" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplarily" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplarily" or "for example" is intended to present related concepts in a specific way.
[0059] First, the English abbreviations and technical terms involved in the embodiments of the present application are described in detail.
[0060] Application and process: An application in an executable state is called a process, and a process has an independent address space. From the user's perspective, a process is an execution process of an application. From the perspective of the operating system core, a process represents the basic unit of resources such as memory and central processing unit (CPU) time slices allocated by the operating system, and is the operating environment provided for the running program. The difference between a process and an application is that an application is stored as a static file in the storage space such as the hard disk of the computer system, while a process is a system resource management entity maintained by the operating system under dynamic conditions.
[0061] Thread: A task in a process is a thread. A process can have multiple tasks but a task cannot belong to multiple processes.
[0062] Process address space: The address space seen from the perspective of the process is a collection of virtual addresses used when the process is running. The operating system will create an independent virtual address space for each process, and the address space of each process is the size of the entire memory. Then, the operating system will map the virtual address space to the physical memory through the page table, that is, when we get the virtual address, we can correspond to the physical address through the page table. When we need to modify the data in the virtual address, the operating system will first find the corresponding physical memory through the page table, and then modify the data in the physical memory.
[0063] Kernel space and user space: The operating system divides itself into two parts. Some core software is independent of ordinary applications and runs at a higher level. They reside in protected memory space and have all the permissions to access hardware devices. This is called kernel space. In contrast, applications run in "user space". Applications running in user space have many usage restrictions, such as only being able to see some of the system resources they are allowed to use and not being able to directly access kernel space and hardware devices.
[0064] Interprocess communication (IPC): In an operating system, the address spaces of processes are independent of each other, and each process has a different address space. A process cannot see the global variables of another process, so processes cannot directly access each other, and processes need to exchange data through kernel space. In some examples, a buffer is opened in the kernel space, process 1 copies data from user space to the kernel buffer, and process 2 obtains the data from the kernel buffer, thereby realizing communication between processes. Among them, this mechanism provided by the kernel is called interprocess communication (IPC).
[0065] System service (SA): System services provide various system capabilities. Different system services can provide different capabilities, and one system service can integrate multiple functions. When the system executes tasks (threads), system services between different processes can call each other. For example, when a social application process is running, the social application's system service can call the camera system service of the camera application process.
[0066] System Service Manager (SA manager): used to register SA. The SA of each process needs to be registered in the system service manager. The system service manager can be understood as an intermediary for calling SA between different processes.
[0067] Xml: Xml stands for Extensible Markup Language, which is a software and hardware independent tool for storing and transmitting data. The relationship between SA and processes on the operating system is determined by the Xml configuration file.
[0068] In some scenarios, when a process running on a terminal executes a task (thread), when an SA in a process requires the capability of an SA in another process, the SA in the process needs to call an SA in another process through inter-process communication.
[0069] Figure 1 This is a schematic diagram of the process of calling SA through inter-process communication. Figure 1 As shown, the user-side process represents the process that needs to call SA, and the server-side process represents the process that is called by SA and provides system services. The process includes the following steps:
[0070] All SAs of processes in the electronic device will be registered in the system service manager. Figure 1 As shown, the server process registers the service with the system service manager (i.e., step 1. Register the service). The system service manager is used to manage the SA of one or more application processes. The time when the SA is registered into the system service manager can be when the electronic device is turned on, or it can be after the electronic device is turned on. The electronic device can determine whether it is necessary to register the SA in the system service manager when the electronic device is turned on based on the function of the SA. For example, the functions provided by some graphics-related SAs are required to be used after the electronic device is turned on, so these graphics-related SAs need to be registered at startup. The functions provided by SAs related to wifi, Bluetooth, etc. are not required to be used after the electronic device is turned on, and can be registered later by responding to operation instructions, etc., so they do not need to be registered at startup.
[0071] Subsequently, when the user-side process executes a task (thread), needs to use certain functions, and needs to call a certain SA, the user-side process sends a request to the system service manager to obtain the service (i.e., step 2. obtain the service). The system service manager feeds back the registration information of the SA to the user-side process based on the registration information of the SA in the system service manager. The feedback registration information of the SA includes the corresponding relationship between the SA and the process to which it belongs.
[0072] After receiving the registration information of the SA fed back by the system service manager, the user-side process calls the SA from the server-side process to which the SA belongs according to the registration information of the SA to be called, and then uses the capabilities provided by the SA (ie, step 3. using the service).
[0073] In some embodiments, processes in user space implement inter-process communication by accessing data in kernel space, which will generate system power consumption. Figure 1 As shown, when SA1 in the user-side process of the user space executes a task (thread), when it needs to call SA2 outside the process, it requests the system service manager to call the system service SA2. This process will communicate with the kernel space (a thread switch and a switch from user space to kernel space occur). The system service manager sends the registration information of SA2 to the server process to which SA1 belongs (a switch from user space to kernel space occurs). Based on the registration information of SA2, SA1 in the user-side process sends a service request to use SA2 to the server process to which SA2 belongs (a thread switch occurs). After receiving the service request sent by the user-side process, the server process copies the data to be used from the user space to the kernel space (a switch from user space to kernel space and a data copy occur), and the user-side process can access the data in the kernel space from the user space (a switch from user space to kernel space occurs), and copy the data (a data copy occurs).
[0074] The above process involves two thread switches, four user space and kernel space switches, and two data copies. This also results in a corresponding amount of time consumption. According to statistics, one inter-process communication will increase the execution time by 0.5ms-1ms under light load (excluding business execution time). It can be seen that one inter-process communication will at least bring the following system load: increase the execution time by 0.5ms-1ms under light load (excluding business execution time), bring two thread switches, increase four user space and kernel space switches, and increase two data copies.
[0075] Therefore, if SA needs to be called frequently between processes, the inter-process communication will increase significantly, which will correspondingly bring a large amount of system power consumption, and the system performance will be seriously affected.
[0076] Figure 2 Combined with the shooting scenes in social applications, the IPC communication process is introduced more vividly.
[0077] For example, Figure 2 As shown, Figure 2 As shown in (a), the electronic device detects the user's operation on the shooting control 201 during the process of displaying the social application interface, such as Figure 2 In response to the operation of the shooting control 202, the electronic device determines that the camera function needs to be started, so the social application process requests to call the relevant SA that provides the camera function in the camera process, that is, the social application process needs to perform IPC communication. Figure 2 As shown in (c), the electronic device displays a camera shooting interface. In response to the operation of the shooting control 203 displayed on the shooting interface, the electronic device can call the SA related to the camera function in the camera process to complete the shooting.
[0078] It can be seen that when an electronic device runs an application, in order to realize different functions, the application process may need to call SAs in other processes through IPC communication. If in the operating system, SAs in one process frequently call SAs in another process, such as SAs related to shooting in social application processes frequently calling SAs related to camera functions in camera processes, the number of IPC communications will increase, the system load will increase, and the system performance will decrease.
[0079] Therefore, an embodiment of the present application provides a system service management method, which modifies the association relationship between SA and processes, adds SA to the process that communicates most frequently with the SA, thereby reducing the calls to SA between processes and thereby reducing the number of communications between processes.
[0080] Optionally, the system service management method provided in the embodiment of the present application can be applied to the electronic device 100. For example, the electronic device 100 can be a mobile phone, a computer, a tablet computer, a laptop computer, a vehicle terminal, an augmented reality (AR) / virtual reality (VR) device, a mixed reality (MR) device, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), a wearable device, an artificial intelligence (AI) device, and other terminal devices. The operating system installed in the above electronic device 100 includes but is not limited to OS, Or other operating systems. The embodiments of the present application do not limit the specific type of the above electronic device and the installed operating system.
[0081] Figure 3 A schematic structural diagram of an electronic device 100 is shown.
[0082] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. It can be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The illustrated components can be implemented in hardware, software, or a combination of software and hardware.
[0083] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated into one or more processors. The controller may generate an operation control signal according to the instruction opcode and the timing signal to complete the control of fetching and executing instructions.
[0084] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0085] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0086] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple groups of I2C buses. The processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, etc. through different I2C bus interfaces. For example: the processor 110 may be coupled to the touch sensor 180K through the I2C interface, so that the processor 110 communicates with the touch sensor 180K through the I2C bus interface, thereby realizing the touch function of the electronic device 100.
[0087] The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to implement the shooting function of the electronic device 100. The processor 110 and the display screen 194 communicate via the DSI interface to implement the display function of the electronic device 100.
[0088] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transfer data between the electronic device 100 and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices, etc.
[0089] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0090] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.
[0091] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.
[0092] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0093] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0094] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0095] The modem processor may include a modulator and a demodulator. Among them, 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. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.
[0096] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0097] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other 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 (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).
[0098] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0099] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be manufactured using a liquid crystal display (LCD), such as an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Mini-LED, Micro-LED, Micro-oled, quantum dot light emitting diodes (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0100] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0101] 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 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.
[0102] The internal memory 121 can be used to store computer executable program codes, which include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.). The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.). In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the internal memory 121 and / or instructions stored in a memory provided in the processor.
[0103] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170. The audio module 170 includes, for example, a speaker, a receiver, a microphone, an earphone interface, and an application processor.
[0104] The audio module 170 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. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.
[0105] The sensor module includes, for example, a touch sensor, etc. A touch sensor is also called a "touch control device". The touch sensor 180K can be arranged on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch control screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor 180K can also be arranged on the surface of the electronic device 100, which is different from the position of the display screen 194.
[0106] The buttons 190 include a power button, a volume button, etc. The electronic device 100 can receive a button input and generate a key signal input related to user settings and function control of the electronic device 100 .
[0107] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. Indicator 192 can be an indicator light, which can be used to indicate charging status, power changes, messages, missed calls, notifications, etc.
[0108] The SIM card interface 195 is used to connect a SIM card. The electronic device 100 may support 1 or N SIM card interfaces, where N is a positive integer greater than 1.
[0109] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software structure of the electronic device 100.
[0110] Figure 4 It is a software structure block diagram of the electronic device 100 according to an embodiment of the present application.
[0111] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system library, and the kernel layer.
[0112] The application layer can include a series of application packages.
[0113] like Figure 4 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc. The technical solution disclosed in the embodiment of the present application is about calling SA between processes corresponding to the application.
[0114] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0115] like Figure 4 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.
[0116] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0117] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
[0118] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.
[0119] The phone manager is used to provide communication functions of the electronic device 100, such as management of call status (including connecting, hanging up, etc.).
[0120] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0121] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.
[0122] Android runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system.
[0123] The core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.
[0124] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0125] The system library may include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
[0126] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
[0127] The media library 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.
[0128] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
[0129] A 2D graphics engine is a drawing engine for 2D drawings.
[0130] The kernel layer is the layer between hardware and software. The kernel layer includes at least inter-process drivers, display drivers, camera drivers, audio drivers, and sensor drivers.
[0131] In the embodiment of the present application, the XML file of the server process is stored in the hardware (such as Figure 3 In the internal memory 121 shown in the figure, the XML file of a SA of the server process is also stored in the hardware. When a user process wants to use the capabilities provided by the SA of the server process, it is necessary to perform inter-process communication through the inter-process driver of the kernel layer to call the SA. The capabilities provided by the SA are often supported by certain hardware structures. For example, the SA related to the gallery needs to be supported by the internal memory 121, and the capabilities of the SA related to the camera need to be supported by the camera 193.
[0132] Figure 5 The following is a flow chart of a system service management method provided in an embodiment of the present application. Figure 5 The specific order described below is a limitation, and it should be understood that in other embodiments, the order of some steps in the method can be interchanged according to actual needs, or some steps can be omitted or deleted. The method includes the following steps:
[0133] S501: During the process running, the electronic device monitors the calling status of SA in the process.
[0134] The calling of SA in the process includes at least one of the calling within the process or the calling outside the process. Accordingly, when SA is called within the process, the electronic device can obtain the number of SA's in-process communications, and when SA is called outside the process, the electronic device can obtain the number of SA's inter-process communications. The calling of SA in the process monitored by the electronic device includes the number of SA's in-process and inter-process communications.
[0135] In some embodiments, the electronic device monitors the number of communications between SAs in a process and between processes through maintenance monitoring means.
[0136] Exemplarily, take the example of an electronic device monitoring the call status of SA1 in process 1. The electronic device obtains the communication times of SA1 in process 1 within the process, including: obtaining the communication times of SA1 with other SAs in the same process, summing the communication times of SA1 with other SAs in the same process, and taking the result of the sum as the communication times of SA1 in process 1. The electronic device obtains the communication times of SA1 in process 1 with other processes, including: summing the communication times of SA1 with SAs in other processes, and taking the result of the sum as the communication times of SA1 outside process 1. For example, taking the example of obtaining the communication times of SA1 with process 2, the electronic device sums the values of the communication times between SA1 and each SA in process 2 as the communication times of SA1 with process 2.
[0137] S502: The electronic device determines the SA to be decoupled according to the calling status of the SA, and the number of inter-process communications and the number of intra-process communications of the SA to be decoupled meet preset conditions.
[0138] In some embodiments, the preset condition may include that the number of inter-process communications of the SA is greater than the number of intra-process communications. For example, the electronic device uses the SA whose inter-process communication number is greater than the number of intra-process communications as the SA to be decoupled according to the number of SA communications within and between processes.
[0139] In some embodiments, the preset condition may also include selecting a preset number of SAs from SAs whose inter-process communication times are greater than the intra-process communication times as SAs to be decoupled. For example, the electronic device selects SAs whose inter-process communication times are greater than the intra-process communication times as pre-selected SAs based on the SA intra-process and inter-process communication times. Afterwards, the electronic device selects a preset number of SAs from the pre-selected SAs as SAs to be decoupled.
[0140] In some embodiments, Figure 6 As shown, “selecting a preset number of SAs from the pre-selected SAs as SAs to be decoupled” includes steps S601-S602:
[0141] S601: The electronic device sorts the pre-selected SAs in descending order according to the number of inter-process communications of each SA in the pre-selected SAs, and obtains an SA list sorted in descending order according to the numerical values of the number of inter-process communications.
[0142] The sorting order of different SAs in the SA list corresponds to the frequency of SA communication between processes from high to low.
[0143] S602: The electronic device selects a preset number of SAs as SAs to be decoupled, starting from the first one in the SA list.
[0144] In some embodiments, the number of SA inter-process communications involved in the comparison in the embodiments of the present application is the number of communications between the SA and each process obtained by the electronic device, and the summed value obtained after summing these numbers is the number of inter-process communications of the SA. Alternatively, the number of SA inter-process communications involved in the comparison may also be the value of the number of communications between the process that communicates most frequently with the SA and the SA, and the embodiments of the present application are not limited to this. Exemplarily, among the processes that communicate with SA1, the process that communicates most frequently with SA1 is process 2, then the number of inter-process communications of SA1 is the number of communications between process 2 and SA1. In some embodiments, the number of SA intra-process communications involved in the comparison in the embodiments of the present application is the value obtained by summing the number of communications between the SA and other SAs in the process to which the electronic device belongs. Alternatively, the number of SA intra-process communications involved in the comparison may also be the value of the number of communications between the SA that communicates most frequently with the SA in the process to which the SA belongs, and the embodiments of the present application are not limited to this.
[0145] In some embodiments, the electronic device may select a preset number of SAs ranked first from the determined pre-selected SAs as the SAs to be decoupled. In this way, the electronic device may subsequently modify only the attribution relationship between some SAs with more cross-process communications and processes, which can reduce unnecessary system changes and save system resources.
[0146] In some embodiments, the preset number may be a preset value in the electronic device, or a user-defined value or a value automatically updated by the electronic device according to the operation of the electronic device, etc. The preset number may be 20, or 30, or may be equal to the number of pre-selected SAs (i.e., all pre-selected SAs are used as SAs to be decoupled), which is not limited in the embodiments of the present application.
[0147] It should be understood that after determining the pre-selected SA, the electronic device may also sort the multiple pre-selected SAs in ascending order according to the numerical value of the number of communications between the pre-selected SA processes to obtain the SA list. Afterwards, the electronic device may select a preset number of pre-selected SAs sorted later in the SA list as the SAs to be decoupled. Alternatively, the electronic device may also select a preset number of SAs to be decoupled by other methods, which is not limited in the embodiments of the present application.
[0148] In some embodiments, after determining the SAs to be decoupled, the electronic device may determine that the number of inter-process communications of these SAs is greater than the number of intra-process communications. Therefore, if it is necessary to reduce the number of inter-process communications during the process running, these SAs to be decoupled may be decoupled from the original process and added to the process to be added to reduce the number of inter-process communications. The process to be added is a process that frequently communicates with the process of the SA to be decoupled.
[0149] In some embodiments, in theory, after the process to be decoupled is added to the process to be added, the number of inter-process communications will decrease during the process running. Therefore, the electronic device needs to measure the change in the number of inter-process communications after the process to be decoupled is added to the process to be added, so as to determine whether it is really necessary to add the process to be decoupled to the process to be added, and determine the final process to be added.
[0150] In some examples, the electronic device determines whether the number of inter-process communications of the SA to be decoupled is less than the number of intra-process communications after the SA to be decoupled is added to the process to be added, and whether the number of inter-process communications will decrease. If the judgment result is that after the SA to be decoupled is added to the process to be added, the number of inter-process communications of the SA to be decoupled is less than the number of intra-process communications, and the overall number of inter-process communications will be reduced compared to before decoupling. Then, the electronic device can determine that the process to be decoupled needs to be added to the process to be added.
[0151] Optional, such as Figure 7 As shown, the judging step includes steps S701 to S703:
[0152] S701: The electronic device determines whether the number of inter-process communications is less than the number of intra-process communications after the SA to be decoupled is added to the process to be added, and whether the number of inter-process communications will decrease, and obtains a judgment result.
[0153] In some examples, the electronic device adds the SA to a process by establishing an association between the SA and the process. For example, the electronic device establishes an association between the SA to be decoupled and the process to be added, and cancels the association between the process to be decoupled and the original process, and can add the process to be decoupled to the process to be added.
[0154] In some embodiments, the electronic device determines the number of communications between the SA to be decoupled and other SAs in the process to be joined after the SA to be decoupled joins the process to be joined, and the value obtained by summing these determined values is the number of intra-process communications after the SA to be decoupled joins the process to be joined, denoted by M, where M is a positive integer. Determine the number of communications between other processes and the SA to be decoupled after the SA to be decoupled joins the process to be joined, and the value obtained by summing these determined values is the number of inter-process communications after the SA to be decoupled joins the process to be joined, denoted by N, where N is a positive integer. The value obtained by summing the number of communications between other processes and the SA to be decoupled before the SA to be decoupled is decoupled is denoted by W, where W is a positive integer.
[0155] In some embodiments, M may also be the maximum value of the number of communications between the SA to be decoupled and other SAs in the process to be joined after the SA to be decoupled joins the process to be joined. N may also be the number of communications between the process that most frequently communicates with the SA to be decoupled and the SA in other processes after the SA to be decoupled joins the process to be joined. W may also be the number of communications between the process that most frequently communicates with the SA to be decoupled and the SA in other processes currently (before decoupling).
[0156] If M>N and W>N of a certain SA to be decoupled, the judgment result is that after the SA to be decoupled is added to the process to be added, the number of inter-process communications is less than the number of intra-process communications, and the number of inter-process communications decreases. M>N means that after the SA to be decoupled is added to the process to be added, the number of inter-process communications is less than the number of intra-process communications. W>N means that after the SA to be decoupled is added to the process to be added, the number of inter-process communications is less than the number of inter-process communications currently of the SA to be decoupled.
[0157] If M≤N of a certain SA to be decoupled, the judgment result is that after the SA to be decoupled is added to the process to be added, the number of inter-process communications is not less than the number of intra-process communications. If W≤N of a certain SA to be decoupled, the judgment result is that after the SA to be decoupled is added to the process to be added, the number of inter-process communications will not decrease.
[0158] S702: If the judgment result is that after adding a to-be-decoupled SA to a to-be-added process, the number of inter-process communications will decrease, and the number of inter-process communications of the to-be-decoupled SA is less than the number of intra-process communications, the electronic device determines that the to-be-decoupled SA can be used as the final determined to-be-decoupled SA.
[0159] S703: If the result of the judgment is that the number of inter-process communications will not decrease after adding a certain SA to be decoupled to the process to be added, or the number of inter-process communications of the SA to be decoupled is greater than the number of intra-process communications, the electronic device determines that the SA to be decoupled is not the finalized SA to be decoupled.
[0160] In this way, the electronic device determines the change of the SA to be decoupled after adding it to the process to be added, and judges whether the inter-process communication of the SA to be decoupled can be reduced after changing the association relationship of the SA to be decoupled, thereby determining whether the SA to be decoupled can be determined as the SA to be decoupled whose association relationship needs to be changed in the end. This ensures that after the association relationship of the SA to be decoupled is subsequently changed, the number of inter-process communications can be greatly reduced, saving system energy consumption.
[0161] In some embodiments, the electronic device may also define the judgment result as the number of inter-process communications will decrease after the SA to be decoupled joins the process to be joined when W>N. Because W>N, it means that after the SA to be decoupled joins the process to be joined, the number of inter-process communications will decrease compared to the current number of inter-process communications of the SA to be decoupled. In this way, when W>N, adding the SA to be decoupled to the process to be joined can also reduce the number of inter-process communications.
[0162] In step S502, the electronic device determines the final SA to be decoupled by the above method. Afterwards, the electronic device may perform the following step S503 to add these SAs to be decoupled to the process to be added.
[0163] S503: The electronic device decouples the SA to be decoupled from the original process, and establishes an association relationship between the SA to be decoupled and the process to be added.
[0164] In some embodiments, the electronic device decouples the SA to be decoupled from the original process by modifying the configuration file of the SA to be decoupled, and joins the above-mentioned process to be joined that communicates most frequently with the SA. It should be understood that in the following, the SA to be decoupled is the electronic device through Figure 7 The judgment steps shown determine the final SA to be decoupled, which will not be described in detail below.
[0165] In some embodiments, after the electronic device downloads the application installation package, during the process of installing the application, it can obtain the configuration file of the application from the application installation package and save the configuration file. The configuration file includes the association relationship between the process of the application and the SA in the process. Therefore, after the electronic device determines that the SA to be decoupled needs to be decoupled from the original process, it can obtain the configuration file of the original process, modify the configuration file, and delete the association relationship between the original process and the SA to be decoupled. In addition, the electronic device can obtain the configuration file corresponding to the process to be added, modify the configuration file, and add the association relationship between the SA to be decoupled and the process to be added in the configuration file.
[0166] For example, Figure 2In the scenario shown, if the SA related to shooting in the social application process frequently calls the SA related to the camera in the camera application process, so that the number of communications between the SA related to the camera and the SA in the social application process is greater than the number of communications with other SAs in the camera process. Then, the electronic device can select the SA related to the camera as the pre-selected SA. If a preset number of SAs are selected from the SA list composed of pre-selected SAs as the SAs to be decoupled, and the SA related to the camera is selected as the SA to be decoupled, the social application process with the most frequent communication with the SA related to the camera is used as the process to be added to the SA related to the camera. Modify the configuration file of the SA related to the camera to be decoupled, so that the SA related to the camera is decoupled from the camera process and joins the social application process with the most frequent communication with the SA related to the camera. It should be understood that if the number of SAs related to the camera is 1, then after determining the SA related to the camera, the electronic device can directly determine the SA related to the camera as the SA to be decoupled, without having to first determine the pre-selected SA and then determine the SA to be decoupled.
[0167] In some embodiments, Figure 8 As shown, the electronic device decouples the SA to be decoupled from the original process, and establishes an association relationship between the SA to be decoupled and the process to be added, including steps S801 to S803.
[0168] S801: After being powered on, the electronic device obtains a valid XML configuration file from XML configuration files corresponding to all SAs.
[0169] In the storage space of the system, each SA corresponds to an XML configuration file, and the code of the XML configuration file includes the identifier corresponding to the SA, that is, the system service identifier (SAID). In addition to the system service identifier, the code of some XML configuration files also includes a Process field.
[0170] In some embodiments, obtaining a valid XML configuration file from the XML configuration files corresponding to all SAs includes detecting whether the XML configuration file of a certain SA includes a Process field. The Process field is used to indicate the name of the process to which the SA corresponding to the XML configuration file belongs in the current system. If the XML configuration file of the SA includes the Process field, it means that the SA corresponding to the XML configuration file has a process in the current system, and it is determined that the XML configuration file of the SA is a valid XML configuration file in the embodiment of the present application.
[0171] Taking the XML configuration files of 3203, 401, 1301, 1000, and 408 system services as examples, the codes in the XML configuration files corresponding to the above system services are as follows:
[0172] The code in the XML configuration file of the 3203 service is as follows:
[0173]
[0174] The code in the XML configuration file of the 1301 system service is as follows:
[0175]
[0176] The code in the XML configuration file of the 401 system service is as follows:
[0177]
[0178]
[0179] The code in the Xml configuration file of the 1000 system service is as follows:
[0180]
[0181] The code in the Xml configuration file of the 408 system service is as follows:
[0182]
[0183] The SAIDs in the Xml configuration files corresponding to the above system services are "3203", "401", "1301", "1000", and "408", respectively. The electronic device detects that the Xml configuration files corresponding to the 3203, 401, 1301, and 1000 system services all include the Process field "foundation", indicating that the 3203, 401, 1301, and 1000 system services are all services under the foundation process. The electronic device detects that the Xml configuration file corresponding to the 408 system service includes the Process field "distributeddata", indicating that 408 is a service under the distributeddata process. Therefore, the 3203, 401, 1301, 1000, and 408 system services all have their own processes, and their corresponding Xml configuration files are all valid Xml configuration files.
[0184] S802: The electronic device merges all valid Xml configuration files containing the same Process field according to the obtained valid Xml configuration file to obtain a merged Xml configuration file of the process corresponding to the Process field.
[0185] In some embodiments, the merged Xml configuration file records the SAIDs corresponding to all SAs under the process, so the electronic device can determine all SAs included in the process based on the merged Xml configuration file of the process.
[0186] For example, the electronic device merges the valid XML configuration files corresponding to the 3203 system service, 401 system service, 1301 system service, and 1000 system service according to the Process field "foundation" to obtain the merged XML configuration file of the foundation process. The code example of the merged XML configuration file of the "foundation" process is as follows:
[0187]
[0188] S803: The electronic device modifies the Process field corresponding to the SA to be decoupled in the merged Xml configuration file, so that the SA to be decoupled is decoupled from the original process and joins the process to be joined that communicates most frequently with the SA.
[0189] In some embodiments, after determining that the association between the SA to be decoupled and the process needs to be modified, the electronic device can obtain the merged Xml configuration file of the original process of the SA to be decoupled and the merged Xml configuration file of the process to be added to the SA to be decoupled. The electronic device can modify the association between the SA to be decoupled and the process by modifying these two merged Xml configuration files.
[0190] It should be understood that after the electronic device is turned on, through the above steps S801 and S802, the merged Xml configuration files of each process can be obtained. Later, during the operation of the electronic device, after the electronic device determines that the association relationship between SA and the process needs to be modified based on the SA operation status, it can directly execute step S803 to modify the association relationship between SA and the process. That is, steps S801 and S802 are optional steps, and are not steps that must be executed every time the association relationship between SA and the process is modified.
[0191] In some embodiments, the electronic device modifies the Process field corresponding to the SA to be decoupled in the merged Xml configuration file, and changes the Process field from pointing to the current process to pointing to the process to be added. After the modification, the merged Xml configuration file of the current process no longer includes the code of the SA to be decoupled. The code corresponding to the SA to be decoupled is merged into the merged Xml configuration file of the process to be added. The SA to be decoupled is decoupled from the original process and joins the process to be added that communicates most frequently with the SA.
[0192] In some embodiments, the electronic device obtains a merged Xml configuration file copy by copying. Afterwards, the electronic device modifies the merged Xml configuration file copy, and then after the computer is restarted, the electronic device replaces the merged Xml configuration file before modification with the modified merged Xml configuration file copy. In this way, after the electronic device is restarted, it can run the modified merged Xml configuration file, so that the above-mentioned SA to be decoupled can realize a new association relationship and reduce inter-process communication.
[0193] For example, Fig. 9 As shown, taking the 1301 system service under the foundation process as the SA to be decoupled and the distributeddata process as the process to be added to the 1301 system service as an example, the process of modifying and merging the Xml file is introduced, and the process includes steps S901-S902:
[0194] S901: The electronic device copies and merges the Xml configuration file to obtain a copy of the merged Xml configuration file.
[0195] Exemplarily, the electronic device determines that the SA to be decoupled is the 1301 system service. As described above, the electronic device can determine that the original process to which the 1301 system service belongs is the foundation process, and the process to be added is the distributeddata process. Then, the electronic device copies the merged Xml configuration file of the foundation process to obtain a copy of the merged Xml configuration file of the foundation process. Copy the merged Xml configuration file of the distributeddata process to obtain a copy of the merged Xml configuration file of the distributeddata process.
[0196] S902: The electronic device modifies the Process field of the SA to be decoupled in the merged Xml configuration file copy, and modifies the Process field from pointing to the original process to pointing to the process to be added.
[0197] Exemplarily, the electronic device modifies the Process field of the 1301 system service in the merged XML configuration file copy of the foundation process from "foundation" to "distributeddata". The corresponding code field of the 1301 system service is added to the merged XML configuration file copy of the distributeddata process, and the Process field in the corresponding code field is "distributeddata".
[0198] For example, the modified copy of the merged Xml configuration file of the foundation process deletes the code field of the 1301 service, but retains the code fields of the original 3203 system service, 401 system service, and 1000 system service. The modified copy of the merged Xml configuration file of the distributeddata process adds the code field of the 1301 system service in addition to the code field of the original 408 system service. The code in the modified copy of the merged Xml configuration file of the foundation process is as follows:
[0199]
[0200] The code in the modified copy of the DistributedData process's merged XML configuration file is as follows:
[0201]
[0202]
[0203] In some embodiments, the electronic device may also modify the Process field in the Xml configuration file of each service so that the SA to be decoupled is decoupled from the original process and joins the process to be joined that communicates most frequently with the SA.
[0204] For example, Fig.10 A flow chart of a system service management method provided in an embodiment of the present application. Fig.10 As shown, take modifying the Xml configuration file corresponding to the 1301 system service so that the 1301 system service is decoupled from the original foundation process and added to the distributeddata process to be added as an example. The process includes steps S1001-S1002:
[0205] S1001: The electronic device copies the Xml configuration file of the 1301 system service to obtain a copy of the Xml configuration file of the 1301 system service.
[0206] S1002: The electronic device modifies the Process field in the copy of the Xml configuration file of the 1301 system service from "foundation" to "distributeddata" to obtain the modified Xml configuration file of the 1301 system service.
[0207] Exemplarily, the code of the Xml configuration file of the 1301 system service is as follows:
[0208]
[0209] The code for the modified copy of the Xml configuration file for the 1301 system service is as follows:
[0210]
[0211] In this way, the electronic device adjusts the association between SA and processes by modifying the Xml configuration file, and places SA in the process that communicates most frequently with the SA, thereby avoiding high system power consumption caused by increased inter-process communication due to frequent calls to SA between processes, and effectively improving system performance.
[0212] In some embodiments, to avoid confusion in process operation, generally after the device is restarted, the electronic device runs the modified copy of the merged Xml configuration file to trigger the change of the association relationship of the SA. That is, in the above step S503, after the electronic device modifies the association relationship of the SA to be decoupled, the following step S504 can be used to trigger the modified association relationship of the SA to be decoupled to take effect.
[0213] S504: After the electronic device is restarted, the association between the SA to be decoupled and the process to be joined takes effect, and the association between the SA to be decoupled and the original belonging process is released.
[0214] In some embodiments, after the electronic device is restarted, the electronic device obtains the merged Xml configuration file and the modified merged Xml configuration file copy of the process. If the process has a modified merged Xml configuration file copy, the electronic device can overwrite the original merged Xml configuration file of the process with the modified merged Xml configuration file copy of the process, thereby updating the merged Xml configuration file of the process. If the process does not have a modified merged Xml configuration file copy, the electronic device can only obtain the merged Xml configuration file of the process.
[0215] Exemplarily, as in the scenario described above, the foundation process and the distributeddata process include a merged Xml configuration file and a modified copy of the merged Xml configuration file. Then, the electronic device uses the copy of the merged Xml configuration file of the foundation process to overwrite the merged Xml configuration file of the foundation process, and uses the copy of the merged Xml configuration file of the distributeddata process to overwrite the merged Xml configuration file of the distributeddata process. As a result, the 1301 system service is decoupled from the original foundation process and added to the distributeddata process. That is, the 1301 system service is modified from a service under the foundation process to a service under the distributeddata process.
[0216] In some embodiments, the subsequent electronic device may merge the Xml configuration files of all SAs included in a process to obtain a merged Xml configuration file, or may not merge the Xml configuration files of the SAs included in the process, which is not limited in this embodiment of the present application.
[0217] In this way, if the electronic device merges the Xml configuration files of all SAs included in a process, after the electronic device modifies the Process field in the Xml configuration file of each service, the subsequent process pointed to by the Process field will merge the codes in the Xml configuration files of all system services belonging to the process. After the Process field of the SA to be decoupled is modified from pointing to the original process to pointing to the process to be added, the code corresponding to the SA to be decoupled will not be merged by the electronic device into the merged Xml configuration file of the original process, but will be merged into the merged Xml configuration file of the process to be added pointed to by the Process field. The electronic device can also decouple the SA to be decoupled from the original process and join the process to be added that communicates most frequently with the SA. The effect of merging the Xml configuration files of all SAs included in a process is that the electronic device does not need to act on multiple Xml configuration files to perform some tasks, saving system working resources.
[0218] If the electronic device does not merge the XML configuration files of all SAs included in a process, when a task or process in the system needs to call or modify the SA under a process, it directly acts on the code of the XML configuration file of the SA, which is simpler to execute.
[0219] Thus, according to the embodiment of the present application, the electronic device modifies the association between the SA and the process by modifying the XML configuration file. The SA is decoupled from the original process and added to the process that communicates most frequently with the SA. The calls to the SA between processes are reduced, thereby reducing the number of inter-process communications. According to the user's usage habits, the system resource configuration is optimized and the system energy efficiency is improved.
[0220] In some embodiments, the copy of the XML configuration file is modified in real time, but the effective time is after the system is restarted. This is because if the modified XML configuration file is effective in real time, the system reads the modified XML configuration file after reading the XML configuration file before the modification. In the case where many XML configuration files are modified, the system may generate an overload of calculation. Therefore, setting the modified XML configuration file to take effect after the system is restarted can ensure system stability.
[0221] In some embodiments, during operation, the electronic device may run different applications according to user operations. Therefore, the startup status of different application processes and the SA call status between different application processes are changing dynamically. Therefore, the electronic device may determine the SA to be decoupled according to a preset period after the application is started. Periodically generate and modify a copy of the XML configuration file to obtain a modified copy of the XML configuration file. The copy of the XML configuration file includes the copy of the XML configuration file of the SA described above and / or the merged copy of the XML configuration file. Correspondingly, the modified copy of the XML configuration file includes the copy of the XML configuration file of the SA described above and / or the modified merged copy of the XML configuration file. For example, the electronic device may periodically determine the SA to be decoupled with a period of 0.01S or a period of 0.015s, and correspondingly periodically generate and modify a copy of the XML configuration file. The embodiment of the present application does not limit the duration of the period.
[0222] In some embodiments, when the electronic device determines the SA to be decoupled according to a preset cycle, the electronic device shuts down before the generation cycle of an XML configuration file copy ends, that is, before the intersection of two cycles of refreshing the XML configuration file copy. Then, after the electronic device is restarted, the ownership relationship between the SA and the process can be adjusted according to the modified XML configuration file copy obtained in the previous cycle of the current cycle corresponding to the shutdown of the electronic device. Alternatively, the electronic device generates the latest modified XML configuration file copy in response to the user's shutdown operation. In this way, after the electronic device is restarted, the ownership relationship between the SA and the process can be adjusted according to the latest modified XML configuration file copy.
[0223] In some embodiments, when the electronic device determines the SA to be decoupled according to a preset period, if in response to a user operation, it can be determined that the user instructs to close the currently running application process. In this process, the electronic device can obtain a new SA to be decoupled in real time, thereby avoiding the situation where the last modified XML configuration file obtained is not generated based on the latest SA to be decoupled when the application process is closed due to the SA to be decoupled update time point not being reached. In this way, the electronic device can adjust the association relationship between the SA and the process in real time, thereby reducing inter-process communication, saving system resources, and improving system performance.
[0224] In some embodiments, the user of an electronic device may have different usage habits for the electronic device at different times of the day. Therefore, the SA that is frequently called between processes may change at different times of the day. For example, a user of a short video application is an anchor. This user updates short videos in the short video application during the day, and needs to use the video editing function of the short video application to make short videos. In the evening, the short video application is used for live broadcast, and the camera function of the short video application is needed for live broadcast. The processes related to the short video application need to frequently call the SA related to the video editing function during the day, and need to frequently call the SA related to the camera function at night. When the user of the electronic device edits videos during the day, the SA to be decoupled in the electronic device is the SA related to the video editing function. When the user of the electronic device broadcasts live at night, the SA to be decoupled in the electronic device is the SA related to the camera function.
[0225] If the user of the electronic device no longer uses the electronic device after the live broadcast ends in the evening, the electronic device will be turned off. According to the current inter-process communication situation of the electronic device, the SA related to the camera function is the SA to be decoupled. The electronic device will establish an association between the relevant processes of the short video application that frequently performs inter-process communication at night and the SA related to the camera function. However, according to the usage habits of the user of the electronic device, after the electronic device is turned on the next day, the relevant processes of the short video application of the electronic device need to frequently call the SA of the video editing related function. At this time, because the SA of the video editing related function has not been decoupled from the original process, there will still be a large amount of inter-process communication between the short video application and the SA of the video editing related function.
[0226] Therefore, in the embodiment of the present application, the electronic device can determine the SA to be decoupled in different time periods, and use the historical SA to be decoupled in the time period as the actual SA to be decoupled, so as to generate modified copies of XML configuration files in different time periods, and make the corresponding modified copies of XML files effective in different time periods. For example, the electronic device can make the XML file copy effective when the critical point of the time period is reached, or when the electronic device is turned on in the time period, the XML file copy corresponding to the time period is effective.
[0227] Optionally, regarding the operation of setting the time period, the electronic device may be preset in the device, or may respond to the user's operation setting, or the electronic device may search for one or several time periods based on statistical results. The embodiments of the present application are not limited to this.
[0228] In some embodiments, during the process of updating the SA to be decoupled according to a preset period, the SAs with the most frequent inter-process communication retained in the SAs expected to be decoupled this week are still used as the SAs to be decoupled in the next period, so as to cope with the changes in the inter-process communication between SAs and processes caused by various situations of electronic devices, applications or processes.
[0229] In this way, the electronic device can flexibly determine the SA to be decoupled according to the actual usage of the electronic device, and adjust the association between the SA and the process, so that the association between the SA and the process of the electronic device is closer to the user's usage habits in different time periods, thereby improving system performance and user experience.
[0230] Fig.11 The flowchart of a system service management method provided by the embodiment of the present application is shown in FIG. Fig.11 The specific order below is for limitation, and it should be understood that in other embodiments, the order of some steps in the method can be interchanged according to actual needs, or some steps can be omitted or deleted. The method comprises the following steps:
[0231] S1101: The electronic device runs a first process.
[0232] In some embodiments, the electronic device starts an application and runs a process of the application in response to a user operation, wherein the process of the application is a first process.
[0233] For example, the electronic device starts a social application in response to a user operation, and the social application runs a first process.
[0234] S1102: The electronic device obtains the communication number of the system service in the first process, where the communication number includes a first communication number of the system service in the first process within the first process and a second communication number of the system service in the first process and the second process.
[0235] In some embodiments, several processes are run in the electronic device, and the processes include several system services, which provide system capabilities (functions) for the processes. Some of the functions required by the process when executing a task can be provided by the system service in the process calling the system service in the process. There are also some functions that the system service in the process cannot provide, but the system services of other processes can provide. In this case, the system service in the process needs to obtain the corresponding functions by calling the system services of other processes.
[0236] Exemplarily, the first process is a camera process, and the second process is a gallery process. When the camera process is running in a camera application, the camera-related functions required can be provided by the camera-related system services in the camera process. Then the system service in the camera process can obtain the camera-related functions by directly calling the camera-related system services within the process. If the camera process requires gallery-related functions, and the system service that provides gallery-related functions belongs to the gallery process, not the camera process. Then the system service in the camera process needs to call the gallery-related system services to the gallery process through inter-process communication to obtain the gallery-related functions.
[0237] In some embodiments, each time a system service in a process calls a system service in the process, or each time a system service in a process calls a system service between processes, a communication is generated. The first communication number of a system service in a first process in the first process is the number of communications between the system service in the first process and other system services in the first process. The second communication number between the system service in the first process and the second process is the number of communications generated when the system service in the first process calls the system service in the second process.
[0238] Exemplarily, the first communication number of the system service in the photographing process is the communication number between a certain system service in the photographing process and other system services in the photographing process. The second communication number between a certain system service in the photographing process and a process related to the gallery is the communication number generated by a certain system service in the photographing process calling a system service in a process related to the gallery.
[0239] S1103: The electronic device modifies the first configuration file of the first process and the second configuration file of the target process, and modifies the first system service in the system services in the first process from belonging to the first process to belonging to the target process, the first communication number of the first system service is less than the second communication number of the first system service, and the target process is the process in the second process that meets the preset conditions.
[0240] In some embodiments, the first communication number of the first system service is less than the second communication number of the first system service, indicating that the communication number of the first system service within the process to which it belongs is less than the communication number between processes outside the process to which it belongs. Figure 1 It can be seen from the illustrated embodiment that cross-process communication between a system service and a process other than the process to which it belongs consumes much more system energy than intra-process communication. Therefore, when the target process meets the preset conditions, the electronic device modifies the first system service from belonging to the first process to belonging to the target process by modifying the first configuration file of the first process and the second configuration file of the target process, thereby reducing inter-process communication.
[0241] In this way, when the first communication number of the first system service is less than the second communication number of the first system service and the target process meets the preset conditions, the electronic device modifies the first system service from belonging to the first process to belonging to the target process to reduce inter-process communication, thereby reducing system consumption and improving system performance.
[0242] In some embodiments, the preset condition is to use the process in the second process that communicates with the first system service the most times as the target process.
[0243] That is, the target process is the process in the second process that communicates with the first system service the most times, and the electronic device changes the first system service from belonging to the first process to belonging to the process that communicates with the first system service the most times.
[0244] Exemplarily, the second process includes several processes such as live broadcast related processes and social application related processes, and these processes need to frequently call a camera related system service in the camera process. And among the several processes, the number of communications generated by the live broadcast related processes and social application related processes calling the camera related system service is greater than the number of communications generated by the camera related system service being called by other system services in the camera process to which it belongs. And the live broadcast related process has the largest number of communications calling the camera related system service in the camera application, then the live broadcast related process is the target process. The electronic device changes the camera related system service from belonging to the camera process to belonging to the live broadcast related process.
[0245] In this way, the electronic device modifies the ownership of the first system service to the process that communicates with the first system service the most times, which can effectively reduce the calls to the first system service between processes, thereby reducing the number of communications between processes, reducing system consumption, and improving system performance.
[0246] In some embodiments, if the first system service belongs to the target process, the third communication number of the first system service in the target process is greater than the fourth communication number between the first system service and other processes, and the fourth communication number is less than the second communication number of the first system service.
[0247] If the electronic device modifies the first system service to belong to the target process, the third communication number of the first system service in the target process is the communication number of the first system service and other system services in the target process. The fourth communication number between the first system service and other processes is the inter-process communication number between the first system service and processes outside the target process to which it belongs. The second communication number is the inter-process communication number of the first system service before the ownership relationship is modified. The third communication number is greater than the fourth communication number, indicating that after the first system service is modified to belong to the target process, the communication number of the first system service in the target process is greater than the inter-process communication number of the first system service. The fourth communication number is less than the second communication number, indicating that after the first system service is modified by the electronic device to belong to the target process, the inter-process communication number of the first system service has decreased.
[0248] In this way, after the electronic device determines to modify the ownership of the first system service to belong to the target process, the number of inter-process communications of the first system service can be reduced, and the number of inter-process communications of the first system service after modification is less than the number of intra-process communications. The ownership of the first system service is modified to belong to the target process. In this way, the number of inter-process communications can be reduced, thereby saving system consumption and improving system performance.
[0249] In some embodiments, the electronic device obtains a second system service in a first process, and the first communication number of the second system service is less than the second communication number of the second system service. The electronic device obtains a first number of first system services in the second system service, and the second communication number of the first number of first system services is greater than the second communication number of other system services in the second system service.
[0250] The first communication number of the system service is less than the second communication number, indicating that the system service has more inter-process communication than intra-process communication. The electronic device selects the process whose first communication number is less than the second communication number from the system services of the first process as the second system service. That is, the electronic device selects the system service whose inter-process communication is more than the intra-process communication from the system services of the first process as the second system service. The electronic device selects the second system service whose inter-process communication is relatively frequent in the first number as the first system service according to the number of the second communication times of the second system service. Then, only the ownership relationship of the selected first system service is modified.
[0251] In some embodiments, the electronic device sorts the second system services in descending order according to the second communication times of the second system services, and selects a first number of second system services from the first order as the first system services.
[0252] In this way, the electronic device only modifies the ownership relationship between system services and processes that have more cross-process communications, which can reduce unnecessary system changes and save system resources.
[0253] In some embodiments, if the difference between the second communication number of the second system service and the first communication number is greater than a first preset value, the electronic device determines that the second system service is the first system service.
[0254] The second communication number of the second system service indicates the number of inter-process communications of the second system service. The first communication number of the second system service indicates the number of intra-process communications of the second system service. If the difference between the second communication number of the second system service and the first communication number is greater than the first preset value, indicating that the inter-process communications of the second system service are more frequent than the intra-process communications, the electronic device determines the second system service as the first system service that needs to modify the ownership relationship. If the difference between the second communication number of the second system service and the first communication number is less than the first preset value, indicating that the inter-process communications of the second system service are relatively less frequent than the intra-process communications, the electronic device does not determine the second system service as the first system service that needs to modify the ownership relationship.
[0255] In this way, the electronic device only modifies the ownership relationship between the system services and processes whose inter-process communication is more frequent than the intra-process communication, which can reduce unnecessary system changes and save system resources.
[0256] In some embodiments, the electronic device sorts the second system services in descending order according to the difference between the second communication number of the second system service and the first communication number, and selects a second number of second system services from the first ones as the first system services.
[0257] In this way, the electronic device selects a preset number of system services from the second system services, whose inter-process communication is more than intra-process communication, and only modifies their ownership relationship with the processes, which can reduce unnecessary system changes and save system resources.
[0258] In some embodiments, the first communication number of the first system service is the sum of the communication numbers of the first system service in the first process. The second communication number of the first system service is the sum of the communication numbers of the first system service and the second process.
[0259] The first communication number of the first system service is the sum of the communication numbers of the first system service in the first process, which means that the first communication number is the sum of the communication numbers of the first system service and all other system services in the first process. The second communication number of the first system service is the sum of the communication numbers of the first system service and the second process, which means that the second communication number is the sum of the communication numbers of the first system service and all system services of the second process.
[0260] Thus, the electronic device compares the first communication times and the second communication times of the system service to obtain the frequency of intra-process and inter-process communication of the system service, and then obtains the system service whose inter-process communication is more frequent than the intra-process communication as the system service that needs to modify the attribution relationship.
[0261] In some embodiments, the electronic device determines the first system service and the target process according to a preset period, and modifies the first configuration file and the second configuration file. The user's usage habits change over time, so the calling of system services in the electronic device also changes over time, and the first system service that needs to modify the attribution relationship also changes over time. As the first system service continues to change, the target process corresponding to each first system service changes accordingly. Therefore, the electronic device needs to constantly reconfirm the first system service and the corresponding target process according to the real-time situation. Therefore, the electronic device needs to determine the first system service and the target process according to the preset period, and modify the corresponding first configuration file and the second configuration file.
[0262] In this way, the electronic device determines the first system service and the target process whose attribution relationship needs to be modified according to the preset period, and modifies the attribution relationship between the system service and the target process. The attribution relationship between the system service and the target process of the electronic device can be adjusted according to the real-time usage of the electronic device by the user. The attribution relationship between the system service and the target process corresponds to the real-time usage of the electronic device by the user, thereby reducing the number of cross-process communications of the electronic device, reducing system energy consumption, and improving system performance and user experience.
[0263] In some embodiments, the electronic device retains the first system service that meets the second preset condition in the previous cycle as the first system service in this cycle.
[0264] In some embodiments, the first system services meeting the second preset condition are a third number of first system services selected from the first system services in descending order according to the magnitude of the second communication times of the first system services.
[0265] In this way, during the cycle alternation, the electronic device uses the first system service with more frequent inter-process communication determined in the previous cycle as the first system service of this cycle. This avoids possible repeated calculations of certain system services, reduces the amount of calculations of electronic devices, and ensures system stability. In addition, it can also effectively deal with the situation where the first system service obtained in this cycle is not the system service that the electronic device will frequently call through inter-process communication next time due to a brief suspension of the electronic device in this cycle or other situations. Therefore, the electronic device modifies the relationship between the first system service and the process in this cycle, and cannot reduce the subsequent inter-process communication.
[0266] In some embodiments, after the electronic device is restarted, the modified first configuration file and the modified second configuration file take effect.
[0267] Optionally, the first configuration file and the second configuration file are modified in real time according to a preset period, but the effective time is after the electronic device is restarted. This is because if the modified configuration file takes effect in real time, the electronic device reads the modified configuration file after having read the configuration file before the modification. When many configuration files are modified, the electronic device may generate an overload of computing power.
[0268] In this way, the electronic device sets the modified configuration file to take effect after the electronic device is restarted, which can avoid the electronic device reading the configuration file before modification and then reading the modified configuration file, which may cause overload of calculation, thereby ensuring the stability of the operation of the electronic device.
[0269] Combination of the above Figure 5-Figure 11 The system service management method provided by the embodiment of the present application is described in detail. Fig.12 The electronic device provided by the embodiments of the present application is described in detail.
[0270] In one possible design, Fig.12 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Fig.12 As shown, the electronic device 1200 may include: a detection unit 1201 and a processing unit 1202. The electronic device 1200 may be used to implement the system service management method involved in the above method embodiment.
[0271] Optionally, the detection unit 1201 is used to support the electronic device 1200 to perform Figure 5 S501 in; and / or, supporting the electronic device 1200 to execute Fig.11 S1101 and S1102 in.
[0272] Optionally, the processing unit 1202 is used to support the electronic device 1200 to execute Figure 5 S502-S504 in; and / or, supporting the electronic device 1200 to execute Figure 6 S601-S602 in; and / or, supporting the electronic device 1200 to execute Figure 7 S701-S703 in; and / or, supporting the electronic device 1200 to execute Figure 8 S801-S803 in; and / or, supporting the electronic device 1200 to execute Fig. 9 S901-S902 in; and / or, supporting the electronic device 1200 to execute Fig.10 S1001-S1002 in; and / or, supporting the electronic device 1200 to execute Fig.11S1103 in.
[0273] The operations and / or functions of each unit in the first device 1200 are respectively for implementing the corresponding processes of the system service management method in the above method embodiment. All relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional unit, and will not be repeated here for the sake of brevity.
[0274] Optionally, Fig.12 The electronic device 1200 shown may also include a storage unit ( Fig.12 (not shown), the storage unit stores a program or instruction. When the detection unit 1201 and the processing unit 1202 execute the program or instruction, Fig.12 The electronic device 1200 shown can execute the image processing method in the above method embodiment.
[0275] Fig.12 The technical effects of the electronic device 1200 shown can refer to the technical effects of the system service management method in the above method embodiment, which will not be repeated here.
[0276] In addition to being in the form of the electronic device 1200, the technical solution provided in the present application may also be a functional unit or chip in the electronic device, or a device used in conjunction with the electronic device.
[0277] An embodiment of the present application also provides a chip system, including: a processor, the processor is coupled to a memory, the memory is used to store programs or instructions, when the program or instructions are executed by the processor, the chip system implements the method in any of the above method embodiments.
[0278] Optionally, the processor in the chip system may be one or more. The processor may be implemented by hardware or by software. When implemented by hardware, the processor may be a logic circuit, an integrated circuit, etc. When implemented by software, the processor may be a general-purpose processor implemented by reading software code stored in a memory.
[0279] Optionally, the memory in the chip system may also be one or more. The memory may be integrated with the processor or may be separately arranged with the processor, which is not limited in the embodiments of the present application. Exemplarily, the memory may be a non-transient processor, such as a read-only memory ROM, which may be integrated with the processor on the same chip or may be arranged on different chips respectively. The embodiments of the present application do not specifically limit the type of memory and the arrangement of the memory and the processor.
[0280] Exemplarily, the chip system can be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), a central processor unit (CPU), a network processor (NP), a digital signal processor (DSP), a microcontroller unit (MCU), a programmable logic device (PLD) or other integrated chips.
[0281] It should be understood that each step in the above method embodiment can be completed by an integrated logic circuit of hardware in a processor or by instructions in the form of software. The method steps disclosed in the embodiments of the present application can be directly embodied as being executed by a hardware processor, or by a combination of hardware and software modules in a processor.
[0282] An embodiment of the present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program runs on a computer, the computer executes the above-mentioned related steps to implement the data synchronization method in the above-mentioned embodiment.
[0283] An embodiment of the present application also provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute the above-mentioned related steps to implement the data synchronization method in the above-mentioned embodiment.
[0284] In addition, an embodiment of the present application further provides a device. The device may be a component or a module, and the device may include one or more processors and a memory connected to each other. The memory is used to store a computer program. When the computer program is executed by one or more processors, the device performs the data synchronization method in the above-mentioned method embodiments.
[0285] Among them, the device, computer-readable storage medium, computer program product or chip provided in the embodiments of the present application are used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
[0286] The steps of the method or algorithm described in conjunction with the disclosure of the embodiments of the present application can be implemented in hardware or by executing software instructions by a processor. The software instructions can be composed of corresponding software modules, and the software modules can be stored in random access memory (RAM), flash memory, read only memory (ROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, CD-ROMs or any other form of storage medium known in the art. An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and can write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an application specific integrated circuit (ASIC).
[0287] Through the description of the above implementation methods, those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In practical applications, the above-mentioned functions can be assigned to different functional modules as needed. That is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device and unit described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0288] In the several embodiments provided in the present application, it should be understood that the disclosed method can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of modules or units, which can be electrical, mechanical or other forms.
[0289] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0290] Computer-readable storage media include, but are not limited to, any of the following: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and other media that can store program codes.
[0291] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto, and any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A system service management method, characterized in that: Applied to electronic equipment, the method comprises: Run the first process; Acquire a communication number of the system service in the first process, the communication number including a first communication number of the system service in the first process within the first process, and a second communication number of the system service in the first process and a second process; Modify a first configuration file of the first process and a second configuration file of the target process, change a first system service in the system services in the first process from belonging to the first process to belonging to the target process, the first communication number of the first system service is less than the second communication number of the first system service, and the target process is a process in the second process that meets a preset condition.
2. The method according to claim 1, characterized in that The preset condition is to use the process that communicates with the first system service the most times among the second processes as the target process.
3. The method according to claim 1 or 2, characterized in that: If the first system service belongs to the target process, the third communication number of the first system service in the target process is greater than the fourth communication number of the first system service with other processes, and the fourth communication number is less than the second communication number of the first system service.
4. The method according to any one of claims 1 to 3, characterized in that: Before modifying the first configuration file of the first process and the second configuration file of the target process to modify the first system service in the system services in the first process from belonging to the first process to belonging to the target process, the method further includes: Acquire a second system service in the first process, wherein a first communication number of the second system service is less than a second communication number of the second system service; A first number of the first system services in the second system services is obtained, wherein the second communication times of the first number of the first system services are greater than the second communication times of other system services in the second system services.
5. The method according to any one of claims 1 to 4, characterized in that: The first communication number of the first system service is the sum of the communication numbers of the first system service in the first process; the second communication number of the first system service is the sum of the communication numbers of the first system service and the second process.
6. The method according to any one of claims 1 to 5, characterized in that: The step of modifying the first configuration file of the first process and the second configuration file of the target process, and modifying the first system service in the system services in the first process from belonging to the first process to belonging to the target process, includes: The first system service and the target process are determined according to a preset period, and the first configuration file and the second configuration file are modified.
7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: After the electronic device is restarted, the modified first configuration file and the modified second configuration file take effect.
8. An electronic device, characterized in that: include: A processor and a memory, wherein the memory is coupled to the processor, the memory is used to store computer program code, the computer program code includes computer instructions, and when the processor reads the computer instructions from the memory, the electronic device executes the method as described in any one of claims 1-7.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium comprises a computer program, and when the computer program is executed on an electronic device, the electronic device is enabled to execute the method according to any one of claims 1 to 7.
10. A computer program product, characterized in that When the computer program product is executed on a computer, the computer is caused to execute the method according to any one of claims 1 to 7.