WO2019128573A1 - Information processing method, apparatus, computer device and computer-readable storage medium - Google Patents

Information processing method, apparatus, computer device and computer-readable storage medium Download PDF

Info

Publication number
WO2019128573A1
WO2019128573A1 PCT/CN2018/117010 CN2018117010W WO2019128573A1 WO 2019128573 A1 WO2019128573 A1 WO 2019128573A1 CN 2018117010 W CN2018117010 W CN 2018117010W WO 2019128573 A1 WO2019128573 A1 WO 2019128573A1
Authority
WO
WIPO (PCT)
Prior art keywords
event
user space
resource
communication
priority
Prior art date
Application number
PCT/CN2018/117010
Other languages
French (fr)
Chinese (zh)
Inventor
方攀
陈岩
Original Assignee
Oppo广东移动通信有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2019128573A1 publication Critical patent/WO2019128573A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/52Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4418Suspend and resume; Hibernate and awake
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/468Specific access rights for resources, e.g. using capability register
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/485Task life-cycle, e.g. stopping, restarting, resuming execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication

Definitions

  • the present application relates to the field of computer technology, and in particular, to an information processing method, apparatus, computer device, and computer readable storage medium.
  • kernel space In the Linux operating system, the system can be divided into two parts: kernel space and user space. Among them, the system core software runs in the kernel space, and the normal application runs in the user space. The above kernel space has higher permissions and the user space has lower permissions. Kernel space is aware of the underlying changes in the application.
  • the embodiment of the present application provides an information processing method, apparatus, computer device, and computer readable storage medium.
  • An information processing method includes:
  • the classified process event includes a process communication event, and the process communication event is generated according to communication between processes;
  • the kernel space asynchronously transmits the classified process event and the corresponding process to the user space, so that the user space adjusts resource restrictions on the process according to the process communication event.
  • An information processing apparatus comprising:
  • a classification module configured to acquire a process event in the kernel space, and classify the process event to obtain a classified process event; the classified process event includes a process communication event, and the process communication event is based on an interprocess process Communication generated
  • a transmitting module configured to: the kernel space asynchronously transmits the classified process event and the corresponding process to the user space, so that the user space adjusts resource restrictions on the process according to the process communication event.
  • a computer apparatus comprising a memory and a processor, the memory storing a computer program, the computer program being executed by the processor, causing the processor to perform the operations of the method as described above.
  • a computer readable storage medium having stored thereon a computer program that, when executed by a processor, implements the operations of the methods described above.
  • the kernel space asynchronously transmits the process event to the user space, which improves the efficiency of the user space to obtain the underlying change information of the process.
  • the process of classifying process events through kernel space, the method of available resources in the user space decision process, and the compatibility of user space rich strategy and kernel space can timely acquire the characteristics of process state changes.
  • resources are restricted to processes, processes can be avoided due to resources. Limit the problem that caused the state to be abnormal.
  • FIG. 1 is a schematic diagram showing the internal structure of a computer device in an embodiment.
  • FIG. 2 is a partial architectural diagram of a computer device in an embodiment.
  • 3 is a flow chart of an information processing method in an embodiment.
  • FIG. 4 is a flow chart of an information processing method in another embodiment.
  • Figure 5 is a flow chart of an information processing method in another embodiment.
  • Figure 6 is a flow chart of an information processing method in another embodiment.
  • Fig. 7 is a block diagram showing the structure of an information processing apparatus in an embodiment.
  • Fig. 8 is a block diagram showing the structure of an information processing apparatus in another embodiment.
  • Fig. 9 is a block diagram showing the structure of an information processing apparatus in another embodiment.
  • Figure 10 is a block diagram showing the structure of an information processing apparatus in another embodiment.
  • FIG. 11 is a block diagram showing a partial structure of a mobile phone related to a computer device according to an embodiment of the present application.
  • FIG. 1 is a schematic diagram showing the internal structure of a computer device in an embodiment.
  • the computer device includes a processor, a memory, and a network interface connected by a system bus.
  • the processor is used to provide computing and control capabilities to support the operation of the entire computer device.
  • the memory is used to store data, programs, etc., and at least one computer program is stored on the memory, and the computer program can be executed by the processor to implement the information processing method applicable to the computer device provided in the embodiment of the present application.
  • the memory can include a non-volatile storage medium and an internal memory.
  • the non-volatile storage medium stores an operating system and a computer program.
  • the computer program can be executed by a processor for implementing an information processing method provided by the following various embodiments.
  • the internal memory provides a cached operating environment for operating system computer programs in a non-volatile storage medium.
  • the network interface may be an Ethernet card or a wireless network card or the like for communicating with an external computer device.
  • the computer device can be a cell phone, a tablet or a personal digital assistant or a wearable device or the like.
  • FIG. 1 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation of the computer device to which the solution of the present application is applied.
  • the specific computer device may It includes more or fewer components than those shown in the figures, or some components are combined, or have different component arrangements.
  • the computer device further includes a network interface connected through a system bus, and the network interface may be an Ethernet card or a wireless network card, etc., for communicating with an external computer device, for example, for communicating with a server.
  • the architecture of the computer device includes a Java spatial layer 210, a local framework layer 220, and a Kernel space layer 230.
  • the freeze and thaw module 212 is included in the Java space layer.
  • the freeze and thaw module 212 is used to implement a freeze policy for each application, such as freezing the application that consumes the background.
  • the local framework layer 220 includes a resource priority and restriction management module 222 and a platform freeze management module 224.
  • the resource priority and restriction management module 222 can perform different resource restrictions on different applications, so that different applications are in different resource priorities.
  • the resource priority and restriction management module 222 can also adjust the resource priority of the application according to the needs of the upper layer so that the computer device can use the resource reasonably.
  • the platform freeze management module 224 can determine the level of resource restriction on the process application according to the duration of the application entering the background.
  • the platform freeze management module 224 can preset different resource limit levels, and the longer the application enters the background, the platform The higher the level of resource restriction on the application by the freeze management module 224, the higher the resource limit on the application.
  • the foregoing resource restriction level may include: a CPU restricted sleep mode, a CPU freeze sleep mode, and a process deep freeze mode.
  • the CPU limit sleep mode refers to limiting the central processing unit (CPU) resources that can be used by the application process, so that the application process can use less CPU resources; in the CPU limited sleep mode, Further limit the network resources and input/output (I/O) resources available to the application's processes.
  • CPU freeze sleep mode means that the process of the application is prohibited from using CPU resources, network resources and I/O resources, but the memory resources occupied by the application process are not recycled.
  • the above CPU freeze mode is the depth of resources available to the application. Restricted mode.
  • CPU freeze sleep mode refers to prohibiting the application process from using CPU resources, network resources, and I/O resources, while reclaiming the memory resources occupied by the application's processes.
  • the interface module of the local framework layer 220 includes a binder interface developed to the upper layer.
  • the upper framework or application can send a resource restriction instruction to the resource restriction management module 222 and send a freeze instruction to the platform freeze management module 224 through the binder interface.
  • the kernel space layer 230 includes a UID management module 231, a Cgroup module 232, a binder management module 233, a process memory recovery module 234, and a timeout freeze exit module 235.
  • the current process management of the application is implemented based on the process identification (PID).
  • the process does not correspond to the application, which is not conducive to unified management of resources corresponding to all processes of an application.
  • the UID management module 231 can manage the resources of the application through the User Identifier (UID) of the application, and can also freeze the application by the UID of the application.
  • the Cgroup module 232 can provide resource-based mechanisms based on CPU, CPUSET, memory, I/O resources, and Net.
  • the binder management module 233 can be used to limit the priority of the binder communication between background processes.
  • the process memory recovery module 234 is configured to implement the process deep freeze mode. When the process enters the process deep freeze mode, the file area of the process is released, thereby saving memory and speeding up the next time the application corresponding to the process starts.
  • the timeout freeze exit module 235 is used to solve the problem that the process has an abnormality in the freeze timeout.
  • an information processing method includes:
  • a process event is obtained in the kernel space, and the process event is classified to obtain a classified process event; the classified process event includes a process communication event, and the process communication event is generated according to communication between processes.
  • kernel space stores the kernel code and data
  • user space stores the application code and data. Kernel space has higher permissions and user space has lower permissions.
  • a process is a run-time activity of a program with certain independence about a data set.
  • An application includes multiple processes at runtime.
  • process events are generated due to changes in the inter-process communication mechanism and process state.
  • the process events generated by the process can be classified in the kernel space to obtain the classified process events.
  • the above classified process events may include process communication events and process status events.
  • the above process communication event is an event generated according to inter-process communication
  • the above process status event is an event generated due to a change in the process state.
  • the kernel space asynchronously transfers the classified process event and the corresponding process to the user space, so that the user space adjusts the resource limit of the process according to the process communication event.
  • kernel space and user space mainly communicate through asynchronous netlink.
  • kernel space can follow the package structure agreed by kernel space and user space, and generate different data according to different process events.
  • the kernel space can transfer the classified process event, the process corresponding to the event, and the cause of the event to the user space when the classified process event and the corresponding process are asynchronously transmitted to the user space.
  • the socket arrival event may be generated, and the kernel space may cause the socket arrival event, the UID of the background process, and the socket arrival event to occur: the background process receives the communication message of the foreground process. Transfer to user space.
  • the user space After receiving the data asynchronously transmitted by the kernel space, the user space can parse the received data, obtain the underlying changes of the process, and then update the resource limit of the process according to the change of the underlying process.
  • the resource limitation of the user space to the process mainly includes limiting the CPU resources, I/O resources, network resources, and memory resources that can be used by the process, so that the resources between the processes can be properly allocated.
  • the limitation of the resources that can be used by the application is mainly performed by the user space, and the user space can put the applications corresponding to the different level resources into different resource groups through the Cgroup mechanism.
  • User space can call rich libraries and rich policies to determine the restrictions on the resources available to the application.
  • the resource limit level of the program due to the low user space permissions, only the user space information and policies cannot update the application according to the changes of the underlying application.
  • the kernel space asynchronously transmits the process event to the user space, thereby improving the efficiency of the user space to obtain the underlying change information of the process.
  • the process of classifying process events through kernel space, the method of available resources in the user space decision process, and the compatibility of user space rich strategy and kernel space can timely acquire the characteristics of process state changes.
  • resources are restricted to processes, processes can be avoided due to resources. Limit the problem that caused the state to be abnormal.
  • the user space adjusts resource limits to the process based on the process communication event including at least one of the following methods:
  • Inter-process communication events include binder start events, binder idle events, and socket arrival events.
  • User space adjusts resource limits for processes based on the received process communication events.
  • Binder is an important interprocess communication mechanism in mobile operating systems. Most of the communication between different processes is binder communication. Among them, the kernel space can set two events for the binder communication: the binder startup event and the binder idle event. Among them, the binder startup event means that the process will immediately generate a binder startup event once it receives the binder sent by other processes. The binder idle event means that the process no longer has a binder session inventory after the preset time period, and a binder idle event is generated. When the process generates a binder startup event, it indicates that there is communication between the process and other processes. The user space can increase the resource priority of the above process and increase the resources available to the process. When a process generates a binder idle event, it indicates that there is no communication between the process and other processes. The user space can reduce the resource priority of the above process and reduce the resources available to the process.
  • the binder startup event means that the process will immediately generate a binder startup event once it receives the binder sent by other processes.
  • Sockets are also a widely used communication mechanism in mobile operating systems.
  • the socket mechanism is often used in Android systems.
  • Kernel space sets an event for socket communication: the socket arrives at the event.
  • the socket arrival event is that when the process accepts the socket sent by another process, a socket arrival event is generated.
  • a process When a process generates a socket arrival event, it indicates that there is communication between the process and other processes.
  • the user space can increase the resource priority of the above process and increase the resources available to the process.
  • the arrival of the event through the socket can solve the problem that the communication application cannot receive the message in time when the resource is restricted.
  • the process list can be set in the kernel space. Only when the process receives the binder or socket in the process list, the corresponding process communication event will be generated.
  • the above resource priority is the level of restriction on the resources available to the process.
  • the user space can set different resource priorities for the application. When the above resource priorities are different, the restrictions on the resources that can be used by the application process are different, that is, the user space can implement the application by setting the resource priority to the application.
  • the process sets the resource priority.
  • User space allows applications with different resource priorities to be placed in different resource groups, facilitating user space management of the application.
  • the user space prioritizes the application resource includes: the user space sets the resource priority corresponding to the application, wherein the resource priority corresponds to the size of the total resource that the application can use.
  • the user space setting application has a resource priority of 1 and the application can use 80% of the total resources, the application can use 80% of the CPU resources, 80% of the memory resources, and 80% of the I/O resources, respectively. 80% of network resources.
  • User space can also set resource priorities for resources that can be used by applications, including CPU resource priority, memory resource priority, I/O resource priority, and network resource priority.
  • the priority of each resource corresponding to an application may be different.
  • the CPU resource priority of the application is 1 level, 90% of the total CPU resources can be used; the corresponding memory resource priority is 2, and the total memory resource can be used. 75%; the corresponding I/O resource has a priority of 4, which can use 30% of the total I/O resources; the corresponding network resource has a priority of 2, and can use 80% of the total network resources.
  • the user space can adjust the resource priority corresponding to the process by using the received process event, and the resource limitation of the process in the user space is more rapid and accurate, and the accuracy of the resource limitation of the user space to the process is improved.
  • the resource priority of the promotion process includes:
  • the user space can assign different resource priorities to different applications, and the processes corresponding to the same application have the same resource priority, and the processes corresponding to different applications can have different resource priorities.
  • the user space is used to raise the priority of the resource, if the process with the priority of the elevated resource is detected as the background process, the resource priority of the currently running foreground process is obtained.
  • the resource priority of the background process can be lower than the resource priority of the foreground process.
  • the resources available to the background process are lower than the resources available to the foreground process.
  • the user space can increase the resource priority of the background process, so that the resource priority of the background process is lower than the resource priority of the foreground process.
  • the user space increases the priority of the background process, including: increasing the total resource priority of the background process, that is, the priority of each resource that can be used by the background process can be improved; or upgrading one of the background processes or
  • the priority of multiple resources such as increasing the CPU resource priority of the background process, makes the CPU resources available to the background process increase.
  • the priority of the resource of the foreground process is higher than that of the background process, and the priority of the resource of the background process is higher than that of the foreground process.
  • the process resources are preempted and the foreground process is running slowly.
  • the classified process event further includes a process state event, and the process state event is generated according to a change of the process in the life cycle; the user space may update the process information of the process in the user space according to the process state event.
  • Kernel space also monitors the process's lifecycle changes and generates process state events based on changes in the lifecycle of the process.
  • a process creates, exits, or changes a UID, it generates a corresponding process state event.
  • the process state event indicates that the process state has changed.
  • user space receives a process state event, it can maintain updates to the process and application state based on the process state events described above.
  • the user space may update the process and the process state according to the process state event, so that the user space can maintain the update of the process, so that the user space does not need to query when the resource is restricted to the process. Update the process and process state to improve the efficiency of user space.
  • the above method further includes:
  • the user space acquires the duration of the process entering the background.
  • the duration of the process entering the background reaches a preset duration, the process is frozen; freezing the process refers to prohibiting the process from using system resources.
  • the resource limitation of the process by the computer device may include: a normal restriction mode, a depth restriction mode, and a freeze mode.
  • the common restriction mode is to limit the CPU resources that the process can use, and correspondingly limit other resources that the process can use, such as I/O resources and network resources.
  • the deep limit mode prohibits the process from using CPU resources and network resources. There are restrictions on I/O resources, but there are no restrictions on the memory resources used by the process.
  • the freeze mode is that the process uses all system resources, that is, prohibits the process from using CPU resources, network resources, and I/O resources, and reclaims the memory resources occupied by the process.
  • the user space can obtain the length of time that the process enters the background. When the process reaches the background for a preset period of time, it can be determined that the process is not enabled for a long time, and the process is frozen to release the resources occupied by the process.
  • the process when the duration of the process entering the background reaches a preset duration, the process may be frozen, and the system resources occupied by the process are released, so that the computer device can reasonably regulate the resources used by the process and reduce the power consumption of the computer device.
  • the above method further includes:
  • Operation 308 when the user space receives the process communication event corresponding to the process in the frozen state, wake up the process in the frozen state and adjust the resource limit of the process.
  • the process cannot use system resources.
  • the process in the frozen state may be awakened, so that the process can use the system resource to respond to the process communication event.
  • the user space wakes up the process in the frozen state, including: switching the process from the freeze mode to the normal limit mode, so that the process can use the system resources.
  • the user space can also adjust the resource priority of the process according to the type of the process communication event received.
  • the user space when receiving the process communication event corresponding to the process in the frozen state, the user space may wake up the process in the frozen state and adjust the resource limit of the process, so that the frozen process can respond in time. Communication messages of other processes improve the resource control rate of the user space to the process.
  • the above method further includes:
  • a computer device uses two sets of code to terminate a process, one set of code to terminate the unfrozen process and another set of code to terminate the frozen process.
  • the computer device When the computer device receives the termination command for the frozen process, if it is detected that the frozen process is in a frozen state, the process in the frozen state is thawed, and the thawed process is set to a non-freeze state, then thawed The subsequent process can respond correctly to the above termination command, that is, the above thawed process can be closed.
  • the method in the embodiment of the present application can implement the method of first thawing and then terminating the frozen process to implement the secure termination of the frozen process, and avoid the situation that the process cannot be terminated.
  • the computer device can terminate the frozen according to the unified termination instruction.
  • the process and the unfrozen process realize the compatibility of terminating the frozen process and terminating the unfrozen process, reducing the difficulty of software development and facilitating the maintenance of the mobile operating system.
  • an information processing method includes:
  • the kernel space asynchronously transfers the classified process event and the corresponding process to the user space, so that the user space adjusts the resource limit of the process according to the process communication event.
  • the user space adjusts the resource limitation of the process according to the process communication event, including at least one of the following methods: the user space starts the event promotion event resource priority according to the binder; and the user space reduces the resource priority of the process according to the binder idle event; The user space is based on the resource priority of the socket arrival event promotion process.
  • the resource priority of the process is as follows: when the process of detecting the priority of the resource to be upgraded is the background process, the resource priority of the currently running foreground process is obtained; the resource priority of the background process is raised, and the background process is improved. The resource priority is no higher than the resource priority of the foreground process.
  • the classified process event further includes a process state event, and the process state event is generated according to the change of the process in the life cycle; the user space updates the process information of the process in the user space according to the process state event.
  • the method further includes: a time period in which the user space acquisition process enters the background, and when the process enters the background for a preset duration, the process is frozen; and freezing the process refers to prohibiting the process from using the system resource.
  • the method further includes: when the user space receives the process communication event corresponding to the process in the frozen state, the process in the frozen state is awakened and the resource restriction on the process is adjusted.
  • the method further includes: when the user space receives the termination command for the process in the frozen state, unfreezing the process, and setting the thawed process to a non-freeze state, and terminating the thawed process according to the termination command.
  • Fig. 7 is a block diagram showing the structure of an information processing apparatus of an embodiment. As shown in FIG. 7, an information processing apparatus includes:
  • the classification module 702 is configured to acquire process events in the kernel space, and classify the process events to obtain the classified process events.
  • the classified process events include process communication events, and process communication events are generated based on communication between processes.
  • the transmitting module 704 is configured to, in the kernel space, asynchronously transfer the classified process event and the corresponding process to the user space, so that the user space adjusts resource limits on the process according to the process communication event.
  • the user space adjusts resource limits to the process based on the process communication event including at least one of the following methods:
  • the resource priority of the user space promotion process includes: if the process of detecting the priority of the resource to be upgraded is a background process, obtaining the resource priority of the currently running foreground process. The resource priority of the background process is increased. After the promotion, the resource priority of the background process is not higher than the resource priority of the foreground process.
  • the classified process event further includes a process state event that is generated based on changes in the life cycle of the process.
  • the transfer module 704 transmits the above process status event to the user space
  • the user space updates the process information of the process in the user space according to the process status event.
  • FIG. 8 is a structural block diagram of an information processing module in another embodiment.
  • an information processing apparatus includes: a classification module 802, a transmission module 804, and a freezing module 806.
  • the classification module 802 and the transmission module 804 have the same functions as the corresponding modules in FIG. 7.
  • the freeze module 806 is used for the duration of the user space acquisition process entering the background. If the duration of the process entering the background reaches a preset duration, the process is frozen. Freezing a process means disabling the process from using system resources.
  • an information processing apparatus includes: a classification module 902, a transmission module 904, and a wakeup module 906.
  • the classification module 902 and the transmission module 904 have the same functions as the corresponding modules in FIG. 7.
  • the wake-up module 906 is configured to wake up a process in a frozen state and adjust a resource limit to the process if the user space receives a process communication event corresponding to the process in the frozen state.
  • FIG. 10 is a structural block diagram of an information processing module in another embodiment.
  • an information processing apparatus includes: a classification module 1002, a transmission module 1004, a defrosting module 1006, and a termination module 1008.
  • the classification module 1002 and the transmission module 1004 have the same functions as the corresponding modules in FIG. 7.
  • the defrosting module 1006 is configured to unfreeze the process if the user space receives the termination command for the process in the frozen state, and set the thawing process to the unfreeze state.
  • the termination module 1008 is configured to terminate the post-thawing process according to the termination command.
  • each module in the above information processing apparatus is for illustrative purposes only. In other embodiments, the information processing apparatus may be divided into different modules as needed to complete all or part of the functions of the information processing apparatus.
  • the various modules in the above information processing apparatus may be implemented in whole or in part by software, hardware, and combinations thereof.
  • Each of the above modules may be embedded in or independent of the processor in the computer device, or may be stored in a memory in the computer device in a software form, so that the processor invokes the operations corresponding to the above modules.
  • each module in the information processing apparatus provided in the embodiments of the present application may be in the form of a computer program.
  • the computer program can run on a terminal or server.
  • the program modules of the computer program can be stored on the memory of the terminal or server.
  • the operation of the method described in the embodiments of the present application is implemented when the computer program is executed by the processor.
  • the embodiment of the present application also provides a computer readable storage medium.
  • One or more non-transitory computer readable storage media containing computer executable instructions that, when executed by one or more processors, cause the processor to perform the operations of the information processing methods in the embodiments of the present application.
  • a computer program product comprising instructions which, when run on a computer, cause the computer to perform the operations of the information processing method of the embodiments of the present application.
  • the embodiment of the present application also provides a computer device. As shown in FIG. 11 , for the convenience of description, only the parts related to the embodiments of the present application are shown. For details that are not disclosed, refer to the method part of the embodiment of the present application.
  • the computer device may be any terminal device including a mobile phone, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), a vehicle-mounted computer, a wearable device, and the like, taking a computer device as a mobile phone as an example. :
  • FIG. 11 is a block diagram showing a part of a structure of a mobile phone related to a computer device according to an embodiment of the present application.
  • the mobile phone includes: a radio frequency (RF) circuit 1110 , a memory 1120 , an input unit 1130 , a display unit 1140 , a sensor 1150 , an audio circuit 1160 , a wireless fidelity (WiFi) module 1170 , and a processor 1180 .
  • RF radio frequency
  • the RF circuit 1110 can be used for receiving and transmitting information during the transmission and reception of information or during the call.
  • the downlink information of the base station can be received and processed by the processor 1180.
  • the uplink data can also be sent to the base station.
  • RF circuits include, but are not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like.
  • LNA Low Noise Amplifier
  • RF circuitry 1110 can also communicate with the network and other devices via wireless communication.
  • the above wireless communication may use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (Code Division). Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), e-mail, Short Messaging Service (SMS), and the like.
  • GSM Global System of Mobile communication
  • GPRS General Pack
  • the memory 1120 can be used to store software programs and modules, and the processor 1180 executes various functional applications and data processing of the mobile phone by running software programs and modules stored in the memory 1120.
  • the memory 1120 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as an application of a sound playing function, an application of an image playing function, etc.);
  • the data storage area can store data (such as audio data, address book, etc.) created according to the use of the mobile phone.
  • memory 1120 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
  • the input unit 1130 can be configured to receive input numeric or character information and to generate key signal inputs related to user settings and function control of the handset 1100.
  • the input unit 1130 may include a touch panel 1131 and other input devices 1132.
  • the touch panel 1131 which may also be referred to as a touch screen, can collect touch operations on or near the user (such as a user using a finger, a stylus, or the like on the touch panel 1131 or near the touch panel 1131. Operation) and drive the corresponding connection device according to a preset program.
  • the touch panel 1131 may include two parts of a touch detection device and a touch controller.
  • the touch detection device detects the touch orientation of the user, and detects a signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts the touch information into contact coordinates, and sends the touch information.
  • the processor 1180 is provided and can receive commands from the processor 1180 and execute them.
  • the touch panel 1131 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves.
  • the input unit 1130 may also include other input devices 1132.
  • other input devices 1132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.).
  • the display unit 1140 can be used to display information input by the user or information provided to the user as well as various menus of the mobile phone.
  • the display unit 1140 may include a display panel 1141.
  • the display panel 1141 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
  • the touch panel 1131 can cover the display panel 1141. When the touch panel 1131 detects a touch operation thereon or nearby, the touch panel 1131 transmits to the processor 1180 to determine the type of the touch event, and then the processor 1180 is The type of touch event provides a corresponding visual output on display panel 1141.
  • the touch panel 1131 and the display panel 1141 are used as two independent components to implement the input and input functions of the mobile phone, in some embodiments, the touch panel 1131 and the display panel 1141 may be integrated. Realize the input and output functions of the phone.
  • the handset 1100 can also include at least one sensor 1150, such as a light sensor, motion sensor, and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 1141 according to the brightness of the ambient light, and the proximity sensor may close the display panel 1141 and/or when the mobile phone moves to the ear. Or backlight.
  • the motion sensor may include an acceleration sensor, and the acceleration sensor can detect the magnitude of the acceleration in each direction, and the magnitude and direction of the gravity can be detected at rest, and can be used to identify the gesture of the mobile phone (such as horizontal and vertical screen switching), and vibration recognition related functions (such as Pedometer, tapping, etc.; in addition, the phone can also be equipped with gyroscopes, barometers, hygrometers, thermometers, infrared sensors and other sensors.
  • the acceleration sensor can detect the magnitude of the acceleration in each direction, and the magnitude and direction of the gravity can be detected at rest, and can be used to identify the gesture of the mobile phone (such as horizontal and vertical screen switching), and vibration recognition related functions (such as Pedometer, tapping, etc.; in addition, the phone can also be equipped with gyroscopes, barometers, hygrometers, thermometers, infrared sensors and other sensors.
  • Audio circuitry 1160, speaker 1161, and microphone 1162 can provide an audio interface between the user and the handset.
  • the audio circuit 1160 can transmit the converted electrical data of the received audio data to the speaker 1161, and convert it into a sound signal output by the speaker 1161; on the other hand, the microphone 1162 converts the collected sound signal into an electrical signal, and the audio circuit 1160 After receiving, it is converted into audio data, and then processed by the audio data output processor 1180, transmitted to another mobile phone via the RF circuit 1110, or outputted to the memory 1120 for subsequent processing.
  • WiFi is a short-range wireless transmission technology.
  • the mobile phone can help users to send and receive emails, browse web pages and access streaming media through the WiFi module 1170, which provides users with wireless broadband Internet access.
  • FIG. 11 shows the WiFi module 1170, it will be understood that it does not belong to the essential configuration of the handset 1100 and may be omitted as needed.
  • the processor 1180 is a control center for the handset, which connects various portions of the entire handset using various interfaces and lines, by executing or executing software programs and/or modules stored in the memory 1120, and invoking data stored in the memory 1120, The phone's various functions and processing data, so that the overall monitoring of the phone.
  • processor 1180 can include one or more processing units.
  • the processor 1180 can integrate an application processor and a modem processor, wherein the application processor primarily processes an operating system, a user interface, an application, etc.; the modem processor primarily processes wireless communications. It will be appreciated that the above described modem processor may also not be integrated into the processor 1180.
  • the handset 1100 also includes a power source 1190 (such as a battery) that supplies power to the various components.
  • a power source 1190 such as a battery
  • the power source can be logically coupled to the processor 1180 via a power management system to manage functions such as charging, discharging, and power management through the power management system.
  • the handset 1100 can also include a camera, a Bluetooth module, and the like.
  • the processor 1180 included in the computer device implements the operation of the information processing method in the embodiment of the present application when executing the computer program stored in the memory.
  • Non-volatile memory can include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
  • Volatile memory can include random access memory (RAM), which acts as an external cache.
  • RAM is available in a variety of formats, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronization.
  • SRAM static RAM
  • DRAM dynamic RAM
  • SDRAM synchronous DRAM
  • DDR SDRAM dual data rate SDRAM
  • ESDRAM enhanced SDRAM
  • synchronization Link (Synchlink) DRAM (SLDRAM), Memory Bus (Rambus) Direct RAM (RDRAM), Direct Memory Bus Dynamic RAM (DRDRAM), and Memory Bus Dynamic RAM (RDRAM).

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Stored Programmes (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

An information processing method, comprising: acquiring process events from a kernel space, and classifying the process events to obtain classified process events; the classified process events comprise process communication events, wherein the process communication events are generated according to communication between processes (302); the kernel space transmitting the classified process events and corresponding process asynchronization to a user space such that the user space adjusts resource constraints of the processes according to the process communication events (304).

Description

信息处理方法、装置、计算机设备和计算机可读存储介质Information processing method, device, computer device and computer readable storage medium
相关申请的交叉引用Cross-reference to related applications
本申请要求于2017年12月29日提交中国专利局、申请号为201711480459.6、发明名称为“信息处理方法、装置、计算机设备和计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese Patent Application filed on Dec. 29, 2017, the Chinese Patent Application No. 201711480459.6, entitled "Information Processing Method, Apparatus, Computer Equipment, and Computer Readable Storage Medium", the entire contents of which is hereby incorporated by reference. This is incorporated herein by reference.
技术领域Technical field
本申请涉及计算机技术领域,特别是涉及一种信息处理方法、装置、计算机设备和计算机可读存储介质。The present application relates to the field of computer technology, and in particular, to an information processing method, apparatus, computer device, and computer readable storage medium.
背景技术Background technique
在Linux操作***中,***可分为内核空间和用户空间两部分。其中,***核心软件运行于内核空间,普通应用程序运行于用户空间。上述内核空间的权限较高,用户空间的权限较低。内核空间可感知应用程序的底层变化。In the Linux operating system, the system can be divided into two parts: kernel space and user space. Among them, the system core software runs in the kernel space, and the normal application runs in the user space. The above kernel space has higher permissions and the user space has lower permissions. Kernel space is aware of the underlying changes in the application.
发明内容Summary of the invention
本申请实施例提供一种信息处理方法、装置、计算机设备和计算机可读存储介质。The embodiment of the present application provides an information processing method, apparatus, computer device, and computer readable storage medium.
一种信息处理方法,包括:An information processing method includes:
在内核空间中获取进程事件,并对所述进程事件分类,得到分类后的进程事件;所述分类后的进程事件包括进程通信事件,所述进程通信事件是根据进程间的通信生成的;Obtaining a process event in the kernel space, and classifying the process event to obtain a classified process event; the classified process event includes a process communication event, and the process communication event is generated according to communication between processes;
所述内核空间将所述分类后的进程事件和对应的进程异步传送给用户空间,以使所述用户空间根据所述进程通信事件调整对所述进程的资源限制。The kernel space asynchronously transmits the classified process event and the corresponding process to the user space, so that the user space adjusts resource restrictions on the process according to the process communication event.
一种信息处理装置,包括:An information processing apparatus comprising:
分类模块,用于在内核空间中获取进程事件,并对所述进程事件分类,得到分类后的进程事件;所述分类后的进程事件包括进程通信事件,所述进程通信事件是根据进程间的通信生成的;a classification module, configured to acquire a process event in the kernel space, and classify the process event to obtain a classified process event; the classified process event includes a process communication event, and the process communication event is based on an interprocess process Communication generated
传送模块,用于所述内核空间将所述分类后的进程事件和对应的进程异步传送给用户空间,以使所述用户空间根据所述进程通信事件调整对所述进程的资源限制。And a transmitting module, configured to: the kernel space asynchronously transmits the classified process event and the corresponding process to the user space, so that the user space adjusts resource restrictions on the process according to the process communication event.
一种计算机设备,包括存储器及处理器,所述存储器中储存有计算机程序,所述计算机程序被所述处理器执行时,使得所述处理器执行如上所述的方法的操作。A computer apparatus comprising a memory and a processor, the memory storing a computer program, the computer program being executed by the processor, causing the processor to perform the operations of the method as described above.
一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现如上所述的方法的操作。A computer readable storage medium having stored thereon a computer program that, when executed by a processor, implements the operations of the methods described above.
本申请实施例中,内核空间将进程事件异步传送给用户空间,提高了用户空间获取进程底层变化信息的效率。通过内核空间对进程事件进行分类,用户空间决策进程可用资源的方法,可兼容用户空间丰富的策略和内核空间可及时获取进程状态变化的特点,在对进程进行资源限制时,可避免进程由于资源限制导致的状态异常的问题。In the embodiment of the present application, the kernel space asynchronously transmits the process event to the user space, which improves the efficiency of the user space to obtain the underlying change information of the process. The process of classifying process events through kernel space, the method of available resources in the user space decision process, and the compatibility of user space rich strategy and kernel space can timely acquire the characteristics of process state changes. When resources are restricted to processes, processes can be avoided due to resources. Limit the problem that caused the state to be abnormal.
附图说明DRAWINGS
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings to be used in the embodiments or the prior art description will be briefly described below. Obviously, the drawings in the following description are only It is a certain embodiment of the present application, and other drawings can be obtained according to the drawings without any creative work for those skilled in the art.
图1为一个实施例中计算机设备的内部结构示意图。FIG. 1 is a schematic diagram showing the internal structure of a computer device in an embodiment.
图2为一个实施例中计算机设备的部分架构图。2 is a partial architectural diagram of a computer device in an embodiment.
图3为一个实施例中信息处理方法的流程图。3 is a flow chart of an information processing method in an embodiment.
图4为另一个实施例中信息处理方法的流程图。4 is a flow chart of an information processing method in another embodiment.
图5为另一个实施例中信息处理方法的流程图。Figure 5 is a flow chart of an information processing method in another embodiment.
图6为另一个实施例中信息处理方法的流程图。Figure 6 is a flow chart of an information processing method in another embodiment.
图7为一个实施例中信息处理装置的结构框图。Fig. 7 is a block diagram showing the structure of an information processing apparatus in an embodiment.
图8为另一个实施例中信息处理装置的结构框图。Fig. 8 is a block diagram showing the structure of an information processing apparatus in another embodiment.
图9为另一个实施例中信息处理装置的结构框图。Fig. 9 is a block diagram showing the structure of an information processing apparatus in another embodiment.
图10为另一个实施例中信息处理装置的结构框图。Figure 10 is a block diagram showing the structure of an information processing apparatus in another embodiment.
图11与本申请实施例提供的计算机设备相关的手机的部分结构的框图。FIG. 11 is a block diagram showing a partial structure of a mobile phone related to a computer device according to an embodiment of the present application.
具体实施方式Detailed ways
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the objects, technical solutions, and advantages of the present application more comprehensible, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are merely illustrative of the application and are not intended to be limiting.
图1为一个实施例中计算机设备的内部结构示意图。如图1所示,该计算机设备包括通过***总线连接的处理器、存储器和网络接口。其中,该处理器用于提供计算和控制能力,支撑整个计算机设备的运行。存储器用于存储数据、程序等,存储器上存储至少一个计算机程序,该计算机程序可被处理器执行,以实现本申请实施例中提供的适用于计算机设备的信息处理方法。存储器可包括非易失性存储介质及内存储器。非易失性存储介质存储有操作***和计算机程序。该计算机程序可被处理器所执行,以用于实现以下各个实施例所提供的一种信息处理方法。内存储器为非易失性存储介质中的操作***计算机程序提供高速缓存的运行环境。网络接口可以是以太网卡或无线网卡等,用于与外部的计算机设备进行通信。该计算机设备可以是手机、平板电脑或者个人数字助理或穿戴式设备等。FIG. 1 is a schematic diagram showing the internal structure of a computer device in an embodiment. As shown in FIG. 1, the computer device includes a processor, a memory, and a network interface connected by a system bus. The processor is used to provide computing and control capabilities to support the operation of the entire computer device. The memory is used to store data, programs, etc., and at least one computer program is stored on the memory, and the computer program can be executed by the processor to implement the information processing method applicable to the computer device provided in the embodiment of the present application. The memory can include a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The computer program can be executed by a processor for implementing an information processing method provided by the following various embodiments. The internal memory provides a cached operating environment for operating system computer programs in a non-volatile storage medium. The network interface may be an Ethernet card or a wireless network card or the like for communicating with an external computer device. The computer device can be a cell phone, a tablet or a personal digital assistant or a wearable device or the like.
本领域技术人员可以理解,图1中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。如该计算机设备还包括通过***总线连接的网络接口,网络接口可以是以太网卡或无线网卡等,用于与外部的计算机设备进行通信,比如可用于同服务器进行通信。It will be understood by those skilled in the art that the structure shown in FIG. 1 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation of the computer device to which the solution of the present application is applied. The specific computer device may It includes more or fewer components than those shown in the figures, or some components are combined, or have different component arrangements. For example, the computer device further includes a network interface connected through a system bus, and the network interface may be an Ethernet card or a wireless network card, etc., for communicating with an external computer device, for example, for communicating with a server.
图2为一个实施例中计算机设备的部分架构图。如图2所示,计算机设备的架构***中包括Java空间层210、本地框架层220以及内核(Kernel)空间层230。Java空间层中包括冻结和解冻模块212,上述冻结和解冻模块212用于实现对各个应用程序的冻结策略,例如对后台耗电的应用程序进行冻结等。2 is a partial architectural diagram of a computer device in an embodiment. As shown in FIG. 2, the architecture of the computer device includes a Java spatial layer 210, a local framework layer 220, and a Kernel space layer 230. The freeze and thaw module 212 is included in the Java space layer. The freeze and thaw module 212 is used to implement a freeze policy for each application, such as freezing the application that consumes the background.
本地框架层220中包括资源优先级和限制管理模块222、平台冻结管理模块224。上述资源优先级和限制管理模块222可对不同的应用程序进行不同的资源限制,使不同的应用程序处于不同的资源优先级中。资源优先级和限制管理模块222还可根据上层的需求调整应用程序的资源优先级,使得计算机设备可合理应用程序可使用资源。平台冻结管理模块224可根据应用程序进入后台的时长来确定对进程应用程序进行资源限制的等级,平台冻结管理模块224可预设不同的资源限制的等级,应用程序进入后台的时间越长,平台冻结管理模块224对应用程序进行资源限制的等级越高,即对应用程序的资源限制程度越高。可选地,上述资源限制等级可包括:CPU限制睡眠模式、CPU冻结睡眠模式和进程深度冻结模式。上述CPU限制睡眠模式是指对应用程序的进程可使用的中央处理器(Central Processing Unit,CPU)资源进行限制,使应用程序的进程可使用较少的CPU资源;在CPU限制睡眠模式下还可进一步限制应用程序的进程可使用的网络资源和输入/输出接口(input/output,I/O)资源。CPU冻结睡眠模式是指禁止应用程序的进程使用CPU资源、网络资源和I/O资源,但对应用程序的进程占用的内存资源不进行回收,上述CPU 冻结模式是对应用程序可使用资源的深度限制模式。CPU冻结睡眠模式是指禁止应用程序的进程使用CPU资源、网络资源和I/O资源,同时回收应用程序的进程占用的内存资源。其中,本地框架层220的接口模块包含开发给上层的binder接口,上层的框架或应用程序通过上述binder接口可发送资源限制指令给资源限制管理模块222、发送冻结指令给平台冻结管理模块224。The local framework layer 220 includes a resource priority and restriction management module 222 and a platform freeze management module 224. The resource priority and restriction management module 222 can perform different resource restrictions on different applications, so that different applications are in different resource priorities. The resource priority and restriction management module 222 can also adjust the resource priority of the application according to the needs of the upper layer so that the computer device can use the resource reasonably. The platform freeze management module 224 can determine the level of resource restriction on the process application according to the duration of the application entering the background. The platform freeze management module 224 can preset different resource limit levels, and the longer the application enters the background, the platform The higher the level of resource restriction on the application by the freeze management module 224, the higher the resource limit on the application. Optionally, the foregoing resource restriction level may include: a CPU restricted sleep mode, a CPU freeze sleep mode, and a process deep freeze mode. The CPU limit sleep mode refers to limiting the central processing unit (CPU) resources that can be used by the application process, so that the application process can use less CPU resources; in the CPU limited sleep mode, Further limit the network resources and input/output (I/O) resources available to the application's processes. CPU freeze sleep mode means that the process of the application is prohibited from using CPU resources, network resources and I/O resources, but the memory resources occupied by the application process are not recycled. The above CPU freeze mode is the depth of resources available to the application. Restricted mode. CPU freeze sleep mode refers to prohibiting the application process from using CPU resources, network resources, and I/O resources, while reclaiming the memory resources occupied by the application's processes. The interface module of the local framework layer 220 includes a binder interface developed to the upper layer. The upper framework or application can send a resource restriction instruction to the resource restriction management module 222 and send a freeze instruction to the platform freeze management module 224 through the binder interface.
内核空间层230中包括UID管理模块231、Cgroup模块232、binder管控模块233、进程内存回收模块234和超时冻结退出模块235。当前对应用程序的进程管理是基于进程识别号(Process Identification,PID)来实现的,进程与应用程序没有对应,不利于统一管理一个应用程序的所有进程对应的资源。上述UID管理模块231可通过应用程序的用户身份标识(User Identifier,UID)来管理应用程序的资源,也可通过应用程序的UID对应用程序进行冻结。Cgroup模块232可提供基于CPU、CPUSET、内存(memory)、I/O资源和Net相关的资源限制机制。binder管控模块233可用于限制后台进程间binder通信的优先级。进程内存回收模块234用于实现进程深度冻结模式,在进程进入进程深度冻结模式时,释放掉进程的文件区,从而实现节省内存,加快进程对应的应用程序下次启动时的速度。超时冻结退出模块235用于解决进程在冻结超时发生异常的问题。The kernel space layer 230 includes a UID management module 231, a Cgroup module 232, a binder management module 233, a process memory recovery module 234, and a timeout freeze exit module 235. The current process management of the application is implemented based on the process identification (PID). The process does not correspond to the application, which is not conducive to unified management of resources corresponding to all processes of an application. The UID management module 231 can manage the resources of the application through the User Identifier (UID) of the application, and can also freeze the application by the UID of the application. The Cgroup module 232 can provide resource-based mechanisms based on CPU, CPUSET, memory, I/O resources, and Net. The binder management module 233 can be used to limit the priority of the binder communication between background processes. The process memory recovery module 234 is configured to implement the process deep freeze mode. When the process enters the process deep freeze mode, the file area of the process is released, thereby saving memory and speeding up the next time the application corresponding to the process starts. The timeout freeze exit module 235 is used to solve the problem that the process has an abnormality in the freeze timeout.
通过上述的架构,可实现本申请各个实施例中的信息处理方法。Through the above architecture, the information processing method in various embodiments of the present application can be implemented.
图3为一个实施例中信息处理方法的流程图。如图3,一种信息处理方法,包括:3 is a flow chart of an information processing method in an embodiment. As shown in FIG. 3, an information processing method includes:
操作302,在内核空间中获取进程事件,并对进程事件分类,得到分类后的进程事件;分类后的进程事件包括进程通信事件,进程通信事件是根据进程间的通信生成的。In operation 302, a process event is obtained in the kernel space, and the process event is classified to obtain a classified process event; the classified process event includes a process communication event, and the process communication event is generated according to communication between processes.
通常情况下,在Linux***中可将***分为内核空间和用户空间两部分。其中,内核空间中存放内核代码和数据,用户空间中存放应用程序的代码和数据。内核空间的权限较高,用户空间的权限较低。Generally, in Linux systems, the system can be divided into two parts: kernel space and user space. Among them, the kernel space stores the kernel code and data, and the user space stores the application code and data. Kernel space has higher permissions and user space has lower permissions.
进程是一个具有一定独立能力的程序关于某个数据集合的一次运行活动,一个应用程序在运行时包括多个进程。在进程运行的过程中,由于进程间通信机制和进程状态的改变会产生进程事件。在内核空间中可对进程产生的进程事件进行分类,得到分类后的进程事件。上述分类后的进程事件可包括进程通信事件和进程状态事件。上述进程通信事件是根据进程间通信产生的事件,上述进程状态事件是由于进程状态变化产生的事件。A process is a run-time activity of a program with certain independence about a data set. An application includes multiple processes at runtime. During the running of the process, process events are generated due to changes in the inter-process communication mechanism and process state. The process events generated by the process can be classified in the kernel space to obtain the classified process events. The above classified process events may include process communication events and process status events. The above process communication event is an event generated according to inter-process communication, and the above process status event is an event generated due to a change in the process state.
操作304,内核空间将分类后的进程事件和对应的进程异步传送给用户空间,以使用户空间根据进程通信事件调整对进程的资源限制。 Operation 304, the kernel space asynchronously transfers the classified process event and the corresponding process to the user space, so that the user space adjusts the resource limit of the process according to the process communication event.
用户空间将进程产生的进程事件分类得到分类后的进程事件后,可将分类后的进程时间异步传送给用户空间。其中,内核空间与用户空间主要通过异步netlink的方式进行通信,内核空间在与用户空间进行通信时,可遵循内核空间与用户空间约定的包结构,并根据不同的进程事件生成不同的数据。内核空间在将分类后的进程事件和对应的进程异步传送给用户空间时,可将分类后的进程事件、事件对应的进程和事件发生的原因传送给用户空间。例如,后台进程接收到前台进程的通信消息后,可生成socket到达事件,则内核空间可将上述socket到达事件、后台进程的UID和socket到达事件发生的原因:后台进程接收到前台进程的通信消息传送给用户空间。After the user space classifies the process events generated by the process to obtain the classified process events, the classified process time can be asynchronously transmitted to the user space. Among them, kernel space and user space mainly communicate through asynchronous netlink. When communicating with user space, kernel space can follow the package structure agreed by kernel space and user space, and generate different data according to different process events. The kernel space can transfer the classified process event, the process corresponding to the event, and the cause of the event to the user space when the classified process event and the corresponding process are asynchronously transmitted to the user space. For example, after the background process receives the communication message of the foreground process, the socket arrival event may be generated, and the kernel space may cause the socket arrival event, the UID of the background process, and the socket arrival event to occur: the background process receives the communication message of the foreground process. Transfer to user space.
用户空间在接收到内核空间异步传送的数据后,可对接收到的数据进行解析,获取进程底层的变化,再根据进程底层的变化及时更新对进程的资源限制。其中,用户空间对进程的资源限制主要包括对进程可使用的CPU资源、I/O资源、网络资源、内存资源等进行限制,使得各进程之间的资源可以合理调配。After receiving the data asynchronously transmitted by the kernel space, the user space can parse the received data, obtain the underlying changes of the process, and then update the resource limit of the process according to the change of the underlying process. The resource limitation of the user space to the process mainly includes limiting the CPU resources, I/O resources, network resources, and memory resources that can be used by the process, so that the resources between the processes can be properly allocated.
在当前主流的移动操作***中,对应用程序可使用资源的限制主要通过用户空间来进行,用户空间可通过Cgroup机制将不同等级资源对应的应用程序放入不同的资源组中。通过用户空间可调用丰富的库和丰富的策略来判断对应用程序可使用资源的限制,但由于用户空间权限较低,仅通过用户空间的信息和策略无法根据应用程序底层的变化及时更新 对应用程序的资源限制等级。In the current mainstream mobile operating system, the limitation of the resources that can be used by the application is mainly performed by the user space, and the user space can put the applications corresponding to the different level resources into different resource groups through the Cgroup mechanism. User space can call rich libraries and rich policies to determine the restrictions on the resources available to the application. However, due to the low user space permissions, only the user space information and policies cannot update the application according to the changes of the underlying application. The resource limit level of the program.
本申请实施例中方法,内核空间将进程事件异步传送给用户空间,提高了用户空间获取进程底层变化信息的效率。通过内核空间对进程事件进行分类,用户空间决策进程可用资源的方法,可兼容用户空间丰富的策略和内核空间可及时获取进程状态变化的特点,在对进程进行资源限制时,可避免进程由于资源限制导致的状态异常的问题。In the method in the embodiment of the present application, the kernel space asynchronously transmits the process event to the user space, thereby improving the efficiency of the user space to obtain the underlying change information of the process. The process of classifying process events through kernel space, the method of available resources in the user space decision process, and the compatibility of user space rich strategy and kernel space can timely acquire the characteristics of process state changes. When resources are restricted to processes, processes can be avoided due to resources. Limit the problem that caused the state to be abnormal.
在一个实施例中,用户空间根据进程通信事件调整对进程的资源限制包括以下方法中至少一种:In one embodiment, the user space adjusts resource limits to the process based on the process communication event including at least one of the following methods:
(1)用户空间根据binder启动事件提升进程的资源优先级。(1) The user space raises the resource priority of the process according to the binder startup event.
(2)用户空间根据binder空闲事件降低进程的资源优先级。(2) User space reduces the resource priority of the process according to the binder idle event.
(3)用户空间根据socket到达事件提升进程的资源优先级。(3) User space according to the socket arrival event to promote the resource priority of the process.
进程间的通信事件包括binder启动事件、binder空闲事件和socket到达事件。用户空间可根据接收到的进程通信事件的不同调整对进程的资源限制。Inter-process communication events include binder start events, binder idle events, and socket arrival events. User space adjusts resource limits for processes based on the received process communication events.
binder是移动操作***中重要的进程间通信机制。不同进程之间的通信大多为binder通信。其中,内核空间可对binder通信设定两个事件:binder启动事件和binder空闲事件。其中,binder启动事件是指进程一旦接收到其他进程发送的binder时会立即产生binder启动事件。binder空闲事件是指进程在预设时长内后不再有binder会话存货则会产生binder空闲事件。当进程产生到binder启动事件时,表示进程与其他进程之间有通信,用户空间可提升上述进程的资源优先级,增加进程可使用的资源。当进程产生binder空闲事件时,表示进程与其他进程之间没有通信,用户空间可降低上述进程的资源优先级,减少进程可使用的资源。Binder is an important interprocess communication mechanism in mobile operating systems. Most of the communication between different processes is binder communication. Among them, the kernel space can set two events for the binder communication: the binder startup event and the binder idle event. Among them, the binder startup event means that the process will immediately generate a binder startup event once it receives the binder sent by other processes. The binder idle event means that the process no longer has a binder session inventory after the preset time period, and a binder idle event is generated. When the process generates a binder startup event, it indicates that there is communication between the process and other processes. The user space can increase the resource priority of the above process and increase the resources available to the process. When a process generates a binder idle event, it indicates that there is no communication between the process and other processes. The user space can reduce the resource priority of the above process and reduce the resources available to the process.
socket也是移动操作***中广泛使用的通信机制。例如,在Android***中就经常使用socket机制。内核空间可对socket通信设置一个事件:socket到达事件。其中,socket到达事件是进程一旦接受到其他进程发送的socket时,会产生socket到达事件。当进程产生socket到达事件时,表示进程与其他进程之间有通信,用户空间可提升上述进程的资源优先级,增加进程可使用的资源。通过socket到达事件,可解决通信类应用程序在资源被限制时无法及时接受到消息的问题。Sockets are also a widely used communication mechanism in mobile operating systems. For example, the socket mechanism is often used in Android systems. Kernel space sets an event for socket communication: the socket arrives at the event. The socket arrival event is that when the process accepts the socket sent by another process, a socket arrival event is generated. When a process generates a socket arrival event, it indicates that there is communication between the process and other processes. The user space can increase the resource priority of the above process and increase the resources available to the process. The arrival of the event through the socket can solve the problem that the communication application cannot receive the message in time when the resource is restricted.
内核空间中可设置进程名单,仅在进程名单中进程在接收到binder或socket时,会产生对应的进程通信事件。The process list can be set in the kernel space. Only when the process receives the binder or socket in the process list, the corresponding process communication event will be generated.
上述资源优先级即为对进程可使用的资源的限制等级。用户空间可对应用程序设置不同的资源优先级,上述资源优先级不同时,对应用程序的进程可使用资源的限制也不同,即用户空间通过对应用程序设置资源优先级,可实现对应用程序的进程设置资源优先级。用户空间可将不同资源优先级的应用程序放置于不同的资源组中,方便用户空间对应用程序的管理。用户空间通过对应用程序资源优先级包括:用户空间设置应用程序对应的资源优先级,其中资源优先级对应应用程序可使用总资源的大小。例如,用户空间设置应用程序的资源优先级为1级、应用程序可使用总资源的80%,则应用程序可分别使用CPU资源的80%、内存资源的80%、I/O资源的80%、网络资源的80%。用户空间还可对应用程序可使用的资源分别设置资源优先级,包括CPU资源优先级、内存资源优先级、I/O资源优先级和网络资源优先级。一个应用程序对应的各个资源优先级可不同,例如,应用程序对应的CPU资源优先级为1级、可使用总CPU资源的90%;对应的内存资源优先级为2级,可使用总内存资源的75%;对应的I/O资源的优先级为4级,可使用总I/O资源的30%;对应的网络资源的优先级为2级,可使用总网络资源的80%。The above resource priority is the level of restriction on the resources available to the process. The user space can set different resource priorities for the application. When the above resource priorities are different, the restrictions on the resources that can be used by the application process are different, that is, the user space can implement the application by setting the resource priority to the application. The process sets the resource priority. User space allows applications with different resource priorities to be placed in different resource groups, facilitating user space management of the application. The user space prioritizes the application resource includes: the user space sets the resource priority corresponding to the application, wherein the resource priority corresponds to the size of the total resource that the application can use. For example, if the user space setting application has a resource priority of 1 and the application can use 80% of the total resources, the application can use 80% of the CPU resources, 80% of the memory resources, and 80% of the I/O resources, respectively. 80% of network resources. User space can also set resource priorities for resources that can be used by applications, including CPU resource priority, memory resource priority, I/O resource priority, and network resource priority. The priority of each resource corresponding to an application may be different. For example, the CPU resource priority of the application is 1 level, 90% of the total CPU resources can be used; the corresponding memory resource priority is 2, and the total memory resource can be used. 75%; the corresponding I/O resource has a priority of 4, which can use 30% of the total I/O resources; the corresponding network resource has a priority of 2, and can use 80% of the total network resources.
本申请实施例中方法,用户空间可通过接收到的进程事件来调整进程对应的资源优先级,用户空间对进程的资源限制更加迅速和准确,提高了用户空间对进程的资源限制的准确率。In the method in the embodiment of the present application, the user space can adjust the resource priority corresponding to the process by using the received process event, and the resource limitation of the process in the user space is more rapid and accurate, and the accuracy of the resource limitation of the user space to the process is improved.
在一个实施例中,提升进程的资源优先级包括:In one embodiment, the resource priority of the promotion process includes:
(1)若检测到待提升资源优先级的进程为后台进程,获取当前运行的前台进程的资源优先级。(1) If the process of the priority of the resource to be upgraded is detected as a background process, the resource priority of the currently running foreground process is obtained.
(2)提升后台进程的资源优先级,提升后后台进程的资源优先级不高于前台进程的资源优先级。(2) The resource priority of the background process is increased. After the promotion, the resource priority of the background process is not higher than the resource priority of the foreground process.
用户空间可对不同的应用程序分配不同的资源优先级,则同一个应用程序对应的进程的资源优先级相同,不同应用程序对应的进程的资源优先级可不同。用户空间对进程提升资源优先级时,若检测到带提升资源优先级的进程为后台进程,则获取当前运行的前台进程的资源优先级。The user space can assign different resource priorities to different applications, and the processes corresponding to the same application have the same resource priority, and the processes corresponding to different applications can have different resource priorities. When the user space is used to raise the priority of the resource, if the process with the priority of the elevated resource is detected as the background process, the resource priority of the currently running foreground process is obtained.
为避免后台进程与前台进程抢占资源,通常情况下,可设置后台进程的资源优先级低于前台进程的资源优先级,则后台进程可用的资源低于前台进程可用的资源。在获取前台进程的资源优先级后,用户空间可提升后台进程的资源优先级时,使后台进程的资源优先级低于前台进程的资源优先级。其中,用户空间在提升后台进程的资源优先级时,包括:提升后台进程的总资源优先级,即后台进程可使用的各项资源的优先级均可提升;或提升后台进程的某一项或多项资源的优先级,例如提高后台进程的CPU资源优先级,使得后台进程可使用的CPU资源增加。To prevent the background process and the foreground process from preempting resources, you can set the resource priority of the background process to be lower than the resource priority of the foreground process. The resources available to the background process are lower than the resources available to the foreground process. After the resource priority of the foreground process is obtained, the user space can increase the resource priority of the background process, so that the resource priority of the background process is lower than the resource priority of the foreground process. The user space increases the priority of the background process, including: increasing the total resource priority of the background process, that is, the priority of each resource that can be used by the background process can be improved; or upgrading one of the background processes or The priority of multiple resources, such as increasing the CPU resource priority of the background process, makes the CPU resources available to the background process increase.
本申请实施例中方法,在提升进程的资源优先级时,保证前台进程的资源优先级高于后台进程的资源优先级,可避免后台进程的资源优先级高于前台进程的资源优先级导致前台进程的资源被抢占,前台进程运行缓慢的问题。In the method of the embodiment of the present application, when the resource priority of the process is increased, the priority of the resource of the foreground process is higher than that of the background process, and the priority of the resource of the background process is higher than that of the foreground process. The process resources are preempted and the foreground process is running slowly.
在一个实施例中,分类后的进程事件还包括进程状态事件,进程状态事件是根据进程在生命周期中的变化生成的;用户空间可根据进程状态事件更新用户空间中进程的进程信息。In one embodiment, the classified process event further includes a process state event, and the process state event is generated according to a change of the process in the life cycle; the user space may update the process information of the process in the user space according to the process state event.
内核空间还可监控进程在生命周期中变化,根据进程在生命周期的变化生成进程状态事件。当进程在创造、退出、更改UID时都会产生对应的进程状态事件,上述进程状态事件表示进程状态发生了变化。用户空间在接收到进程状态事件时,可根据上述进程状态事件维护对进程和应用程序状态的更新。本申请实施例中方法,用户空间在接收到进程状态事件后,可根据进程状态事件更新进程及进程状态,使得用户空间可维护进程的更新,使得用户空间在对进程进行资源限制时,无需查询更新进程及进程状态,提高了用户空间的效率。Kernel space also monitors the process's lifecycle changes and generates process state events based on changes in the lifecycle of the process. When a process creates, exits, or changes a UID, it generates a corresponding process state event. The process state event indicates that the process state has changed. When user space receives a process state event, it can maintain updates to the process and application state based on the process state events described above. In the method of the embodiment of the present application, after receiving the process state event, the user space may update the process and the process state according to the process state event, so that the user space can maintain the update of the process, so that the user space does not need to query when the resource is restricted to the process. Update the process and process state to improve the efficiency of user space.
在一个实施例中,上述方法还包括:In an embodiment, the above method further includes:
操作306,用户空间获取进程进入后台的时长,当进程进入后台的时长达到预设时长时,对进程进行冻结;对进程进行冻结是指禁止进程使用***资源。In operation 306, the user space acquires the duration of the process entering the background. When the duration of the process entering the background reaches a preset duration, the process is frozen; freezing the process refers to prohibiting the process from using system resources.
通常情况下,计算机设备为节省功耗,会对进入后台的进程进行资源限制,节省计算机设备的功耗。其中,计算机设备对进程进行资源限制可包括:普通限制模式、深度限制模式和冻结模式。其中,普通限制模式是对进程可使用的CPU资源进行限制,相应的也会限制进程可使用的其他资源,如I/O资源、网络资源等;深度限制模式是禁止进程使用CPU资源、网络资源和I/O资源进行限制,但对进程使用的内存资源不进行限制。冻结模式是进程使用所有的***资源,即禁止进程使用CPU资源、网络资源和I/O资源,回收进程占用的内存资源等。用户空间可获取进程进入后台的时长,当进程进入后台的时长达到预设时长,则可判定进程长时间未启用,对进程进行冻结,释放进程占用的资源。In general, computer equipment saves power, limits resources to processes entering the background, and saves power consumption of computer equipment. The resource limitation of the process by the computer device may include: a normal restriction mode, a depth restriction mode, and a freeze mode. The common restriction mode is to limit the CPU resources that the process can use, and correspondingly limit other resources that the process can use, such as I/O resources and network resources. The deep limit mode prohibits the process from using CPU resources and network resources. There are restrictions on I/O resources, but there are no restrictions on the memory resources used by the process. The freeze mode is that the process uses all system resources, that is, prohibits the process from using CPU resources, network resources, and I/O resources, and reclaims the memory resources occupied by the process. The user space can obtain the length of time that the process enters the background. When the process reaches the background for a preset period of time, it can be determined that the process is not enabled for a long time, and the process is frozen to release the resources occupied by the process.
本申请实施例中方法,当进程进入后台的时长达到预设时长时,可对进程进行冻结,释放进程占用的***资源,使得计算机设备可合理调控进程使用的资源,降低计算机设备的功耗。In the method of the embodiment of the present application, when the duration of the process entering the background reaches a preset duration, the process may be frozen, and the system resources occupied by the process are released, so that the computer device can reasonably regulate the resources used by the process and reduce the power consumption of the computer device.
在一个实施例中,上述方法还包括:In an embodiment, the above method further includes:
操作308,当用户空间接收到处于冻结状态的进程对应的进程通信事件时,将处于冻结状态的进程唤醒并调整对进程的资源限制。Operation 308, when the user space receives the process communication event corresponding to the process in the frozen state, wake up the process in the frozen state and adjust the resource limit of the process.
当进程处于冻结状态时,进程不能使用***资源。当用户空间接收到对处于冻结状态的进程对应的进程通信事件时,可将处于冻结状态的进程唤醒,使得进程可使用***资源来响应上述进程通信事件。其中,用户空间将处于冻结状态的进程唤醒包括:将进程由冻结模式切换到普通限制模式,使得进程可使用***资源。用户空间在将处于冻结状态的进程唤醒后,还可根据接收到进程通信事件的类型调整上述进程的资源优先级。When a process is frozen, the process cannot use system resources. When the user space receives a process communication event corresponding to the process in the frozen state, the process in the frozen state may be awakened, so that the process can use the system resource to respond to the process communication event. The user space wakes up the process in the frozen state, including: switching the process from the freeze mode to the normal limit mode, so that the process can use the system resources. After waking up the process in the frozen state, the user space can also adjust the resource priority of the process according to the type of the process communication event received.
本申请实施例中方法,用户空间在接收到对处于冻结状态的进程对应的进程通信事件时,可将上述处于冻结状态的进程唤醒再调整对上述进程的资源限制,使得已冻结进程可及时响应其他进程的通信消息,提高了用户空间对进程的资源控制率。In the method of the embodiment of the present application, when receiving the process communication event corresponding to the process in the frozen state, the user space may wake up the process in the frozen state and adjust the resource limit of the process, so that the frozen process can respond in time. Communication messages of other processes improve the resource control rate of the user space to the process.
在一个实施例中,上述方法还包括:In an embodiment, the above method further includes:
操作310,当用户空间接收到对处于冻结状态的进程的终止命令时,将进程解冻,并将解冻后进程设置为不可冻结状态,根据终止命令终止解冻后进程。In operation 310, when the user space receives the termination command for the process in the frozen state, the process is thawed, and the thawed process is set to the unfreeze state, and the thawed process is terminated according to the termination command.
若计算机设备资源紧缺,计算机设备会对已冻结的进程发送终止命令,关闭上述已冻结的进程,释放已冻结的进程占用的资源。但当进程处于冻结状态时,进程无法接收到任何消息,即使处于冻结状态的进程被唤醒,唤醒后进程也会快速恢复到冻结状态,因此计算机设备无法关闭处于冻结状态的进程。通常情况下,计算机设备会使用两套代码来终止进程,其中一套代码用于终止未冻结进程,另一套代码用于终止已冻结进程。If the computer device resources are scarce, the computer device sends a termination command to the frozen process, shutting down the frozen process, and releasing the resources occupied by the frozen process. However, when the process is frozen, the process cannot receive any messages. Even if the process in the frozen state is woken up, the process will quickly return to the frozen state after waking up, so the computer device cannot close the process in the frozen state. Typically, a computer device uses two sets of code to terminate a process, one set of code to terminate the unfrozen process and another set of code to terminate the frozen process.
当计算机设备接收到对已冻结的进程的终止命令时,若检测到上述已冻结的进程处于冻结状态,对上述处于冻结状态的进程进行解冻,并将解冻后进程设置为不可冻结状态,则解冻后的进程可对上述终止命令正确响应,即上述解冻后的进程可被关闭。When the computer device receives the termination command for the frozen process, if it is detected that the frozen process is in a frozen state, the process in the frozen state is thawed, and the thawed process is set to a non-freeze state, then thawed The subsequent process can respond correctly to the above termination command, that is, the above thawed process can be closed.
本申请实施例中方法,通过对已冻结进程进行先解冻再终止的方法,可实现对已冻结进程的安全终止,避免出现进程无法终止的情况,计算机设备可根据统一的终止指令来终止已冻结进程和未冻结进程,实现了终止已冻结进程和终止未冻结进程的兼容性,减少了软件开发的困难,方便对移动操作***进行维护。The method in the embodiment of the present application can implement the method of first thawing and then terminating the frozen process to implement the secure termination of the frozen process, and avoid the situation that the process cannot be terminated. The computer device can terminate the frozen according to the unified termination instruction. The process and the unfrozen process realize the compatibility of terminating the frozen process and terminating the unfrozen process, reducing the difficulty of software development and facilitating the maintenance of the mobile operating system.
在一个实施例中,一种信息处理方法,包括:In an embodiment, an information processing method includes:
(1)在内核空间中获取进程事件,并对进程事件分类,得到分类后的进程事件;分类后的进程事件包括进程通信事件,进程通信事件是根据进程间的通信生成的。(1) Obtaining process events in the kernel space, classifying the process events, and obtaining the classified process events; the classified process events include process communication events, and the process communication events are generated according to communication between processes.
(2)内核空间将分类后的进程事件和对应的进程异步传送给用户空间,以使用户空间根据进程通信事件调整对进程的资源限制。(2) The kernel space asynchronously transfers the classified process event and the corresponding process to the user space, so that the user space adjusts the resource limit of the process according to the process communication event.
可选地,用户空间根据进程通信事件调整对进程的资源限制包括以下方法中至少一种:用户空间根据binder启动事件提升进程的资源优先级;用户空间根据binder空闲事件降低进程的资源优先级;用户空间根据socket到达事件提升进程的资源优先级。Optionally, the user space adjusts the resource limitation of the process according to the process communication event, including at least one of the following methods: the user space starts the event promotion event resource priority according to the binder; and the user space reduces the resource priority of the process according to the binder idle event; The user space is based on the resource priority of the socket arrival event promotion process.
可选地,提升进程的资源优先级包括:当检测到待提升资源优先级的进程为后台进程时,获取当前运行的前台进程的资源优先级;提升后台进程的资源优先级,提升后后台进程的资源优先级不高于前台进程的资源优先级。Optionally, the resource priority of the process is as follows: when the process of detecting the priority of the resource to be upgraded is the background process, the resource priority of the currently running foreground process is obtained; the resource priority of the background process is raised, and the background process is improved. The resource priority is no higher than the resource priority of the foreground process.
可选地,分类后的进程事件还包括进程状态事件,进程状态事件是根据进程在生命周期中的变化生成的;用户空间根据进程状态事件更新用户空间中进程的进程信息。Optionally, the classified process event further includes a process state event, and the process state event is generated according to the change of the process in the life cycle; the user space updates the process information of the process in the user space according to the process state event.
可选地,上述方法还包括:用户空间获取进程进入后台的时长,当进程进入后台的时长达到预设时长时,对进程进行冻结;对进程进行冻结是指禁止进程使用***资源。Optionally, the method further includes: a time period in which the user space acquisition process enters the background, and when the process enters the background for a preset duration, the process is frozen; and freezing the process refers to prohibiting the process from using the system resource.
可选地,上述方法还包括:当用户空间接收到处于冻结状态的进程对应的进程通信事件时,将处于冻结状态的进程唤醒并调整对进程的资源限制。Optionally, the method further includes: when the user space receives the process communication event corresponding to the process in the frozen state, the process in the frozen state is awakened and the resource restriction on the process is adjusted.
可选地,上述方法还包括:当用户空间接收到对处于冻结状态的进程的终止命令时,将进程解冻,并将解冻后进程设置为不可冻结状态,根据终止命令终止解冻后进程。Optionally, the method further includes: when the user space receives the termination command for the process in the frozen state, unfreezing the process, and setting the thawed process to a non-freeze state, and terminating the thawed process according to the termination command.
应该理解的是,虽然上述流程图中的各个操作按照箭头的指示依次显示,但是这些操作并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些操作的执行并没有严格的顺序限制,这些操作可以以其它的顺序执行。而且,上述中的至少一部分操 作可以包括多个子操作或者多个阶段,这些子操作或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些子操作或者阶段的执行顺序也不必然是依次进行,而是可以与其它操作或者其它操作的子操作或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the operations in the above-described flowcharts are sequentially displayed in accordance with the indication of the arrows, these operations are not necessarily performed in the order indicated by the arrows. Except as explicitly stated herein, the execution of these operations is not strictly limited, and the operations may be performed in other sequences. Moreover, at least some of the operations described above may include a plurality of sub-operations or stages, which are not necessarily performed at the same time, but may be executed at different times, the execution order of the sub-operations or stages Nor is it necessarily performed sequentially, but may be performed alternately or alternately with at least a portion of the sub-operations or stages of other operations or other operations.
图7为一个实施例的信息处理装置的结构框图。如图7所示,一种信息处理装置,包括:Fig. 7 is a block diagram showing the structure of an information processing apparatus of an embodiment. As shown in FIG. 7, an information processing apparatus includes:
分类模块702,用于在内核空间中获取进程事件,并对进程事件分类,得到分类后的进程事件。分类后的进程事件包括进程通信事件,进程通信事件是根据进程间的通信生成的。The classification module 702 is configured to acquire process events in the kernel space, and classify the process events to obtain the classified process events. The classified process events include process communication events, and process communication events are generated based on communication between processes.
传送模块704,用于内核空间将分类后的进程事件和对应的进程异步传送给用户空间,以使用户空间根据进程通信事件调整对进程的资源限制。The transmitting module 704 is configured to, in the kernel space, asynchronously transfer the classified process event and the corresponding process to the user space, so that the user space adjusts resource limits on the process according to the process communication event.
在一个实施例中,用户空间根据进程通信事件调整对进程的资源限制包括以下方法中至少一种:In one embodiment, the user space adjusts resource limits to the process based on the process communication event including at least one of the following methods:
(1)用户空间根据binder启动事件提升进程的资源优先级。(1) The user space raises the resource priority of the process according to the binder startup event.
(2)用户空间根据binder空闲事件降低进程的资源优先级。(2) User space reduces the resource priority of the process according to the binder idle event.
(3)用户空间根据socket到达事件提升进程的资源优先级。(3) User space according to the socket arrival event to promote the resource priority of the process.
在一个实施例中,用户空间提升进程的资源优先级包括:若检测到待提升资源优先级的进程为后台进程,获取当前运行的前台进程的资源优先级。提升后台进程的资源优先级,提升后后台进程的资源优先级不高于前台进程的资源优先级。In an embodiment, the resource priority of the user space promotion process includes: if the process of detecting the priority of the resource to be upgraded is a background process, obtaining the resource priority of the currently running foreground process. The resource priority of the background process is increased. After the promotion, the resource priority of the background process is not higher than the resource priority of the foreground process.
在一个实施例中,分类后的进程事件还包括进程状态事件,进程状态事件是根据进程在生命周期中的变化生成的。传送模块704将上述进程状态事件传送给用户空间后,用户空间根据进程状态事件更新用户空间中进程的进程信息。In one embodiment, the classified process event further includes a process state event that is generated based on changes in the life cycle of the process. After the transfer module 704 transmits the above process status event to the user space, the user space updates the process information of the process in the user space according to the process status event.
图8为另一个实施例中信息处理模块的结构框图。如图8所示,一种信息处理装置,包括:分类模块802、传送模块804和冻结模块806。其中,分类模块802、传送模块804与图7中对应的模块功能相同。FIG. 8 is a structural block diagram of an information processing module in another embodiment. As shown in FIG. 8, an information processing apparatus includes: a classification module 802, a transmission module 804, and a freezing module 806. The classification module 802 and the transmission module 804 have the same functions as the corresponding modules in FIG. 7.
冻结模块806,用于用户空间获取进程进入后台的时长,若进程进入后台的时长达到预设时长,对进程进行冻结。对进程进行冻结是指禁止进程使用***资源。The freeze module 806 is used for the duration of the user space acquisition process entering the background. If the duration of the process entering the background reaches a preset duration, the process is frozen. Freezing a process means disabling the process from using system resources.
图9为另一个实施例中信息处理模块的结构框图。如图9所示,一种信息处理装置,包括:分类模块902、传送模块904和唤醒模块906。其中,分类模块902、传送模块904与图7中对应的模块功能相同。9 is a structural block diagram of an information processing module in another embodiment. As shown in FIG. 9, an information processing apparatus includes: a classification module 902, a transmission module 904, and a wakeup module 906. The classification module 902 and the transmission module 904 have the same functions as the corresponding modules in FIG. 7.
唤醒模块906,用于若用户空间接收到处于冻结状态的进程对应的进程通信事件,将处于冻结状态的进程唤醒并调整对进程的资源限制。The wake-up module 906 is configured to wake up a process in a frozen state and adjust a resource limit to the process if the user space receives a process communication event corresponding to the process in the frozen state.
图10为另一个实施例中信息处理模块的结构框图。如图10所示,一种信息处理装置,包括:分类模块1002、传送模块1004、解冻模块1006和终止模块1008。其中,分类模块1002、传送模块1004与图7中对应的模块功能相同。FIG. 10 is a structural block diagram of an information processing module in another embodiment. As shown in FIG. 10, an information processing apparatus includes: a classification module 1002, a transmission module 1004, a defrosting module 1006, and a termination module 1008. The classification module 1002 and the transmission module 1004 have the same functions as the corresponding modules in FIG. 7.
解冻模块1006,用于若用户空间接收到对处于冻结状态的进程的终止命令,将进程解冻,并将解冻后进程设置为不可冻结状态。The defrosting module 1006 is configured to unfreeze the process if the user space receives the termination command for the process in the frozen state, and set the thawing process to the unfreeze state.
终止模块1008,用于根据终止命令终止解冻后进程。The termination module 1008 is configured to terminate the post-thawing process according to the termination command.
上述信息处理装置中各个模块的划分仅用于举例说明,在其他实施例中,可将信息处理装置按照需要划分为不同的模块,以完成上述信息处理装置的全部或部分功能。The division of each module in the above information processing apparatus is for illustrative purposes only. In other embodiments, the information processing apparatus may be divided into different modules as needed to complete all or part of the functions of the information processing apparatus.
关于信息处理装置的具体限定可以参见上文中对于信息处理方法的限定,在此不再赘述。上述信息处理装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。For the specific definition of the information processing apparatus, reference may be made to the definition of the information processing method in the above, and details are not described herein again. The various modules in the above information processing apparatus may be implemented in whole or in part by software, hardware, and combinations thereof. Each of the above modules may be embedded in or independent of the processor in the computer device, or may be stored in a memory in the computer device in a software form, so that the processor invokes the operations corresponding to the above modules.
本申请实施例中提供的信息处理装置中的各个模块的实现可为计算机程序的形式。该计算机程序可在终端或服务器上运行。该计算机程序构成的程序模块可存储在终端或服务 器的存储器上。该计算机程序被处理器执行时,实现本申请实施例中所描述方法的操作。The implementation of each module in the information processing apparatus provided in the embodiments of the present application may be in the form of a computer program. The computer program can run on a terminal or server. The program modules of the computer program can be stored on the memory of the terminal or server. The operation of the method described in the embodiments of the present application is implemented when the computer program is executed by the processor.
本申请实施例还提供了一种计算机可读存储介质。一个或多个包含计算机可执行指令的非易失性计算机可读存储介质,当计算机可执行指令被一个或多个处理器执行时,使得处理器执行本申请实施例中信息处理方法的操作。The embodiment of the present application also provides a computer readable storage medium. One or more non-transitory computer readable storage media containing computer executable instructions that, when executed by one or more processors, cause the processor to perform the operations of the information processing methods in the embodiments of the present application.
一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行本申请实施例中信息处理方法的操作。A computer program product comprising instructions which, when run on a computer, cause the computer to perform the operations of the information processing method of the embodiments of the present application.
本申请实施例还提供了一种计算机设备。如图11所示,为了便于说明,仅示出了与本申请实施例相关的部分,具体技术细节未揭示的,请参照本申请实施例方法部分。该计算机设备可以为包括手机、平板电脑、PDA(Personal Digital Assistant,个人数字助理)、POS(Point of Sales,销售终端)、车载电脑、穿戴式设备等任意终端设备,以计算机设备为手机为例:The embodiment of the present application also provides a computer device. As shown in FIG. 11 , for the convenience of description, only the parts related to the embodiments of the present application are shown. For details that are not disclosed, refer to the method part of the embodiment of the present application. The computer device may be any terminal device including a mobile phone, a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), a vehicle-mounted computer, a wearable device, and the like, taking a computer device as a mobile phone as an example. :
图11为与本申请实施例提供的计算机设备相关的手机的部分结构的框图。参考图11,手机包括:射频(Radio Frequency,RF)电路1110、存储器1120、输入单元1130、显示单元1140、传感器1150、音频电路1160、无线保真(wireless fidelity,WiFi)模块1170、处理器1180、以及电源1190等部件。本领域技术人员可以理解,图11所示的手机结构并不构成对手机的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。FIG. 11 is a block diagram showing a part of a structure of a mobile phone related to a computer device according to an embodiment of the present application. Referring to FIG. 11 , the mobile phone includes: a radio frequency (RF) circuit 1110 , a memory 1120 , an input unit 1130 , a display unit 1140 , a sensor 1150 , an audio circuit 1160 , a wireless fidelity (WiFi) module 1170 , and a processor 1180 . And power supply 1190 and other components. It will be understood by those skilled in the art that the structure of the handset shown in FIG. 11 does not constitute a limitation to the handset, and may include more or less components than those illustrated, or some components may be combined, or different components may be arranged.
其中,RF电路1110可用于收发信息或通话过程中,信号的接收和发送,可将基站的下行信息接收后,给处理器1180处理;也可以将上行的数据发送给基站。通常,RF电路包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器(Low Noise Amplifier,LNA)、双工器等。此外,RF电路1110还可以通过无线通信与网络和其他设备通信。上述无线通信可以使用任一通信标准或协议,包括但不限于全球移动通讯***(Global System of Mobile communication,GSM)、通用分组无线服务(General Packet Radio Service,GPRS)、码分多址(Code Division Multiple Access,CDMA)、宽带码分多址(Wideband Code Division Multiple Access,WCDMA)、长期演进(Long Term Evolution,LTE))、电子邮件、短消息服务(Short Messaging Service,SMS)等。The RF circuit 1110 can be used for receiving and transmitting information during the transmission and reception of information or during the call. The downlink information of the base station can be received and processed by the processor 1180. The uplink data can also be sent to the base station. Generally, RF circuits include, but are not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a Low Noise Amplifier (LNA), a duplexer, and the like. In addition, RF circuitry 1110 can also communicate with the network and other devices via wireless communication. The above wireless communication may use any communication standard or protocol, including but not limited to Global System of Mobile communication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (Code Division). Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), e-mail, Short Messaging Service (SMS), and the like.
存储器1120可用于存储软件程序以及模块,处理器1180通过运行存储在存储器1120的软件程序以及模块,从而执行手机的各种功能应用以及数据处理。存储器1120可主要包括程序存储区和数据存储区,其中,程序存储区可存储操作***、至少一个功能所需的应用程序(比如声音播放功能的应用程序、图像播放功能的应用程序等)等;数据存储区可存储根据手机的使用所创建的数据(比如音频数据、通讯录等)等。此外,存储器1120可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。The memory 1120 can be used to store software programs and modules, and the processor 1180 executes various functional applications and data processing of the mobile phone by running software programs and modules stored in the memory 1120. The memory 1120 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as an application of a sound playing function, an application of an image playing function, etc.); The data storage area can store data (such as audio data, address book, etc.) created according to the use of the mobile phone. Moreover, memory 1120 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
输入单元1130可用于接收输入的数字或字符信息,以及产生与手机1100的用户设置以及功能控制有关的键信号输入。具体地,输入单元1130可包括触控面板1131以及其他输入设备1132。触控面板1131,也可称为触摸屏,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触控面板1131上或在触控面板1131附近的操作),并根据预先设定的程式驱动相应的连接装置。在一个实施例中,触控面板1131可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给处理器1180,并能接收处理器1180发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触控面板1131。除了触控面板1131,输入单元1130还可以包括其他输入设备1132。具体地,其他输入设备1132可以包括 但不限于物理键盘、功能键(比如音量控制按键、开关按键等)等中的一种或多种。The input unit 1130 can be configured to receive input numeric or character information and to generate key signal inputs related to user settings and function control of the handset 1100. Specifically, the input unit 1130 may include a touch panel 1131 and other input devices 1132. The touch panel 1131, which may also be referred to as a touch screen, can collect touch operations on or near the user (such as a user using a finger, a stylus, or the like on the touch panel 1131 or near the touch panel 1131. Operation) and drive the corresponding connection device according to a preset program. In one embodiment, the touch panel 1131 may include two parts of a touch detection device and a touch controller. Wherein, the touch detection device detects the touch orientation of the user, and detects a signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts the touch information into contact coordinates, and sends the touch information. The processor 1180 is provided and can receive commands from the processor 1180 and execute them. In addition, the touch panel 1131 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch panel 1131, the input unit 1130 may also include other input devices 1132. In particular, other input devices 1132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.).
显示单元1140可用于显示由用户输入的信息或提供给用户的信息以及手机的各种菜单。显示单元1140可包括显示面板1141。在一个实施例中,可以采用液晶显示器(Liquid Crystal Display,LCD)、有机发光二极管(Organic Light-Emitting Diode,OLED)等形式来配置显示面板1141。在一个实施例中,触控面板1131可覆盖显示面板1141,当触控面板1131检测到在其上或附近的触摸操作后,传送给处理器1180以确定触摸事件的类型,随后处理器1180根据触摸事件的类型在显示面板1141上提供相应的视觉输出。虽然在图11中,触控面板1131与显示面板1141是作为两个独立的部件来实现手机的输入和输入功能,但是在某些实施例中,可以将触控面板1131与显示面板1141集成而实现手机的输入和输出功能。The display unit 1140 can be used to display information input by the user or information provided to the user as well as various menus of the mobile phone. The display unit 1140 may include a display panel 1141. In one embodiment, the display panel 1141 may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like. In one embodiment, the touch panel 1131 can cover the display panel 1141. When the touch panel 1131 detects a touch operation thereon or nearby, the touch panel 1131 transmits to the processor 1180 to determine the type of the touch event, and then the processor 1180 is The type of touch event provides a corresponding visual output on display panel 1141. Although in FIG. 11 , the touch panel 1131 and the display panel 1141 are used as two independent components to implement the input and input functions of the mobile phone, in some embodiments, the touch panel 1131 and the display panel 1141 may be integrated. Realize the input and output functions of the phone.
手机1100还可包括至少一种传感器1150,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板1141的亮度,接近传感器可在手机移动到耳边时,关闭显示面板1141和/或背光。运动传感器可包括加速度传感器,通过加速度传感器可检测各个方向上加速度的大小,静止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比如横竖屏切换)、振动识别相关功能(比如计步器、敲击)等;此外,手机还可配置陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器等。The handset 1100 can also include at least one sensor 1150, such as a light sensor, motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 1141 according to the brightness of the ambient light, and the proximity sensor may close the display panel 1141 and/or when the mobile phone moves to the ear. Or backlight. The motion sensor may include an acceleration sensor, and the acceleration sensor can detect the magnitude of the acceleration in each direction, and the magnitude and direction of the gravity can be detected at rest, and can be used to identify the gesture of the mobile phone (such as horizontal and vertical screen switching), and vibration recognition related functions (such as Pedometer, tapping, etc.; in addition, the phone can also be equipped with gyroscopes, barometers, hygrometers, thermometers, infrared sensors and other sensors.
音频电路1160、扬声器1161和传声器1162可提供用户与手机之间的音频接口。音频电路1160可将接收到的音频数据转换后的电信号,传输到扬声器1161,由扬声器1161转换为声音信号输出;另一方面,传声器1162将收集的声音信号转换为电信号,由音频电路1160接收后转换为音频数据,再将音频数据输出处理器1180处理后,经RF电路1110可以发送给另一手机,或者将音频数据输出至存储器1120以便后续处理。 Audio circuitry 1160, speaker 1161, and microphone 1162 can provide an audio interface between the user and the handset. The audio circuit 1160 can transmit the converted electrical data of the received audio data to the speaker 1161, and convert it into a sound signal output by the speaker 1161; on the other hand, the microphone 1162 converts the collected sound signal into an electrical signal, and the audio circuit 1160 After receiving, it is converted into audio data, and then processed by the audio data output processor 1180, transmitted to another mobile phone via the RF circuit 1110, or outputted to the memory 1120 for subsequent processing.
WiFi属于短距离无线传输技术,手机通过WiFi模块1170可以帮助用户收发电子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。虽然图11示出了WiFi模块1170,但是可以理解的是,其并不属于手机1100的必须构成,可以根据需要而省略。WiFi is a short-range wireless transmission technology. The mobile phone can help users to send and receive emails, browse web pages and access streaming media through the WiFi module 1170, which provides users with wireless broadband Internet access. Although FIG. 11 shows the WiFi module 1170, it will be understood that it does not belong to the essential configuration of the handset 1100 and may be omitted as needed.
处理器1180是手机的控制中心,利用各种接口和线路连接整个手机的各个部分,通过运行或执行存储在存储器1120内的软件程序和/或模块,以及调用存储在存储器1120内的数据,执行手机的各种功能和处理数据,从而对手机进行整体监控。在一个实施例中,处理器1180可包括一个或多个处理单元。在一个实施例中,处理器1180可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作***、用户界面和应用程序等;调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器1180中。The processor 1180 is a control center for the handset, which connects various portions of the entire handset using various interfaces and lines, by executing or executing software programs and/or modules stored in the memory 1120, and invoking data stored in the memory 1120, The phone's various functions and processing data, so that the overall monitoring of the phone. In one embodiment, processor 1180 can include one or more processing units. In one embodiment, the processor 1180 can integrate an application processor and a modem processor, wherein the application processor primarily processes an operating system, a user interface, an application, etc.; the modem processor primarily processes wireless communications. It will be appreciated that the above described modem processor may also not be integrated into the processor 1180.
手机1100还包括给各个部件供电的电源1190(比如电池),优选的,电源可以通过电源管理***与处理器1180逻辑相连,从而通过电源管理***实现管理充电、放电、以及功耗管理等功能。The handset 1100 also includes a power source 1190 (such as a battery) that supplies power to the various components. Preferably, the power source can be logically coupled to the processor 1180 via a power management system to manage functions such as charging, discharging, and power management through the power management system.
在一个实施例中,手机1100还可以包括摄像头、蓝牙模块等。In one embodiment, the handset 1100 can also include a camera, a Bluetooth module, and the like.
在本申请实施例中,该计算机设备所包括的处理器1180执行存储在存储器上的计算机程序时实现本申请实施例中信息处理方法的操作。In the embodiment of the present application, the processor 1180 included in the computer device implements the operation of the information processing method in the embodiment of the present application when executing the computer program stored in the memory.
本申请所使用的对存储器、存储、数据库或其它介质的任何引用可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM),它用作外部高速缓冲存储器。作为说明而非局限,RAM 以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDR SDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)。Any reference to a memory, storage, database or other medium used herein may include non-volatile and/or volatile memory. Non-volatile memory can include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM), which acts as an external cache. By way of illustration and not limitation, RAM is available in a variety of formats, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronization. Link (Synchlink) DRAM (SLDRAM), Memory Bus (Rambus) Direct RAM (RDRAM), Direct Memory Bus Dynamic RAM (DRDRAM), and Memory Bus Dynamic RAM (RDRAM).
以上实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above embodiments are merely illustrative of several embodiments of the present application, and the description thereof is more specific and detailed, but is not to be construed as limiting the scope of the claims. It should be noted that a number of variations and modifications may be made by those skilled in the art without departing from the spirit and scope of the present application. Therefore, the scope of the invention should be determined by the appended claims.

Claims (10)

  1. 一种信息处理方法,包括:An information processing method includes:
    在内核空间中获取进程事件,并对所述进程事件分类,得到分类后的进程事件;所述分类后的进程事件包括进程通信事件,所述进程通信事件是根据进程间的通信生成的;及Obtaining a process event in the kernel space, and classifying the process event to obtain a classified process event; the classified process event includes a process communication event, and the process communication event is generated according to communication between processes;
    所述内核空间将所述分类后的进程事件和对应的进程异步传送给用户空间,以使所述用户空间根据所述进程通信事件调整对所述进程的资源限制。The kernel space asynchronously transmits the classified process event and the corresponding process to the user space, so that the user space adjusts resource restrictions on the process according to the process communication event.
  2. 根据权利要求1所述的方法,其特征在于:所述用户空间根据所述进程通信事件调整对所述进程的资源限制包括以下方法中至少一种:The method according to claim 1, wherein the user space adjusts resource restrictions on the process according to the process communication event, including at least one of the following methods:
    所述用户空间根据所述binder启动事件提升所述进程的资源优先级;The user space increases a resource priority of the process according to the binder startup event;
    所述用户空间根据所述binder空闲事件降低所述进程的所述资源优先级;Determining, by the user space, the resource priority of the process according to the binder idle event;
    所述用户空间根据所述socket到达事件提升所述进程的所述资源优先级。The user space raises the resource priority of the process according to the socket arrival event.
  3. 根据权利要求2所述的方法,其特征在于,所述提升所述进程的所述资源优先级包括:The method according to claim 2, wherein the ascending the resource priority of the process comprises:
    当检测到待提升资源优先级的进程为后台进程时,获取当前运行的前台进程的所述资源优先级;When the process of detecting the priority of the resource to be upgraded is a background process, obtaining the resource priority of the currently running foreground process;
    提升所述后台进程的所述资源优先级,提升后所述后台进程的所述资源优先级不高于所述前台进程的所述资源优先级。The resource priority of the background process is raised, and the resource priority of the background process is not higher than the resource priority of the foreground process.
  4. 根据权利要求1所述的方法,其特征在于:The method of claim 1 wherein:
    所述分类后的进程事件还包括进程状态事件,所述进程状态事件是根据所述进程在生命周期中的变化生成的;The classified process event further includes a process state event, and the process state event is generated according to a change of the process in a life cycle;
    所述用户空间根据所述进程状态事件更新所述用户空间中所述进程的进程信息。The user space updates process information of the process in the user space according to the process status event.
  5. 根据权利要求1至4中任一项所述的方法,其特征在于,还包括:The method according to any one of claims 1 to 4, further comprising:
    所述用户空间获取进程进入后台的时长,当所述进程进入后台的时长达到预设时长时,对所述进程进行冻结;所述对所述进程进行冻结是指禁止所述进程使用***资源。The user space acquisition process enters the background, and when the duration of the process entering the background reaches a preset duration, the process is frozen; and the freezing of the process refers to prohibiting the process from using system resources.
  6. 根据权利要求1至4中任一项所述的方法,其特征在于,还包括:The method according to any one of claims 1 to 4, further comprising:
    当所述用户空间接收到处于冻结状态的进程对应的进程通信事件时,将所述处于冻结状态的进程唤醒并调整对所述进程的资源限制。When the user space receives a process communication event corresponding to the process in the frozen state, the process in the frozen state is woken up and the resource restriction on the process is adjusted.
  7. 根据权利要求1至4中任一项所述的方法,其特征在于,还包括:The method according to any one of claims 1 to 4, further comprising:
    当所述用户空间接收到对处于冻结状态的进程的终止命令时,将所述进程解冻,并将解冻后进程设置为不可冻结状态,根据所述终止命令终止所述解冻后进程。When the user space receives the termination command for the process in the frozen state, the process is thawed, and the post-thawing process is set to a non-frozen state, and the thawed process is terminated according to the termination command.
  8. 一种信息处理装置,其特征在于,包括:An information processing apparatus, comprising:
    分类模块,用于在内核空间中获取进程事件,并对所述进程事件分类,得到分类后的进程事件;所述分类后的进程事件包括进程通信事件,所述进程通信事件是根据进程间的通信生成的;及a classification module, configured to acquire a process event in the kernel space, and classify the process event to obtain a classified process event; the classified process event includes a process communication event, and the process communication event is based on an interprocess process Communication generated; and
    传送模块,用于所述内核空间将所述分类后的进程事件和对应的进程异步传送给用户空间,以使所述用户空间根据所述进程通信事件调整对所述进程的资源限制。And a transmitting module, configured to: the kernel space asynchronously transmits the classified process event and the corresponding process to the user space, so that the user space adjusts resource restrictions on the process according to the process communication event.
  9. 一种计算机设备,包括存储器及处理器,所述存储器中储存有计算机程序,所述计算机程序被所述处理器执行时,使得所述处理器执行如权利要求1至7中任一项所述的方法的操作。A computer device comprising a memory and a processor, wherein the memory stores a computer program, the computer program being executed by the processor, causing the processor to perform the method of any one of claims 1 to 7 The operation of the method.
  10. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至7中任一项所述的方法的操作。A computer readable storage medium having stored thereon a computer program, wherein the computer program is executed by a processor to perform the operations of the method of any one of claims 1 to 7.
PCT/CN2018/117010 2017-12-29 2018-11-22 Information processing method, apparatus, computer device and computer-readable storage medium WO2019128573A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201711480459.6A CN109992425B (en) 2017-12-29 2017-12-29 Information processing method, information processing device, computer equipment and computer readable storage medium
CN201711480459.6 2017-12-29

Publications (1)

Publication Number Publication Date
WO2019128573A1 true WO2019128573A1 (en) 2019-07-04

Family

ID=67066408

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/117010 WO2019128573A1 (en) 2017-12-29 2018-11-22 Information processing method, apparatus, computer device and computer-readable storage medium

Country Status (2)

Country Link
CN (1) CN109992425B (en)
WO (1) WO2019128573A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111832976A (en) * 2020-07-29 2020-10-27 深圳市睿策者科技有限公司 Resource configuration pushing method and device, computer equipment and storage medium
CN112416380A (en) * 2019-08-21 2021-02-26 成都鼎桥通信技术有限公司 Method and device for preventing killing and preventing freezing by applying

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113472952A (en) * 2020-03-31 2021-10-01 深圳市万普拉斯科技有限公司 Call making method, device, computer equipment and storage medium
CN113849238B (en) * 2021-09-29 2024-02-09 浪潮电子信息产业股份有限公司 Data communication method, device, electronic equipment and readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070130569A1 (en) * 2005-12-01 2007-06-07 International Business Machines Corporation Method, apparatus and program storage device for providing a no context switch attribute that allows a user mode thread to become a near interrupt disabled priority
CN102117240A (en) * 2009-12-31 2011-07-06 腾讯科技(深圳)有限公司 Method and device for acquiring progress blocking information
CN105138402A (en) * 2015-08-25 2015-12-09 海信集团有限公司 Method and device for adjusting priority of application process memory release
CN106909834A (en) * 2015-12-23 2017-06-30 北京奇虎科技有限公司 A kind of data processing method and device
CN106951314A (en) * 2017-03-10 2017-07-14 清华大学 The cutting-off method automatically waken up towards android system background service

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102479108B (en) * 2010-11-26 2013-09-11 中国科学院声学研究所 Terminal resource management system for multi-application process embedded system and method
CN102722431B (en) * 2012-04-25 2015-09-30 华为技术有限公司 process monitoring method and device
CN103514030B (en) * 2012-07-24 2016-12-21 Tcl集团股份有限公司 The event collection reporting system of android system and collecting and reporting method thereof
CN105808324A (en) * 2014-12-30 2016-07-27 展讯通信(天津)有限公司 Method for improving fluency of system and mobile terminal
CN105677460B (en) * 2015-12-28 2019-07-23 小米科技有限责任公司 Applied program processing method and device
CN105938441B (en) * 2016-04-15 2019-04-30 惠州Tcl移动通信有限公司 A kind of application program for mobile terminal setting processing method and system
CN106648849A (en) * 2016-10-18 2017-05-10 上海传英信息技术有限公司 Process freezing method and mobile terminal

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070130569A1 (en) * 2005-12-01 2007-06-07 International Business Machines Corporation Method, apparatus and program storage device for providing a no context switch attribute that allows a user mode thread to become a near interrupt disabled priority
CN102117240A (en) * 2009-12-31 2011-07-06 腾讯科技(深圳)有限公司 Method and device for acquiring progress blocking information
CN105138402A (en) * 2015-08-25 2015-12-09 海信集团有限公司 Method and device for adjusting priority of application process memory release
CN106909834A (en) * 2015-12-23 2017-06-30 北京奇虎科技有限公司 A kind of data processing method and device
CN106951314A (en) * 2017-03-10 2017-07-14 清华大学 The cutting-off method automatically waken up towards android system background service

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112416380A (en) * 2019-08-21 2021-02-26 成都鼎桥通信技术有限公司 Method and device for preventing killing and preventing freezing by applying
CN112416380B (en) * 2019-08-21 2024-03-29 成都鼎桥通信技术有限公司 Method and device for killing and freezing prevention by application
CN111832976A (en) * 2020-07-29 2020-10-27 深圳市睿策者科技有限公司 Resource configuration pushing method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN109992425A (en) 2019-07-09
CN109992425B (en) 2022-03-15

