CN111400002B - Application process and processor core binding method and terminal - Google Patents

Application process and processor core binding method and terminal Download PDF

Info

Publication number
CN111400002B
CN111400002B CN202010158816.2A CN202010158816A CN111400002B CN 111400002 B CN111400002 B CN 111400002B CN 202010158816 A CN202010158816 A CN 202010158816A CN 111400002 B CN111400002 B CN 111400002B
Authority
CN
China
Prior art keywords
application
target application
target
state
state change
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN202010158816.2A
Other languages
Chinese (zh)
Other versions
CN111400002A (en
Inventor
矫恒浩
吴连朋
张宏波
夏章抓
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Juhaokan Technology Co Ltd
Original Assignee
Juhaokan Technology Co Ltd
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 Juhaokan Technology Co Ltd filed Critical Juhaokan Technology Co Ltd
Priority to CN202010158816.2A priority Critical patent/CN111400002B/en
Publication of CN111400002A publication Critical patent/CN111400002A/en
Application granted granted Critical
Publication of CN111400002B publication Critical patent/CN111400002B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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
    • 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
    • G06F9/545Interprogram communication where tasks reside in different layers, e.g. user- and kernel-space

Landscapes

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

Abstract

The application discloses a method and a terminal for binding an application process and a processor core, and belongs to the technical field of networks. In the application, the application process of the target application and the target logic core of the CPU may be bound, and then, the process state change of the target application is detected according to the identifier of the target application, and the binding relationship between the application process of the target application and the target logic core is adjusted according to the detected state change result. And the state change result is used for indicating the sub-process of the application process of the newly added target application or the sub-process corresponding to the application process of the target application to exit. Therefore, the performance of the application process of the target application can be improved by binding the application process of the target application with the target logic core, and resource competition conflict between the application process of the target application and the sub-process can be avoided.

Description

Application process and processor core binding method and terminal
Technical Field
The present application relates to the field of computers, and in particular, to a method and a terminal for binding an application process and a processor core.
Background
A CPU (Central Processing Unit) may include multiple physical cores, where each physical core may be divided into multiple logical cores. The application process of the application is bound with the logic core of the CPU, so that the application process can be prevented from being switched among different logic cores included in the CPU, and the performance of the application process can be effectively improved.
However, for some applications, during the execution of the application, a sub-process of the application process may be generated to perform other tasks. At this time, the application process is the parent process corresponding to the child process. The parent process and the child process share the resource, that is, the parent process is bound to the logical core, and therefore the child process is also bound to the logical core. Therefore, in the process of running the parent process and the child process, resource competition conflict can be generated between the parent process and the child process, and the performance of the parent process and the child process is affected. Based on this, it is desirable to provide a method for binding an application process and a processor core, so as to improve the performance of the parent process and the child process in the above scenario.
Disclosure of Invention
The embodiment of the application provides a method for binding an application process and a processor core, a terminal and a storage medium, which can solve the problem that resource competition conflict is generated between the application process and a sub-process when the application process generates the sub-process after the application process is bound on a logic core. The technical scheme is as follows:
in one aspect, a method for binding an application process and a processor core is provided, and the method includes:
binding an application process of a target application with a target logic core of a CPU (central processing unit), wherein the target logic core is any one of a plurality of logic cores of the CPU;
detecting the process state change of the target application according to the identification of the target application;
and adjusting the binding relationship between the application process of the target application and the target logic core according to the detected state change result, wherein the state change result is used for indicating that a sub-process corresponding to the application process of the newly added target application or a sub-process corresponding to the application process of the target application exits.
In another aspect, a terminal is provided, which includes:
the system comprises a binding module, a processing module and a processing module, wherein the binding module is used for binding an application process of a target application with a target logic core of a CPU (central processing unit), and the target logic core is any one of a plurality of logic cores of the CPU;
the detection module is used for detecting the process state change of the target application according to the identification of the target application;
and the adjusting module is used for adjusting the binding relationship between the application process of the target application and the target logic core according to the detected state change result, wherein the state change result is used for indicating that a new sub-process corresponding to the application process of the target application or a sub-process corresponding to the application process of the target application exits.
In another aspect, a terminal is provided, the terminal comprising a processor, a communication interface, a memory, and a communication bus;
the processor, the communication interface and the memory are communicated with each other through the communication bus;
the memory is used for storing computer programs;
the processor is used for executing the program stored on the memory so as to realize the method for binding the application process and the processor core.
In another aspect, a computer readable storage medium is provided, in which a computer program is stored, and when executed by a processor, the computer program implements the steps of the foregoing application process and processor core binding method.
The beneficial effects brought by the technical scheme provided by the embodiment of the application at least comprise:
in this embodiment, a process state change of the target application may be detected, where the detected process state change result may include a sub-process corresponding to an application process of the newly added target application or a sub-process exit corresponding to an application process of the target application. Therefore, the terminal can dynamically adjust the binding relationship between the application process of the target application and the target logic core according to whether the target application is added with the sub-process or whether the target-referenced sub-process exits, and resource competition conflicts between the application process of the target application and the sub-process are avoided.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a system architecture diagram according to a method for binding an application process and a processor core provided in an embodiment of the present application;
fig. 2 is a flowchart of a method for binding an application process and a processor core according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a terminal according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of another terminal provided in an embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the exemplary embodiments of the present application clearer, the technical solutions in the exemplary embodiments of the present application will be clearly and completely described below with reference to the drawings in the exemplary embodiments of the present application, and it is obvious that the described exemplary embodiments are only a part of the embodiments of the present application, but not all the embodiments.
All other embodiments, which can be derived by a person skilled in the art from the exemplary embodiments shown in the present application without inventive effort, shall fall within the scope of protection of the present application. Moreover, while the disclosure herein has been presented in terms of exemplary one or more examples, it is to be understood that each aspect of the disclosure can be utilized independently and separately from other aspects of the disclosure to provide a complete disclosure.
It should be understood that the terms "first," "second," "third," and the like in the description and in the claims of the present application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used are interchangeable under appropriate circumstances and can be implemented in sequences other than those illustrated or otherwise described herein with respect to the embodiments of the application, for example.
Furthermore, the terms "comprises" and "comprising," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a product or device that comprises a list of elements is not necessarily limited to those elements explicitly listed, but may include other elements not expressly listed or inherent to such product or device.
The term "module," as used herein, refers to any known or later developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware and/or software code that is capable of performing the functionality associated with that element.
Before explaining the embodiments of the present application in detail, an application scenario related to the embodiments of the present application will be described.
At present, the performance of an application process can be improved by binding the application process of an application with a logic core of a CPU, however, in the running process of some applications, a sub-process of the application process may be generated to execute other tasks, and since the sub-process and the application process share resources, the sub-process and the application process are bound in the same logic core, so that resource competition may be generated between the sub-process and the application process, and the performance of the application process is reduced on the contrary. The method for binding the application process and the processor core provided by the embodiment of the application process and the processor core can be used for adjusting the binding relationship between the application process and the logic core according to the process state change of the target application in the above scenario, so that resource competition between the application process and the sub-process is avoided.
For example, for a single-process Redis database, an application process of the Redis database may be bound to one logical core in the CPU, so that the performance of the application process may be greatly improved. However, when the Redis is configured with the persistence process, a sub-process is generated during the persistence process, and thus the sub-process and the application process of the Redis are bound to the same logical core, which causes resource competition between the sub-process and the application process of the Redis. Under such a condition, the application process and processor core binding method provided by the embodiment of the application can be adopted to unbind the application process and the logic core of the Redis; when the fact that the sub-process exits is detected, the application process of the Redis is bound with the logic core again, so that the performance of the application process of the Redis is improved, and meanwhile resource competition between the application process of the Redis and the sub-process is avoided.
Next, a system architecture related to the method for binding an application process and a processor core provided in the embodiment of the present application is described.
Fig. 1 is a system structure diagram of a terminal according to a method for binding an application process and a processor core provided in an embodiment of the present application. As shown in fig. 1, the terminal 100 includes a processor 101, an application 102, and a memory 103. Processor 101 includes a plurality of physical cores, each of which includes a plurality of logical cores. Processor 101 may communicate with applications 102, memory 103.
Wherein the processor 101 may bind the application process of the application 102 on the logical core. Then, the processor 101 may detect a process state change of the application 102 according to the application identifier of the application 102, and when a process state change result is used to indicate a sub-process corresponding to the application process of the newly added application 102, the processor 101 may unbundle the application process of the application 102 from the logical core. When the process state change result is used to indicate that the sub-process corresponding to the application process of the application 102 exits, the processor 101 may bind the application process of the application 102 with the logical core.
The application 102 is a single-process application installed on the terminal 100, and an application process of the application 102 may be bound to a logical core of the processor, so that the application process is always processed on the logical core and is not switched between multiple logical cores of the processor. During operation of the application 102, sub-processes of the application process may be spawned to perform other tasks. At this time, the application process of the application 102 is the parent process corresponding to the child process.
The memory 103 is used for storing programs of application processes of the application 102, data generated during execution of the application processes, and the like.
Next, a method for binding an application process and a processor core provided in the embodiment of the present application is introduced.
Fig. 2 is a flowchart of a method for binding an application process and a processor core according to an embodiment of the present disclosure, where the method may be applied to a processor, which may be referred to as the processor 101 in fig. 1. As shown in fig. 2, the method comprises the steps of:
step 201: the application process of the target application is bound with a target logic core of a CPU of the processor, and the target logic core is any one of a plurality of logic cores of the CPU.
The CPU may include a plurality of physical cores, each of the plurality of physical cores may include a plurality of logical cores, and the application process of the target application may be bound to one logical core of the CPU. The target application is a single-process application, that is, the target application only generates one main process when being executed.
As an example, the processor of the terminal may control the display device to display a configuration page, where the configuration page includes at least an affinity configuration item, and the affinity configuration item is used to indicate a logical core to which an application process of the target application is to be bound. The user may input a logical core identifier in the affinity configuration item, and the processor may obtain the logical core identifier input by the user, and use the logical core identified by the logical core identifier as the target logical core. Thereafter, when the target application is detected to be launched, the processor may bind the application process of the target application with the target logical core.
Optionally, the target logic core may be one logic core selected according to processing capabilities of the plurality of logic cores, or may be one logic core arbitrarily selected from the plurality of logic cores, which is not limited herein in this embodiment of the application.
After the processor binds the application process of the target application with the target logic core, the application process of the target application is only processed on the target logic core, so that the application process of the target application can be prevented from being switched among a plurality of logic cores. When the application processes are processed on different logic cores, execution environments need to be built, for example: the register, the display card and the like, so that after the application process of the target application is bound with the target logic core, the execution environment switching expense caused by repeated switching of the application process among a plurality of logic cores is reduced. And the application process of the target application is bound with the target logic core, so that the probability of acquiring the required program from the cache memory can be improved.
Step 202: and detecting the process state change of the target application according to the identification of the target application.
After the target application is started and the application process of the target application is bound with the target logic core, the processor may determine the process state of the target application according to the identifier of the target application at preset time intervals, and determine the state change result of the application process of the target application according to the process state of the target application at the current time and the process state determined most recently before the current time.
The preset time interval is a time interval stored in the processor, and may be 1s, for example. In addition, the state change result is used for indicating that the sub-process corresponding to the application process of the newly added target application or the sub-process corresponding to the application process of the target application exits.
It should be noted that, during the running process of the target application, a sub-process corresponding to the application process of the target application may be newly added, and other tasks are executed by the sub-process, and when the sub-process executes other tasks, the sub-process exits.
For example, Redis is a single-process memory database, when Redis performs persistence, that is, when data backup is performed, Redis adds a new sub-process corresponding to a Redis application process, and performs data backup through the sub-process, and after the data backup is completed, the sub-process exits.
In some embodiments, the processor may determine, at preset time intervals, a process state of the target application according to the identifier of the target application; and if the process state determined at the current moment is the first state and the process state determined last time before the current moment is the second state, determining that the state change result of the application process of the target application is the first state change result. The first state indicates that the target application corresponds to a plurality of processes with the same process name, the process identifier of one process in the plurality of processes is the same as the parent process identifier of the other process, the second state indicates that the target application corresponds to one application process, and the first state change result is used for indicating a child process corresponding to the application process added with the target application.
It should be noted that each process may include a process name, a process identifier, and an application identifier. Optionally, when the process is a child process, a parent process identifier may be further included, where the parent process identifier is the same as the process identifier of the parent process corresponding to the process, and the process names of the parent process and the child process are the same.
As an example, the processor may obtain all current processes of the terminal, and then, according to the application identifier of the target application, find a process that includes the application identifier that is the same as the application identifier of the target application from all the processes. And determining the process state of the target application at the current moment according to the searched process, and correspondingly storing the process state of the target application at the current moment and the current moment.
Specifically, when the process corresponding to the target application is found to include multiple processes with the same process name, and a parent process identifier included in at least one process is the same as a process identifier of an application process of the target application, at this time, it may be determined that the process of the target application exists in a child process, that is, it may be determined that the process state of the target application at the current time is the first state. When the process corresponding to the searched target application does not include multiple processes with the same name, it may be determined that the process of the target application does not have a sub-process, that is, it may be determined that the process state of the target application at the current time is the second state. Then, the terminal may store the correspondence between the process state at the current time and the current time.
For example, it is assumed that the processor determines that the process corresponding to the target application is as shown in table 1 below, where the process corresponding to the application identified by the application 1 includes two processes with the same process name, and the process with the process identifier 2 corresponds to the parent process identifier 1, and the parent process identifier is the same as the process identifier of the process with the process identifier 1, that is, the process with the process identifier 2 is a child process of the process with the process identifier 1, and at this time, it may be determined that the process state of the application identified by the application 1 at the current time is the first state.
TABLE 1
Process name Process identification Parent process identification Application identification
Process 1 1 Applications 1
Process 1 2 1 Applications 1
For another example, the processor determines that the process corresponding to the target application is as shown in table 2 below, where the process corresponding to the application identified by the application 1 does not include two processes with the same process name, but only includes one process, and at this time, the process state of the application identified by the application 1 at the current time may be determined to be the second state.
TABLE 2
Process name Process identification Application identification
Process 1 1 Applications 1
After the processor determines the process state of the target application at the current time, the process state determined last time before the current time can be obtained from the stored corresponding relation, and the state change result of the application process of the target application is determined according to the process state at the current time and the process state determined last time before the current time.
The process state determined at the current time is a first state, which indicates that the process of the target application includes the sub-process, while the process state determined last time before the current time is a second state, which indicates that the process of the target application determined last time before the current time does not include the sub-process. In this way, the sub-process corresponding to the application process to which the target application is newly added may be determined, that is, the state change result of the application process of the target application may be determined to be the first state change result.
Illustratively, assume that the processor determines the process state every 1s, and the stored partial correspondence is as shown in table 3. After determining that the process state at the current time 12:00 is the first state, the processor may acquire the process state determined last time before the current time from the stored correspondence, that is, the process state corresponding to 11:59 is the second state, and thus, it may be determined that the state change result of the application process of the target application is the first state change result.
TABLE 3
The current time Process state
11:58 Second state
11:59 Second state
In other embodiments, if the process state determined at the current time is the second state and the process state determined last time before the current time is the first state, the state change result of the application process of the target application is determined to be the second state change result, and the second state change result is used to indicate that the sub-process corresponding to the application process of the target application exits.
In this case, the process state determined at the present time is the second state indicating that the process of the target application does not include the child process, and the process state determined last before the present time is the first state indicating that the process of the target application determined last before the present time includes the child process. In this way, it may be determined that the sub-process corresponding to the application process of the target application exits, that is, it may be determined that the state change result of the application process of the target application is the second state change result.
Illustratively, assume that the processor determines the process state every 1s, and the stored partial correspondence is as shown in table 4. After determining that the process state at the current time 12:26 is the second state, the processor may acquire the process state determined last time before the current time from the stored correspondence, that is, the process state corresponding to 12:25 is the first state, and thus, may determine that the state change result of the application process of the target application is the second state change result.
TABLE 4
Current time of day Process state
12:25 First state
12:26 Second state
Step 203: and adjusting the binding relationship between the application process of the target application and the target logic core according to the detected state change result.
In some embodiments, when the state change result detected by the processor is the first state change result, the application process of the target application is unbound from the target logical core.
And when the state change result detected by the processor is the first state change result, indicating that a child process corresponding to the application process of the target application is newly added, wherein the application process of the target application is a parent process corresponding to the child process. In this case, the parent process and the child process may share resources, i.e., since the parent process is bound to the target logical core, the child process is also bound to the target logical core. Therefore, in the running process of the parent process and the child process, resource competition conflict can be generated between the parent process and the child process, and the performance of the parent process and the performance of the child process are affected. To avoid this, when the processor determines that the state change result is the first state change result, the application process of the target application may be unbound from the target logical core.
After the processor unbinds the application process of the target application and the target logic core, the processor may allocate a first logic core to the application process of the target application, allocate a second logic core to a sub-process corresponding to the application process of the target application, and the first logic core and the second logic core are two different logic cores of a plurality of logic cores included in the CPU.
It should be noted that, when the processor allocates the first logic core to the application process of the target application and allocates the second logic core to the sub-process corresponding to the application process of the target application, the first logic core and the second logic core may be selected according to the processing capabilities of the plurality of logic cores, or the first logic core and the second logic core may be arbitrarily selected from the plurality of logic cores, which is not limited herein in this embodiment of the application.
In other embodiments, when the state change result detected by the processor is the second state change result, the application process of the target application and the target logical core are bound again.
And when the state change result detected by the processor is a second state result, indicating that the sub-process corresponding to the application process of the target application exits. In this case, since the child process has already exited, there is no problem that resource contention conflict is generated between the parent process and the child process, and therefore, the application process of the target application and the target logical core can be bound again, so as to improve the performance of the application process of the target application.
In this embodiment, a process state change of the target application may be detected, where the detected process state change result may include a sub-process corresponding to an application process of the newly added target application or a sub-process exit corresponding to an application process of the target application. Therefore, when the terminal determines the sub-process corresponding to the application process of the newly added target application according to the process state change result, the binding between the application process of the target application and the target logic core can be released. When the terminal determines that the sub-process of the target application exits according to the process state change result, the application process of the target application and the target logic core can be bound again, so that resource competition conflict between the application process of the target application and the sub-process is avoided.
Referring to fig. 3, an embodiment of the present application provides a terminal 300, where the terminal 300 includes:
a binding module 301, configured to bind an application process of a target application with a target logic core of a CPU of a processor, where the target logic core is any one of multiple logic cores of the CPU;
a detecting module 302, configured to detect a process state change of a target application according to an identifier of the target application;
an adjusting module 303, configured to adjust a binding relationship between the application process of the target application and the target logic core according to the detected state change result, where the state change result is used to indicate that a sub-process corresponding to the application process of the newly-added target application or a sub-process corresponding to the application process of the target application exits.
Optionally, the detection module 302 is specifically configured to:
determining the process state of the target application according to the identification of the target application at intervals of a preset time interval;
if the process state determined at the current moment is the first state and the process state determined last time before the current moment is the second state, determining that the state change result of the application process of the target application is the first state change result;
the first state indicates that the target application corresponds to a plurality of processes with the same process name, the process identifier of one process in the plurality of processes is the same as the parent process identifier of the other processes, the second state indicates that the target application corresponds to one application process, and the first state change result is used for indicating the child process corresponding to the application process with the new target application.
Optionally, the adjusting module 303 is specifically configured to:
and when the detected state change result is the first state change result, unbinding the application process of the target application and the target logic core.
Optionally, the adjusting module 303 is further configured to:
the method comprises the steps of allocating a first logic core for an application process of a target application, allocating a second logic core for a sub-process corresponding to the application process of the target application, wherein the first logic core and the second logic core are two different logic cores in a plurality of logic cores included by a CPU.
Optionally, the detection module 302 is further specifically configured to:
and if the process state determined at the current moment is the second state and the process state determined last time before the current moment is the first state, determining that the state change result of the application process of the target application is the second state change result, wherein the second state change result is used for indicating that the sub-process corresponding to the application process of the target application exits.
Optionally, the adjusting module 303 is specifically configured to:
and when the detected state change result is a second state change result, the application process of the target application and the target logic core are bound again.
In summary, in the embodiment of the present application, a process state change of the target application may be detected, where a detected process state change result may include a sub-process corresponding to an application process of the newly added target application or a sub-process exit corresponding to an application process of the target application. Therefore, when the terminal determines the sub-process corresponding to the application process of the newly added target application according to the process state change result, the binding between the application process of the target application and the target logic core can be released. When the terminal determines that the sub-process of the target application exits according to the process state change result, the application process of the target application and the target logic core can be bound again, so that resource competition conflict between the application process of the target application and the sub-process is avoided.
It should be noted that: the application process and processor core binding terminal provided in the foregoing embodiment is only illustrated by the division of the foregoing functional modules when the application process and the processor core are bound, and in practical applications, the function distribution may be completed by different functional modules as needed, that is, an internal structure of the device is divided into different functional modules, so as to complete all or part of the functions described above. In addition, the application process and processor core binding terminal and the application process and processor core binding method embodiment provided by the above embodiments belong to the same concept, and specific implementation processes thereof are detailed in the method embodiment and are not described herein again.
Fig. 4 is a block diagram illustrating an architecture of a terminal 400 in which an application process is bound to a processor core, according to an example embodiment. The terminal 400 may be a notebook computer, a desktop computer, or the like.
Generally, the terminal 400 includes: a processor 401 and a memory 402.
Processor 401 may include one or more processing cores such as a 4-core processor, an 8-core processor, and the like. The processor 401 may be implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). The processor 401 may also include a main processor and a coprocessor, where the main processor is a processor for Processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 401 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content required to be displayed by the display screen. In some embodiments, the processor 401 may further include an AI (Artificial Intelligence) processor for processing computing operations related to machine learning.
Memory 402 may include one or more computer-readable storage media, which may be non-transitory. Memory 402 may also include high speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium in the memory 402 is configured to store at least one instruction, where the at least one instruction is configured to be executed by the processor 401 to implement the method for binding an application process and a processor core provided by the method embodiments of the present application.
In some embodiments, the terminal 400 may further optionally include: a peripheral interface 403 and at least one peripheral. The processor 401, memory 402 and peripheral interface 403 may be connected by bus or signal lines. Various peripheral devices may be connected to the peripheral interface 403 via a bus, signal line, or circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 404, a display screen 405, a camera assembly 406, an audio circuit 407, a positioning assembly 408, and a power supply 409.
The peripheral interface 403 may be used to connect at least one peripheral related to I/O (Input/Output) to the processor 401 and the memory 402. In some embodiments, processor 401, memory 402, and peripheral interface 403 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 401, the memory 402 and the peripheral interface 403 may be implemented on a separate chip or circuit board, which is not limited by this embodiment.
The Radio Frequency circuit 404 is used for receiving and transmitting RF (Radio Frequency) signals, also called electromagnetic signals. The radio frequency circuitry 404 communicates with communication networks and other communication devices via electromagnetic signals. The rf circuit 404 converts an electrical signal into an electromagnetic signal to transmit, or converts a received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 404 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and so forth. The radio frequency circuitry 404 may communicate with other terminals via at least one wireless communication protocol. The wireless communication protocols include, but are not limited to: the world wide web, metropolitan area networks, intranets, generations of mobile communication networks (2G, 3G, 4G, and 5G), Wireless local area networks, and/or WiFi (Wireless Fidelity) networks. In some embodiments, the rf circuit 404 may further include NFC (Near Field Communication) related circuits, which are not limited in this application.
The display screen 405 is used to display a UI (User Interface). The UI may include graphics, text, icons, video, and any combination thereof. When the display screen 405 is a touch display screen, the display screen 405 also has the ability to capture touch signals on or over the surface of the display screen 405. The touch signal may be input to the processor 401 as a control signal for processing. At this point, the display screen 405 may also be used to provide virtual buttons and/or a virtual keyboard, also referred to as soft buttons and/or a soft keyboard. In some embodiments, the display screen 405 may be one, providing the front panel of the terminal 400; in other embodiments, the display screen 405 may be at least two, respectively disposed on different surfaces of the terminal 400 or in a foldable design; in still other embodiments, the display 405 may be a flexible display disposed on a curved surface or a folded surface of the terminal 400. Even further, the display screen 405 may be arranged in a non-rectangular irregular pattern, i.e. a shaped screen. The Display screen 405 may be made of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), and other materials. It should be noted that, in the embodiment of the present application, when the terminal 400 is a landscape terminal, the aspect ratio of the display screen of the terminal 400 is greater than 1, for example, the aspect ratio of the display screen of the terminal 400 may be 16:9 or 4: 3. When the terminal 400 is a portrait terminal, the aspect ratio of the display of the terminal 400 is less than 1, for example, the aspect ratio of the display of the terminal 400 may be 9:18 or 3:4, etc.
The camera assembly 406 is used to capture images or video. Optionally, camera assembly 406 includes a front camera and a rear camera. Generally, a front camera is disposed at a front panel of the terminal, and a rear camera is disposed at a rear surface of the terminal. In some embodiments, the number of the rear cameras is at least two, and each rear camera is any one of a main camera, a depth-of-field camera, a wide-angle camera and a telephoto camera, so that the main camera and the depth-of-field camera are fused to realize a background blurring function, and the main camera and the wide-angle camera are fused to realize panoramic shooting and VR (Virtual Reality) shooting functions or other fusion shooting functions. In some embodiments, camera assembly 406 may also include a flash. The flash lamp can be a monochrome temperature flash lamp or a bicolor temperature flash lamp. The double-color-temperature flash lamp is a combination of a warm-light flash lamp and a cold-light flash lamp and can be used for light compensation under different color temperatures.
The audio circuit 407 may include a microphone and a speaker. The microphone is used for collecting sound waves of a user and the environment, converting the sound waves into electric signals, and inputting the electric signals to the processor 401 for processing, or inputting the electric signals to the radio frequency circuit 404 for realizing voice communication. For the purpose of stereo sound collection or noise reduction, a plurality of microphones may be provided at different portions of the terminal 400. The microphone may also be an array microphone or an omni-directional pick-up microphone. The speaker is used to convert electrical signals from the processor 401 or the radio frequency circuit 404 into sound waves. The loudspeaker can be a traditional film loudspeaker or a piezoelectric ceramic loudspeaker. When the speaker is a piezoelectric ceramic speaker, the speaker can be used for purposes such as converting an electric signal into a sound wave audible to a human being, or converting an electric signal into a sound wave inaudible to a human being to measure a distance. In some embodiments, audio circuitry 407 may also include a headphone jack.
The positioning component 408 is used to locate the current geographic position of the terminal 400 for navigation or LBS (Location Based Service). The Positioning component 408 may be a Positioning component based on the GPS (Global Positioning System) of the united states, the beidou System of china, or the galileo System of the european union.
The power supply 409 is used to supply power to the various components in the terminal 400. The power source 409 may be alternating current, direct current, disposable or rechargeable. When the power source 409 includes a rechargeable battery, the rechargeable battery may be a wired rechargeable battery or a wireless rechargeable battery. The wired rechargeable battery is a battery charged through a wired line, and the wireless rechargeable battery is a battery charged through a wireless coil. The rechargeable battery may also be used to support fast charge technology.
In some embodiments, the terminal 400 also includes one or more sensors 410. The one or more sensors 410 include, but are not limited to: acceleration sensor 411, gyro sensor 412, pressure sensor 413, fingerprint sensor 414, optical sensor 415, and proximity sensor 416.
The acceleration sensor 411 may detect the magnitude of acceleration in three coordinate axes of the coordinate system established with the terminal 400. For example, the acceleration sensor 411 may be used to detect components of the gravitational acceleration in three coordinate axes. The processor 401 may control the display screen 405 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signal collected by the acceleration sensor 411. The acceleration sensor 411 may also be used for acquisition of motion data of a game or a user.
The gyro sensor 412 may detect a body direction and a rotation angle of the terminal 400, and the gyro sensor 412 may cooperate with the acceleration sensor 411 to acquire a 3D motion of the terminal 400 by the user. From the data collected by the gyro sensor 412, the processor 401 may implement the following functions: motion sensing (such as changing the UI according to a user's tilting operation), image stabilization at the time of photographing, game control, and inertial navigation.
The pressure sensor 413 may be disposed on a side bezel of the terminal 400 and/or on a lower layer of the display screen 405. When the pressure sensor 413 is disposed on the side frame of the terminal 400, a user's holding signal to the terminal 400 can be detected, and the processor 401 performs left-right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 413. When the pressure sensor 413 is disposed at the lower layer of the display screen 405, the processor 401 controls the operability control on the UI interface according to the pressure operation of the user on the display screen 405. The operability control comprises at least one of a button control, a scroll bar control, an icon control, and a menu control.
The fingerprint sensor 414 is used to collect a fingerprint of the user, and the processor 401 identifies the user according to the fingerprint collected by the fingerprint sensor 414, or the fingerprint sensor 414 identifies the user according to the collected fingerprint. Upon identifying that the user's identity is a trusted identity, processor 401 authorizes the user to perform relevant sensitive operations including unlocking the screen, viewing encrypted information, downloading software, paying, and changing settings, etc. The fingerprint sensor 414 may be disposed on the front, back, or side of the terminal 400. When a physical key or vendor Logo is provided on the terminal 400, the fingerprint sensor 414 may be integrated with the physical key or vendor Logo.
The optical sensor 415 is used to collect the ambient light intensity. In one embodiment, processor 401 may control the display brightness of display screen 405 based on the ambient light intensity collected by optical sensor 415. Specifically, when the ambient light intensity is high, the display brightness of the display screen 405 is increased; when the ambient light intensity is low, the display brightness of the display screen 405 is reduced. In another embodiment, the processor 401 may also dynamically adjust the shooting parameters of the camera assembly 406 according to the ambient light intensity collected by the optical sensor 415.
A proximity sensor 416, also known as a distance sensor, is typically disposed on the front panel of the terminal 400. The proximity sensor 416 is used to collect the distance between the user and the front surface of the terminal 400. In one embodiment, when the proximity sensor 416 detects that the distance between the user and the front surface of the terminal 400 gradually decreases, the processor 401 controls the display screen 405 to switch from the bright screen state to the dark screen state; when the proximity sensor 416 detects that the distance between the user and the front surface of the terminal 400 is gradually increased, the display screen 405 is controlled by the processor 401 to switch from the breath-screen state to the bright-screen state.
That is, not only is the terminal provided by the embodiments of the present application, which includes a processor and a memory for storing executable instructions of the processor, wherein the processor is configured to execute the method for binding the application process and the processor core shown in fig. 2, but also the embodiments of the present application provide a computer-readable storage medium, which stores a computer program, and the computer program can implement the method for binding the application process and the processor core shown in fig. 2 when being executed by the processor.
Embodiments of the present application further provide a computer program product containing instructions, which when run on a computer, causes the computer to execute the method for binding an application process and a processor core provided in the embodiment shown in fig. 2.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only exemplary of the present application and should not be taken as limiting, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (6)

1. A method for binding an application process and a processor core, the method comprising:
binding an application process of a target application with a target logic core of a CPU (central processing unit), wherein the target logic core is any one of a plurality of logic cores of the CPU;
detecting the process state change of the target application according to the identification of the target application;
when the detected state change result is a first state change result, unbinding the application process of the target application and the target logic core, wherein the first state change result is used for indicating a new sub-process corresponding to the application process of the target application;
and allocating a first logic core for the application process of the target application, and allocating a second logic core for a sub-process corresponding to the application process of the target application, wherein the first logic core and the second logic core are two different logic cores in the multiple logic cores of the CPU.
2. The method of claim 1, wherein the detecting a process state change of the target application according to the identification of the target application comprises:
determining the process state of the target application according to the identification of the target application at intervals of a preset time interval;
if the process state determined at the current moment is a first state and the process state determined last time before the current moment is a second state, determining that the state change result of the application process of the target application is a first state change result;
the first state indicates that the target application corresponds to a plurality of processes with the same process name, the process identifier of one process in the plurality of processes is the same as the parent process identifier of the other process, the second state indicates that the target application corresponds to one application process, and the first state change result is used for indicating a child process corresponding to the application process to which the target application is added.
3. The method of claim 2, wherein after determining the process state of the target application, further comprising:
and if the process state determined at the current moment is the second state and the process state determined last time before the current moment is the first state, determining that the state change result of the application process of the target application is a second state change result, wherein the second state change result is used for indicating that the sub-process corresponding to the application process of the target application exits.
4. The method of claim 3, wherein after detecting the change in the process state of the target application according to the identity of the target application, further comprising:
and when the detected state change result is the second state change result, the application process of the target application and the target logic core are bound again.
5. A terminal for binding an application process to a processor core, the terminal comprising:
a memory for storing a computer program;
a processor in communication with the memory, the processor to:
binding an application process of a target application with a target logic core of a CPU (central processing unit), wherein the target logic core is any one of a plurality of logic cores of the CPU;
detecting the process state change of the target application according to the identification of the target application;
when the detected state change result is a first state change result, unbinding the application process of the target application and the target logic core, wherein the first state change result is used for indicating a new sub-process corresponding to the application process of the target application;
and allocating a first logic core for the application process of the target application, and allocating a second logic core for a sub-process corresponding to the application process of the target application, wherein the first logic core and the second logic core are two different logic cores in the multiple logic cores of the CPU.
6. The terminal of claim 5, wherein the processor is specifically configured to:
determining the process state of the target application according to the identification of the target application at intervals of a preset time interval;
if the process state determined at the current moment is a first state and the process state determined last time before the current moment is a second state, determining that the state change result of the application process of the target application is a first state change result;
the first state indicates that the target application corresponds to multiple processes with the same process name, a process identifier of one process in the multiple processes is the same as a parent process identifier of the other process, the second state indicates that the target application corresponds to one application process, and the first state change result is used for indicating a child process corresponding to the application process to which the target application is added.
CN202010158816.2A 2020-03-09 2020-03-09 Application process and processor core binding method and terminal Active CN111400002B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010158816.2A CN111400002B (en) 2020-03-09 2020-03-09 Application process and processor core binding method and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010158816.2A CN111400002B (en) 2020-03-09 2020-03-09 Application process and processor core binding method and terminal

Publications (2)

Publication Number Publication Date
CN111400002A CN111400002A (en) 2020-07-10
CN111400002B true CN111400002B (en) 2022-09-27

Family

ID=71436090

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010158816.2A Active CN111400002B (en) 2020-03-09 2020-03-09 Application process and processor core binding method and terminal

Country Status (1)

Country Link
CN (1) CN111400002B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113868643B (en) * 2021-09-22 2023-11-03 苏州浪潮智能科技有限公司 Security detection method and device for running resources, electronic equipment and storage medium
CN116775234A (en) * 2022-03-11 2023-09-19 华为技术有限公司 Method and device for switching execution state of process
CN115220932A (en) * 2022-07-13 2022-10-21 小米汽车科技有限公司 Communication process execution method, device, vehicle, readable storage medium and chip

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7665133B2 (en) * 2004-06-12 2010-02-16 Toshbia Tec Kabushiki Kaisha System and method for monitoring processing in a document processing peripheral
CN104750543B (en) * 2013-12-26 2018-06-15 杭州华为数字技术有限公司 Thread creation method, service request processing method and relevant device
CN109947569B (en) * 2019-03-15 2021-04-06 Oppo广东移动通信有限公司 Method, device, terminal and storage medium for binding core
CN110008027B (en) * 2019-04-09 2021-08-20 Oppo广东移动通信有限公司 Process running method and device, terminal and storage medium
CN110825528B (en) * 2019-11-11 2022-02-01 聚好看科技股份有限公司 Resource management method, device and equipment

Also Published As

Publication number Publication date
CN111400002A (en) 2020-07-10

Similar Documents

Publication Publication Date Title
CN110308956B (en) Application interface display method and device and mobile terminal
CN110841285B (en) Interface element display method and device, computer equipment and storage medium
CN111400002B (en) Application process and processor core binding method and terminal
CN110362366B (en) Application interface display method and device
CN110659127A (en) Method, device and system for processing task
CN108132790B (en) Method, apparatus and computer storage medium for detecting a garbage code
CN108717365B (en) Method and device for executing function in application program
CN110288689B (en) Method and device for rendering electronic map
CN111897465B (en) Popup display method, device, equipment and storage medium
CN110673944B (en) Method and device for executing task
CN113127130A (en) Page jump method, device and storage medium
CN109828915B (en) Method, device, equipment and storage medium for debugging application program
CN112966130B (en) Multimedia resource display method, device, terminal and storage medium
CN107943484B (en) Method and device for executing business function
CN111813322A (en) Method, device and equipment for creating storage pool and storage medium
CN111427629B (en) Application starting method and device, vehicle equipment and storage medium
CN110086814B (en) Data acquisition method and device and storage medium
CN111914985B (en) Configuration method, device and storage medium of deep learning network model
CN113469360A (en) Inference method and device
CN112181915A (en) Method, device, terminal and storage medium for executing service
CN110119233B (en) Content pushing method and device, terminal and storage medium
CN113268234A (en) Page generation method, device, terminal and storage medium
CN111708581A (en) Application starting method, device, equipment and computer storage medium
CN112990421A (en) Method, device and storage medium for optimizing operation process of deep learning network
CN112260845A (en) Method and device for accelerating data transmission

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant