CN108958911B - Process control method and device - Google Patents

Process control method and device Download PDF

Info

Publication number
CN108958911B
CN108958911B CN201810543075.2A CN201810543075A CN108958911B CN 108958911 B CN108958911 B CN 108958911B CN 201810543075 A CN201810543075 A CN 201810543075A CN 108958911 B CN108958911 B CN 108958911B
Authority
CN
China
Prior art keywords
lock
memory
target process
mutual exclusion
application program
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
CN201810543075.2A
Other languages
Chinese (zh)
Other versions
CN108958911A (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.)
Beijing Xiaomi Mobile Software Co Ltd
Original Assignee
Beijing Xiaomi Mobile Software 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 Beijing Xiaomi Mobile Software Co Ltd filed Critical Beijing Xiaomi Mobile Software Co Ltd
Priority to CN201810543075.2A priority Critical patent/CN108958911B/en
Publication of CN108958911A publication Critical patent/CN108958911A/en
Application granted granted Critical
Publication of CN108958911B publication Critical patent/CN108958911B/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
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • 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/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • G06F9/526Mutual exclusion algorithms
    • G06F9/528Mutual exclusion algorithms by using speculative mechanisms

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 disclosure relates to a process control method and a process control device, which are used for improving the running speed of a foreground application program and solving the problem of jamming caused by the fact that the foreground application process cannot acquire a mutual exclusion lock quickly. The method comprises the following steps: acquiring a target process identifier of a target process corresponding to a foreground application program; and when the target process acquires the mutual exclusion lock, adjusting the target process to the head of the waiting queue of the mutual exclusion lock according to the target process identifier. The technical scheme can improve the running speed of the foreground application program and solve the problem of blockage caused by the fact that the foreground application process cannot acquire the mutual exclusion lock quickly.

Description