Similar Documents

Publication Publication Date Title
KR102148948B1 (en) Multi tasking method of electronic apparatus and electronic apparatus thereof
WO2019128540A1 (en) Resource management method, mobile terminal and computer readable storage medium
TWI494857B (en) Method for performing wake-up event management, and associated apparatus and associated computer program product
CN110018901B (en) Memory recovery method and device, computer equipment and computer readable storage medium
WO2019128546A1 (en) Application program processing method, electronic device, and computer readable storage medium
WO2019128573A1 (en) Information processing method, apparatus, computer device and computer-readable storage medium
WO2020024732A1 (en) Process processing method, electronic device, and computer-readable storage medium
KR102137097B1 (en) Processing Method for periodic event and Electronic device supporting the same
CN110032266B (en) Information processing method, information processing device, computer equipment and computer readable storage medium
WO2019128537A1 (en) Application freezing method, and computer device and computer-readable storage medium
WO2019128574A1 (en) Information processing method and device, computer device and computer readable storage medium
WO2020093208A1 (en) Application processing method and apparatus, computer device, and computer readable storage medium
WO2019128588A1 (en) Process processing method and apparatus, electronic device, computer readable storage medium
WO2019137170A1 (en) Information processing method, mobile terminal, and computer readable storage medium
WO2019137252A1 (en) Memory processing method, electronic device, and computer-readable storage medium
WO2015081664A1 (en) Method, apparatus, device and system for controlling wireless network to be switched on/off
CN110018905B (en) Information processing method, information processing apparatus, computer device, and computer-readable storage medium
WO2019137173A1 (en) Resource management method, mobile terminal and computer-readable storage medium
WO2019128571A1 (en) Resource management method and device, mobile terminal, as well as computer readable storage medium
WO2019128586A1 (en) Application processing method, electronic device, and computer readable storage medium
WO2019128569A1 (en) Method and apparatus for freezing application, and storage medium and terminal
WO2019128553A1 (en) Application processing method, electronic device, and computer-readable storage medium
CN109992360B (en) Process processing method and device, electronic equipment and computer readable storage medium
WO2019128542A1 (en) Application processing method, electronic device, computer readable storage medium
WO2019128570A1 (en) Method and apparatus for freezing application, and storage medium and terminal

Legal Events

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

Ref document number: 18896901

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18896901

Country of ref document: EP

Kind code of ref document: A1