Process control method and device
Technical Field
The present disclosure relates to the field of communications technologies, and in particular, to a method and an apparatus for controlling a process.
Background
In the related art, in the multi-core and multi-task system, in order to prevent data damage caused by concurrent access of multiple processes to critical resources, an operating system uses a mutual exclusion lock to ensure that only one process accesses the critical resources at the same time. Among them, a resource that cannot be used by a plurality of threads at the same time is called a critical resource. The process needs to acquire the lock before accessing the critical resource, and when the lock is held by other processes, the current process is blocked until the lock holding process releases the lock. However, how to control the process to access the critical resource to avoid the foreground application from getting stuck is a technical problem to be solved.
Disclosure of Invention
In order to overcome the problems in the related art, embodiments of the present disclosure provide a process control method and apparatus, so as to increase the running speed of a foreground application.
According to a first aspect of an embodiment of the present disclosure, there is provided a process control method, including:
acquiring a target process identifier of a target process corresponding to a foreground application program;
and when the target process acquires the mutual exclusion lock, adjusting the target process to the head of the waiting queue of the mutual exclusion lock according to the target process identifier.
In one embodiment, before the adjusting the target process to the head of the waiting queue of the mutually exclusive lock according to the target process identification, the method may further include:
determining that the mutually exclusive lock is held by a process other than the target process.
In one embodiment, after determining that the mutually exclusive lock is held by a process other than the target process, the method may further include:
and if detecting that the lock holding process holding the mutual exclusion lock is preempted, increasing the priority of the lock holding process so as to shorten the time for holding the mutual exclusion lock by the lock holding process.
In one embodiment, after the increasing the priority of the lock holding process, the method may further include:
improving the running speed of the lock maintaining process;
and releasing the mutual exclusion lock after the lock maintaining process finishes accessing the critical resource.
In one embodiment, before the adjusting the target process to the head of the waiting queue of the mutually exclusive lock according to the target process identifier, the method further comprises:
acquiring a state identifier in the process information of the target process;
and determining that the foreground application program is in a waiting state according to the state identifier.
In an embodiment, after obtaining the target process identifier of the target process corresponding to the foreground application, the method may further include:
and allocating memory for the foreground application program from a memory pool.
In one embodiment, the method may further include:
and when the residual memory of the memory pool is lower than a preset threshold value, waking up a kernel thread, wherein the kernel thread is used for acquiring the memory from the system memory and filling the memory into the memory pool.
According to a second aspect of the embodiments of the present disclosure, there is provided a control apparatus of a process, including:
the first acquisition module is configured to acquire a target process identifier of a target process corresponding to a foreground application program;
and the first adjusting module is configured to adjust the target process to the head of the waiting queue of the mutual exclusion lock according to the target process identifier when the target process acquires the mutual exclusion lock.
In one embodiment, the apparatus further comprises:
a first determination module configured to determine that the mutually exclusive lock is held by a process other than the target process.
In one embodiment, the apparatus further comprises:
and the second adjusting module is configured to increase the priority of the lock holding process when detecting that the lock holding process holding the mutual exclusion lock is preempted, so that the time for holding the mutual exclusion lock by the lock holding process is shortened.
In one embodiment, the apparatus further comprises:
a third adjusting module configured to increase the running speed of the lock maintaining process;
and the releasing module is configured to release the mutual exclusion lock after the lock holding process finishes accessing the critical resource.
In one embodiment, the apparatus further comprises:
the second acquisition module is configured to acquire the state identifier in the process information of the target process;
a second determination module configured to determine that the foreground application is in a waiting state according to the state identifier.
In one embodiment, the apparatus may further include:
and the allocation module is configured to allocate the memory for the foreground application from a memory pool.
In one embodiment, the apparatus may further include:
and the awakening module is configured to awaken a kernel thread when the residual memory of the memory pool is lower than a preset threshold, wherein the kernel thread is used for acquiring the memory from the system memory and filling the memory into the memory pool.
According to a third aspect of the embodiments of the present disclosure, there is provided a control apparatus of a process, including:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform: the method of the first aspect.
According to a fourth aspect of embodiments of the present disclosure, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method of the first aspect described above.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects: and adjusting the target process corresponding to the foreground application program to the head of the waiting queue of the mutual exclusion lock when the target process acquires the mutual exclusion lock, so that the target process holds the mutual exclusion lock in a priority order after the mutual exclusion lock is released. Therefore, the waiting time for the foreground application to acquire the mutual exclusion lock can be reduced, the running speed of the foreground application can be increased, and the problem of jamming caused by the fact that the foreground application process cannot acquire the mutual exclusion lock quickly is solved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
Fig. 1 is a flow chart illustrating a method of controlling a process according to an exemplary embodiment.
Fig. 2 is an application scenario diagram illustrating a control method of a process according to an exemplary embodiment.
Fig. 3A to 3B are application scene diagrams illustrating a control method of a process according to another exemplary embodiment.
Fig. 4 is a flowchart illustrating a control method of a process according to another exemplary embodiment.
Fig. 5 is a block diagram of a control device of a process shown in accordance with an exemplary embodiment.
Fig. 6 is a block diagram of a control device of a process shown according to another exemplary embodiment.
Fig. 7 is a block diagram of a control apparatus of a process shown according to another exemplary embodiment.
Fig. 8 is a block diagram of a control apparatus of a process shown according to another exemplary embodiment.
Fig. 9 is a block diagram of a control apparatus of a process shown according to another exemplary embodiment.
FIG. 10 is a block diagram illustrating a control apparatus of a process according to an exemplary embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the invention, as detailed in the appended claims.
In the related art, in a multi-core multi-task system, in order to prevent data damage caused by concurrent access of multiple processes to critical resources, an operating system uses a mutual exclusion lock to ensure that only one process accesses the critical resources at the same time, the process needs to acquire the mutual exclusion lock before accessing the critical resources, and when the mutual exclusion lock is held by other processes, the current process is blocked until the lock holding process releases the lock.
The lock mechanism well protects critical resources and ensures the integrity of data, but also brings performance problems. The access to critical resources in the operating system of the handset is mutually exclusive and equal between processes. When a foreground application process accesses critical resources, the process queues up in a waiting queue of the mutual exclusion lock as other processes until the mutual exclusion lock is acquired. However, foreground applications are visible and operable to the user, and long-time blocking can cause applications to be stuck and affect user experience.
The embodiment of the disclosure provides a process control method and device, which are used for solving the technical problem and increasing the running speed of a foreground application program.
Fig. 1 is a flow chart illustrating a method of controlling a process according to an exemplary embodiment. The method can be applied to terminal equipment such as a smart phone, a tablet computer (PAD) and the like. As shown in fig. 1, the process control method includes the following steps S101 to S102:
in step S101, a target process identifier of a target process corresponding to a foreground application is obtained.
In one embodiment, the target process identifier of the target process corresponding to the foreground application may be obtained when one application is started or when one application is switched to the foreground application. Wherein, the application program is a foreground application program after being started. Foreground applications are applications that are visible and operable by a user.
In an exemplary embodiment, the terminal device may be a smartphone, and the operating system installed in the smartphone may be an Android (Android) operating system. When an Application program is started or an Application program is switched to a foreground Application program, a target process identifier of a target process corresponding to the foreground Application program can be acquired through an Application Framework layer, the acquired target process identifier is sent to a linux kernel, and the linux kernel stores the received target process identifier in a kernel file for subsequent use.
In one embodiment, a memory pool may be initialized at the start of the operating system, the memory pool being used by foreground applications. That is, embodiments of the present disclosure provide a memory pool that is dedicated for use by foreground applications while background applications still allocate memory from system memory.
In one embodiment, when the application program is started, the process identifier of the process corresponding to the application program may be obtained and stored in the linux kernel file. The process identification may be used to distinguish between foreground and background processes. The foreground process is a process corresponding to the foreground application, and the background process is a process corresponding to the background application. That is, when the linux kernel file stores a target process identifier, a target process corresponding to the target process identifier is a foreground process.
In one embodiment, after the application program is started, that is, after the application program is switched to the foreground application program, the memory can be allocated to the foreground application program from the memory pool. In an exemplary scenario, as shown in fig. 2, when the remaining memory of the memory pool 23 is lower than a preset threshold, a kernel thread may be woken up, and the kernel thread is used to obtain memory from the system memory 24 and fill the memory pool 23 with the memory, where the memory pool 23 is used by the foreground application 21, and the background application 22 still allocates memory from the system memory 24. Therefore, the foreground application program and the background application program are distinguished through the process identification, a quick memory allocation channel can be provided for the foreground application program, the time consumption of the foreground application program for allocating the memory is greatly reduced, and 99% of the memory can be allocated from the memory pool.
In step S102, when the target process acquires the mutual exclusion lock, the target process is adjusted to the head of the wait queue of the mutual exclusion lock according to the target process identifier.
In one embodiment, when a target process accesses a critical resource, a mutex lock needs to be acquired first. Critical resources are only accessed when the target process holds a mutual exclusion lock. When the target process acquires the mutual exclusion lock, the target process can be adjusted to the head of the waiting queue of the mutual exclusion lock according to the target process identifier, so that the target process holds the mutual exclusion lock in a priority order after the mutual exclusion lock is released. In one exemplary embodiment, the target process may be placed at the head of the wait queue for the mutually exclusive lock, such that once the mutually exclusive lock is released, the target process may hold the mutually exclusive lock in a first order and then access the critical resource.
In one embodiment, before step S102, a status flag in the process information of the target process may be obtained, and then it is determined whether the foreground application is in a waiting state according to the status flag. When the foreground application is in a waiting state, the target process waits to acquire the mutual exclusion lock, for example, the target process waits to acquire the mutual exclusion lock in a waiting queue of the mutual exclusion lock. In one embodiment, a preset field in the process information of the target process is used for storing a state identifier, and the state identifier is used for indicating the state of the target process to an operating system. And when the foreground application program is in a waiting state, determining that the target process waits in a waiting queue of the mutual exclusion lock to acquire the mutual exclusion lock so as to access the critical resource.
In one embodiment, when the target process acquires a mutual exclusion lock, it may be determined whether the mutual exclusion lock is held by a process other than the target process. When it is determined that the mutually exclusive lock is held by a process other than the target process, the target process is placed at the head of a wait queue for the mutually exclusive lock. Thus, when the lock holding process holding the mutual exclusion lock completes access to the critical resource and releases the mutual exclusion lock, the target process can hold the mutual exclusion lock in the first order and then access the critical resource.
In one embodiment, the target process is inserted at the head of the wait queue when the target process is not at the head of the wait queue. The target process is not repositioned when it is at the head of the wait queue. In an exemplary scenario, as shown in fig. 3A, if the head of the wait queue is process 31, the tail is target process 33, and the middle is process 32, the target process 33 is inserted into the head of the wait queue to obtain a new wait queue, see fig. 3B.
In an embodiment, when the target process acquires a mutual exclusion lock, if the mutual exclusion lock is held by a process other than the target process and it is detected that a lock holding process holding the mutual exclusion lock is preempted, the priority of the lock holding process may be increased, so that the time for the lock holding process to hold the mutual exclusion lock is shortened. Continuing with the exemplary embodiment described above, the case where the lock holding process is preempted includes: when the allocated time slice of the lock-holding process runs out, the operation is temporarily stopped, or the CPU temporarily stops executing the lock-holding process because a process having a higher priority than the lock-holding process is executed, and so on. When the lock holding process is preempted, the mutual exclusion lock is not released, and the mutual exclusion lock is released only when the lock holding process is continuously executed by the CPU and the critical resource is completely accessed. Therefore, in order to shorten the time for the lock holding process to hold the mutual exclusion lock, the priority of the lock holding process can be increased. After the priority of the lock holding process is improved, the lock holding process can preferentially obtain the CPU resource, or wait for more CPU resources, so that the running speed of the lock holding process is improved, the access to the critical resource is completed as soon as possible, and after the lock holding process completes the access to the critical resource, the mutual exclusion lock is released.
Continuing with the exemplary embodiment described above, the standard priority of the lock-holding process may be increased when the priority of the lock-holding process is increased. The standard priority may also be referred to as a normal priority, and the standard priority is lower than the real-time priority. When the priority of a process is real-time, the operating system will actively allocate more CPU frequency and more memory to run the process.
In this embodiment, when the target process acquires the mutex lock, the target process corresponding to the foreground application is adjusted to the head of the wait queue of the mutex lock, so that the target process holds the mutex lock in a priority order after the mutex lock is released. Therefore, the waiting time for the foreground application to acquire the mutual exclusion lock can be reduced, the running speed of the foreground application can be increased, and the problem of jamming caused by the fact that the foreground application process cannot acquire the mutual exclusion lock quickly is solved.
Fig. 4 is a flowchart illustrating a control method of a process according to another exemplary embodiment. In addition to the embodiment shown in fig. 1, after the above step S101, the following steps S401 to S404 are further included:
in step S401, it is determined that the mutually exclusive lock is held by a process other than the target process.
In step S402, if it is detected that a lock holding process holding the mutually exclusive lock is preempted, the priority of the lock holding process is increased.
In step S403, the running speed of the lock maintaining process is increased.
In step S404, after the lock maintaining process completes accessing the critical resource, the mutual exclusion lock is released.
In one embodiment, when the target process acquires a mutual exclusion lock, it may be determined whether the mutual exclusion lock is held by a process other than the target process. And when the mutual exclusion lock is determined to be held by the processes except the target process, detecting whether a lock holding process holding the mutual exclusion lock is preempted. And when the lock holding process holding the mutual exclusion lock is preempted, the priority of the lock holding process is improved, so that the time for holding the mutual exclusion lock by the lock holding process is shortened.
Continuing with the exemplary embodiment described above, the case where the lock holding process is preempted includes: when the allocated time slice of the lock-holding process runs out, the operation is temporarily stopped, or the CPU temporarily stops executing the lock-holding process because a process having a higher priority than the lock-holding process is executed, and so on. When the lock holding process is preempted, the mutual exclusion lock is not released, and the mutual exclusion lock is released only when the lock holding process is continuously executed by the CPU and the critical resource is completely accessed.
In one embodiment, to shorten the time that the lock holding process holds the mutex, the priority of the lock holding process may be increased. After the priority of the lock maintaining process is increased, the lock maintaining process can obtain the CPU resource preferentially, or wait for more CPU resources.
In one embodiment, as the priority of the lock maintaining process is increased, the running speed of the lock maintaining process is increased to complete the access to the critical resource as soon as possible, and the mutual exclusion lock is released after the lock maintaining process completes the access to the critical resource.
Continuing with the exemplary embodiment described above, the standard priority of the lock-holding process may be increased when the priority of the lock-holding process is increased. The standard priority may also be referred to as a normal priority, and the standard priority is lower than the real-time priority. When the priority of a process is real-time, the operating system will actively allocate more CPU frequency and more memory to run the process.
In this embodiment, by increasing the priority of the lock holding process, the running speed of the lock holding process can be increased, the lock holding time of the lock holding process can be shortened, the waiting time of the target process can be shortened, the running speed of the foreground application program can be increased, and the problem that the foreground application process is blocked because the mutually exclusive lock cannot be acquired quickly is solved.
Fig. 5 is a block diagram of a control device of a process shown in accordance with an exemplary embodiment. The control device of the process provided by the embodiment of the disclosure comprises:
a first obtaining module 51, configured to obtain a target process identifier of a target process corresponding to a foreground application;
a first adjusting module 52, configured to, when the target process acquires a mutex lock, adjust the target process to a head of a wait queue of the mutex lock according to the target process identifier.
Fig. 6 is a block diagram of a control device of a process shown according to another exemplary embodiment. In the embodiment of the present disclosure, the apparatus may further include:
a first determining module 53 configured to determine that the mutex lock is held by a process other than the target process.
Fig. 7 is a block diagram of a control apparatus of a process shown according to another exemplary embodiment. In the embodiment of the present disclosure, the apparatus may further include:
a second adjusting module 54, configured to, when detecting that the lock holding process holding the mutex lock is preempted, increase the priority of the lock holding process, so as to shorten the time for the lock holding process to hold the mutex lock.
Fig. 8 is a block diagram of a control apparatus of a process shown according to another exemplary embodiment. In the embodiment of the present disclosure, the apparatus may further include:
a third adjusting module 55 configured to increase the running speed of the lock maintaining process;
a releasing module 56 configured to release the mutually exclusive lock after the lock holding process completes accessing the critical resource.
Fig. 9 is a block diagram of a control apparatus of a process shown according to another exemplary embodiment. In the embodiment of the present disclosure, the apparatus may further include:
a second obtaining module 57, configured to obtain a status identifier in the process information of the target process;
a second determining module 58 configured to determine that the foreground application is in a waiting state according to the state identifier.
In one embodiment, the apparatus may further include:
and the allocation module is configured to allocate the memory for the foreground application from a memory pool.
In one embodiment, the apparatus may further include:
and the awakening module is configured to awaken a kernel thread when the residual memory of the memory pool is lower than a preset threshold, wherein the kernel thread is used for acquiring the memory from the system memory and filling the memory into the memory pool.
The specific manner in which the processor performs the operations with respect to the apparatus in the above-described embodiment has been described in detail in relation to the embodiment of the method, and will not be elaborated upon here.
FIG. 10 is a block diagram illustrating a control apparatus of a process according to an exemplary embodiment. For example, the apparatus 1000 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 10, the apparatus 1000 may include one or more of the following components: processing component 1002, memory 1004, power component 1006, multimedia component 1008, audio component 1010, input/output (I/O) interface 1012, sensor component 1014, and communications component 1016.
The processing component 1002 generally controls the overall operation of the device 1000, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing elements 1002 may include one or more processors 1020 to execute instructions to perform all or a portion of the steps of the methods described above. Further, processing component 1002 may include one or more modules that facilitate interaction between processing component 1002 and other components. For example, the processing component 1002 can include a multimedia module to facilitate interaction between the multimedia component 1008 and the processing component 1002.
The memory 1004 is configured to store various types of data to support operation at the device 1000. Examples of such data include instructions for any application or method operating on device 1000, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 1004 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
Power components 1006 provide power to the various components of device 1000. Power components 1006 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for device 1000.
The multimedia component 1008 includes a screen that provides an output interface between the device 1000 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 1008 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the device 1000 is in an operating mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 1010 is configured to output and/or input audio signals. For example, audio component 1010 includes a Microphone (MIC) configured to receive external audio signals when apparatus 1000 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal may further be stored in the memory 1004 or transmitted via the communication component 1016. In some embodiments, audio component 1010 also includes a speaker for outputting audio signals.
I/O interface 1012 provides an interface between processing component 1002 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 1014 includes one or more sensors for providing various aspects of status assessment for the device 1000. For example, sensor assembly 1014 may detect an open/closed state of device 1000, the relative positioning of components, such as a display and keypad of apparatus 1000, sensor assembly 1014 may also detect a change in position of apparatus 1000 or a component of apparatus 1000, the presence or absence of user contact with apparatus 1000, orientation or acceleration/deceleration of apparatus 1000, and a change in temperature of apparatus 1000. The sensor assembly 1014 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 1014 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 1014 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 1016 is configured to facilitate communications between the apparatus 1000 and other devices in a wired or wireless manner. The device 1000 may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 1016 receives a broadcast signal or broadcast associated information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communications component 1016 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the apparatus 1000 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer readable storage medium comprising instructions, such as the memory 1004 comprising instructions, executable by the processor 1020 of the device 1000 to perform the above-described method is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (14)

1. A method for controlling a process, the method comprising:
acquiring a target process identifier of a target process corresponding to a foreground application program; the foreground application program is an application program after being started and is an application program which can be seen and operated by a user;
when the target process acquires a mutual exclusion lock, adjusting the target process to the head of a waiting queue of the mutual exclusion lock according to the target process identifier;
after the obtaining of the target process identifier of the target process corresponding to the foreground application, the method further includes:
and allocating the memory for the foreground application program from a memory pool, wherein the background application program allocates the memory from the system memory.
2. The method of claim 1, wherein prior to said adjusting said target process to the head of said wait queue of said mutually exclusive lock according to said target process identification, further comprising:
determining that the mutually exclusive lock is held by a process other than the target process.
3. The method of claim 2, wherein after determining that the mutex is held by a process other than the target process, further comprising:
and if detecting that the lock holding process holding the mutual exclusion lock is preempted, increasing the priority of the lock holding process so as to shorten the time for holding the mutual exclusion lock by the lock holding process.
4. The method of claim 3, wherein after the increasing the priority of the lock-holding process, further comprising:
improving the running speed of the lock maintaining process;
and releasing the mutual exclusion lock after the lock maintaining process finishes accessing the critical resource.
5. The method of claim 1, wherein prior to said adjusting said target process to the head of said wait queue of said mutually exclusive lock according to said target process identification, further comprising:
acquiring a state identifier in the process information of the target process;
and determining that the foreground application program is in a waiting state according to the state identifier.
6. The method of claim 1, further comprising:
and when the residual memory of the memory pool is lower than a preset threshold value, waking up a kernel thread, wherein the kernel thread is used for acquiring the memory from the system memory and filling the memory into the memory pool.
7. An apparatus for controlling a process, the apparatus comprising:
the first acquisition module is configured to acquire a target process identifier of a target process corresponding to a foreground application program; the foreground application program is an application program after being started and is an application program which can be seen and operated by a user;
the first adjusting module is configured to adjust the target process to the head of a waiting queue of the mutual exclusion lock according to the target process identifier when the target process acquires the mutual exclusion lock;
the device, still include:
and the allocation module is configured to allocate the memory for the foreground application program from the memory pool, wherein the background application program allocates the memory from the system memory.
8. The apparatus of claim 7, further comprising:
a first determination module configured to determine that the mutually exclusive lock is held by a process other than the target process.
9. The apparatus of claim 8, further comprising:
and the second adjusting module is configured to increase the priority of the lock holding process when detecting that the lock holding process holding the mutual exclusion lock is preempted, so that the time for holding the mutual exclusion lock by the lock holding process is shortened.
10. The apparatus of claim 9, further comprising:
a third adjusting module configured to increase the running speed of the lock maintaining process;
and the releasing module is configured to release the mutual exclusion lock after the lock holding process finishes accessing the critical resource.
11. The apparatus of claim 7, further comprising:
the second acquisition module is configured to acquire the state identifier in the process information of the target process;
a second determination module configured to determine that the foreground application is in a waiting state according to the state identifier.
12. The apparatus of claim 7, further comprising:
and the awakening module is configured to awaken a kernel thread when the residual memory of the memory pool is lower than a preset threshold, wherein the kernel thread is used for acquiring the memory from the system memory and filling the memory into the memory pool.
13. An apparatus for controlling a process, the apparatus comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform the method of any of claims 1 to 6.
14. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method of any one of claims 1 to 6.
CN201810543075.2A 2018-05-30 2018-05-30 Process control method and device Active CN108958911B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810543075.2A CN108958911B (en) 2018-05-30 2018-05-30 Process control method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810543075.2A CN108958911B (en) 2018-05-30 2018-05-30 Process control method and device

Publications (2)

Publication Number Publication Date
CN108958911A CN108958911A (en) 2018-12-07
CN108958911B true CN108958911B (en) 2022-02-08

Family

ID=64492279

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810543075.2A Active CN108958911B (en) 2018-05-30 2018-05-30 Process control method and device

Country Status (1)

Country Link
CN (1) CN108958911B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110532197B (en) * 2019-08-30 2022-03-01 Oppo(重庆)智能科技有限公司 Memory recovery method and device, electronic equipment and storage medium
CN110543384B (en) * 2019-09-05 2022-05-17 Oppo广东移动通信有限公司 Memory write-back method, device, terminal and storage medium
CN112162845B (en) * 2020-10-30 2023-10-13 北京北信源软件股份有限公司 Method and device for synchronizing business processes

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1527206A (en) * 2003-03-03 2004-09-08 华为技术有限公司 Memory pool managing method
CN101055533A (en) * 2007-05-28 2007-10-17 中兴通讯股份有限公司 Multithreading processor dynamic EMS memory management system and method
US8429657B2 (en) * 2008-04-28 2013-04-23 Oracle International Corporation Global avoidance of hang states via priority inheritance in multi-node computing system
CN103473126A (en) * 2013-09-09 2013-12-25 北京思特奇信息技术股份有限公司 Multiple-level task processing method

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1276361C (en) * 2003-12-29 2006-09-20 北京中视联数字系统有限公司 A memory management method for embedded system
CN102819497B (en) * 2012-05-31 2015-09-30 华为技术有限公司 A kind of memory allocation method, Apparatus and system
US9274832B2 (en) * 2013-02-07 2016-03-01 Htc Corporation Method and electronic device for thread scheduling
US9348645B2 (en) * 2014-05-30 2016-05-24 Apple Inc. Method and apparatus for inter process priority donation

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1527206A (en) * 2003-03-03 2004-09-08 华为技术有限公司 Memory pool managing method
CN101055533A (en) * 2007-05-28 2007-10-17 中兴通讯股份有限公司 Multithreading processor dynamic EMS memory management system and method
US8429657B2 (en) * 2008-04-28 2013-04-23 Oracle International Corporation Global avoidance of hang states via priority inheritance in multi-node computing system
CN103473126A (en) * 2013-09-09 2013-12-25 北京思特奇信息技术股份有限公司 Multiple-level task processing method

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
A priority mutex with bounded waiting for interactive consumer electronics systems;Hojung Choi;《2018 IEEE International Conference on Consumer Electronics (ICCE)》;20180329;全文 *
刘德岩.基于Linux的嵌入式实时系统ERLinux.《中国优秀博硕士学位论文全文数据库(硕士)信息科技辑》.2005,第2005年卷(第3期), *
基于Linux的嵌入式实时系统ERLinux;刘德岩;《中国优秀博硕士学位论文全文数据库(硕士)信息科技辑》;20050715;第2005年卷(第3期);I138-123 *

Also Published As

Publication number Publication date
CN108958911A (en) 2018-12-07

Similar Documents

Publication Publication Date Title
CN105955765B (en) Application preloading method and device
US9588805B2 (en) Method and terminal device for controlling background application
EP3572936A1 (en) Method, terminal and computer-readable storage medium for displaying interface of application program
CN109254849B (en) Application program running method and device
US9886264B2 (en) Method and device for upgrading firmware
EP3188066A1 (en) A method and an apparatus for managing an application
CN107193653B (en) Bandwidth resource allocation method, device and storage medium
EP3015983B1 (en) Method and device for optimizing memory
CN107992257B (en) Screen splitting method and device
CN108958911B (en) Process control method and device
CN106033397B (en) Memory buffer area adjusting method, device and terminal
US11700578B2 (en) Downlink control signaling detection method and apparatus, and storage medium
CN113703937B (en) Animation switching method and device and storage medium
KR20170098059A (en) Electronic device and method for controlling operation thereof
CN115576645B (en) Virtual processor scheduling method and device, storage medium and electronic equipment
US9678868B2 (en) Method and device for optimizing memory
US20170293494A1 (en) Method and device for starting application interface
CN109062625B (en) Application program loading method and device and readable storage medium
CN110968523A (en) Memory defragmentation method and device
CN107371222B (en) Virtual card disabling method and device
CN105094500B (en) A kind of icon arrangement method and device
CN106535147B (en) Communication signal processing method and device
CN106502740B (en) Using installation method and device
EP3200075A1 (en) Method and device for calling process
US11269699B2 (en) Method and device for processing an application

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