CN110837290A - Management method of kernel lock and terminal equipment - Google Patents

Management method of kernel lock and terminal equipment Download PDF

Info

Publication number
CN110837290A
CN110837290A CN201910941306.XA CN201910941306A CN110837290A CN 110837290 A CN110837290 A CN 110837290A CN 201910941306 A CN201910941306 A CN 201910941306A CN 110837290 A CN110837290 A CN 110837290A
Authority
CN
China
Prior art keywords
kernel
lock
service
terminal device
state
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.)
Pending
Application number
CN201910941306.XA
Other languages
Chinese (zh)
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.)
Huawei Device Co Ltd
Original Assignee
Huawei Device 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 Huawei Device Co Ltd filed Critical Huawei Device Co Ltd
Priority to CN201910941306.XA priority Critical patent/CN110837290A/en
Publication of CN110837290A publication Critical patent/CN110837290A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/32Means for saving power
    • G06F1/3203Power management, i.e. event-based initiation of a power-saving mode
    • G06F1/3234Power saving characterised by the action undertaken
    • G06F1/329Power saving characterised by the action undertaken by task scheduling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • 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/4812Task transfer initiation or dispatching by interrupt, e.g. masked
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The application relates to the field of power consumption, and discloses a management method of a kernel lock and terminal equipment. The method comprises the following steps: after a service in the terminal equipment adds a kernel lock to a kernel, updating the locking and unlocking state of the service to the kernel in a lock resource management list in the kernel; the kernel lock is used for guaranteeing the continuous operation of the CPU; the terminal equipment monitors the locking and unlocking state in the lock resource list as the running state of the locked service; and after the operation state of the service is determined to be abnormal operation, releasing the kernel lock added by the service to the kernel, and updating the locking and unlocking state of the service in the lock resource management list to be unlocking. By the method, the terminal equipment can determine the current service of adding the kernel lock to the kernel through the lock management mechanism in the kernel so as to monitor the service, and when the service is determined to be abnormally operated, the kernel lock added to the kernel by the service is released, so that the power consumption of the terminal is saved.

Description

Management method of kernel lock and terminal equipment
Technical Field
The application relates to the technical field of terminal equipment, in particular to a management method of a kernel lock and terminal equipment.
Background
In the operation process of the terminal device, it is often necessary to ensure that a CPU in the terminal device can continuously operate when executing a related service, and therefore, a kernel (kernel) of an operating system of the terminal device may prevent the CPU from sleeping. The kernel typically employs a lock mechanism, such as a wake lock (Wakelock) mechanism, to prevent the CPU from sleeping. The Wakelock mechanism is a native mechanism of linux kernel, and all wakelocks are finally embodied in linux kernel. The Wakelock mechanism is described below by taking an Android operating system as an example.
In the Android system, the wakelock lock of the terminal device is subdivided into: the kernel driving lock, the native process lock and the Android upper-layer lock. The kernel driven lock and the native process lock can add a lock mark at a wakelock management node of the kernel by using a separate name, and are called as lock holding, and because the lock is directly added at the wakelock node of the kernel, the lock is called as a kernel lock.
In the prior art, when no related service is executed in the terminal device or the related service is abnormal, for example, when a service related to a kernel driving lock and a native process lock is abnormal, the condition that the kernel is locked by the service and the kernel still exists, and the terminal device cannot determine which abnormally operated application services still lock the kernel due to problems such as logic defects, so that the kernel lock to be released cannot be determined, which causes that the kernel in the terminal device is always in a state of being locked by multiple application services and the kernel, and the whole system cannot be in a sleep state, thereby generating huge power consumption.
Disclosure of Invention
In view of this, the present application provides a method and an apparatus for managing a kernel lock, so as to reduce the overhead of system power consumption of a terminal device, thereby saving the power consumption of the terminal device.
In a first aspect, an embodiment of the present application provides a method for managing a kernel lock, where the method may be applied to an electronic device such as a mobile phone and a tablet computer. The method comprises the following steps: after a service in the terminal equipment adds a kernel lock to a kernel, updating the locking and unlocking state of the service to the kernel in a lock resource management list in the kernel; the kernel lock is used for guaranteeing the continuous operation of the CPU; the terminal equipment monitors the locking and unlocking state in the lock resource list as the running state of the locked service; and after the terminal equipment determines that the operation state of the service is abnormal operation, releasing the kernel lock added by the service to the kernel, and updating the locking and unlocking state of the service in the lock resource management list to be unlocking.
In the embodiment of the application, the terminal device may determine, through a lock management mechanism in the kernel, a current service of adding the kernel lock to the kernel, so as to monitor the service, and when it is determined that the service is abnormally operated, release the kernel lock added to the kernel by the service, thereby saving power consumption of the terminal.
In one possible design, the determining, by the terminal device, that the operation state of the service is abnormal operation includes: the terminal equipment determines that the time length of the service for adding the kernel lock to the kernel reaches the threshold time length; or the terminal equipment determines that the service is in an idle state; or the service is in an execution failure state.
In a possible design, after the terminal device determines that the operation state of the service is abnormal operation, releasing a kernel lock applied by the service to the kernel includes: the terminal equipment determines a kernel lock identifier of a kernel lock added by the service to the kernel according to the corresponding relation between the service identifier and the kernel lock identifier in the lock resource list; and the terminal equipment releases the kernel lock corresponding to the kernel lock identification.
In a second aspect, an embodiment of the present application further provides an electronic device. The electronic device includes at least one processor and memory; the memory for storing one or more computer programs; the one or more computer programs stored in the memory, when executed by the at least one processor, enable the electronic device to implement the aspects of the first aspect and any possible design thereof.
In a third aspect, an embodiment of the present application further provides an electronic device, where the electronic device includes a module/unit that performs the method of the first aspect or any one of the possible designs of the first aspect; these modules/units may be implemented by hardware, or by hardware executing corresponding software.
In a fourth aspect, an embodiment of the present application further provides a chip, where the chip is coupled to a memory in an electronic device, and is configured to call a computer program stored in the memory and execute the technical solution of the first aspect of the embodiment of the present application and any one of possible designs of the first aspect of the embodiment of the present application; "coupled" in the context of this application means that two elements are joined to each other either directly or indirectly.
In a fifth aspect, an embodiment of the present application further provides a computer-readable storage medium, where the computer-readable storage medium includes a computer program, and when the computer program runs on an electronic device, the electronic device is enabled to execute a technical solution of any one of the first aspect of the embodiment of the present application and the first aspect of the present application.
In a sixth aspect, a program product in the embodiments of the present application includes instructions, and when the program product runs on an electronic device, the electronic device is caused to execute the technical solution of the first aspect and any possible design of the first aspect of the embodiments of the present application.
Drawings
Fig. 1 is a schematic structural diagram of a terminal device according to an embodiment of the present application;
fig. 2 is a block diagram of a software structure of a terminal device according to an embodiment of the present disclosure;
FIG. 3 is a schematic diagram illustrating a timing diagram for implementing the service monitoring module, the lock holding decision module, the lock holding monitoring module, and the kernel according to the embodiment of the present application;
fig. 4 is a schematic diagram illustrating a kernel lock management method according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an apparatus for managing a kernel lock according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of another apparatus for managing a kernel lock according to an embodiment of the present application.
Detailed Description
The following detailed description of embodiments of the application will be made in conjunction with the accompanying drawings.
Currently, terminal equipment often needs to ensure that a CPU in the terminal equipment can continuously work when executing related services in the running process, so that a kernel of an operating system of the terminal equipment can prevent the CPU from sleeping.
The kernel typically employs a lock mechanism, such as the Wakelock mechanism, to prevent the CPU from sleeping. The Wakelock mechanism is a native mechanism of linux kernel, and all wakelocks are finally embodied in linux kernel. The Wakelock mechanism is described below by taking an Android operating system as an example.
In the Android system, the wakelock lock of the terminal device is subdivided into: the kernel driving lock, the native process lock and the Android upper-layer lock. The kernel driven lock and the native process lock can add a lock mark at a wakelock management node of the kernel by using a separate name, and are called as lock holding, and because the lock is directly added at the wakelock node of the kernel, the lock is called as a kernel lock.
In the prior art, when the terminal device does not execute the related service or the related service is abnormal, for example, when the service related to the kernel driving lock and the native process lock is abnormal, the condition that the kernel is locked by the application service of the upper layer and the kernel still exists, and the current terminal device cannot determine which abnormally operated application service still locks the kernel due to problems such as logic defects, so that the kernel lock to be released cannot be determined, the kernel in the terminal device is always in a state of being locked by multiple application services and the kernel, and the whole system cannot be in a sleep state, thereby generating huge power consumption.
In order to solve the problem, an embodiment of the present application provides a method for managing a kernel lock, where the method mainly sets a one-to-one correspondence relationship between a service identifier and a kernel lock identifier in a lock management mechanism of a kernel. By the method, the terminal equipment can determine the current service of adding the kernel lock to the kernel through the lock management mechanism in the kernel so as to monitor the service, and can determine the kernel lock to be released when the service is determined to be abnormally operated, thereby saving the power consumption of the terminal.
Some terms related to the embodiments of the present application are explained below.
(1) The terminal equipment: the device may be a device that installs various types of applications and can display an object provided in the installed application. Illustratively, the terminal device may comprise means (such as a processor or image processor or other processor) capable of performing data processing functions, and means (such as a display screen) capable of displaying a user interface. The terminal device may be mobile or stationary. For example, the terminal device may be a smart phone, a tablet computer, various wearable devices, an in-vehicle device, a Personal Digital Assistant (PDA), or other terminal devices capable of implementing the above functions. The terminal device may also drive hardware of the terminal device through a driver of the operating system, for example, a display driver, a sensor driver, a bluetooth driver, a WIFI driver, and the like.
(2) Operating System (OS): the system software is the most basic system software running on the electronic equipment, such as a windows system, an Android system and an IOS system. Taking a smart phone as an example, the operating system may be an Android system or an IOS system. The embodiment of the application is mainly introduced by taking an Android system as an example. Those skilled in the art will appreciate that similar algorithm implementations may be used in other operating systems.
(3) Kernel: the system is the core of an operating system, is a first-layer software extension based on hardware, provides the most basic functions of the operating system, is the basis of the operation of the operating system, and is responsible for managing the process, the memory, the driver, the file and the network system of the system and determining the performance and the stability of the system.
In addition, the term "at least one" in the embodiments of the present application means one or more, and "a plurality" means two or more. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone, wherein, A and B can be singular or plural. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. At least one of the following items or the like, refers to any combination of these items, including any combination of single item(s) or plural items. For example, at least one (one) of a, b, or c, may represent: a, b, c, a-b, a-c, b-c, or a-b-c, wherein a, b, c may be single or multiple.
Furthermore, the terms "comprising" and "having" in the description of the embodiments and claims of the present application and the drawings are not intended to be exclusive. For example, a process, method, system, article, or apparatus that comprises a list of steps or modules is not limited to only those steps or modules listed, but may include other steps or modules not listed.
To solve the problem, an embodiment of the present application provides a method for managing a kernel lock, where the embodiment of the present application provides a schematic structural diagram of a terminal device, as shown in fig. 1, which is introduced by taking the terminal device as a mobile phone as an example.
The terminal device 100 includes: the USB interface 110, the charging management module 120, the power management module 121, the battery 122, the processor 130, the memory 140, the input unit 150, the display unit 160, the camera 170, the bluetooth module 180, and the Wireless Fidelity (WiFi) module 190. And the like. Those skilled in the art will appreciate that the structure of the terminal device shown in fig. 1 does not constitute a limitation of the terminal device, and the terminal device provided in the embodiments of the present application may include more or less components than those shown, or may combine some components, or may be arranged in different components.
The following describes each component of the terminal device 100 in detail with reference to fig. 1:
the USB interface 110 is an interface conforming to the USB standard specification, and may specifically be a Mini USB interface, a microsub interface, a USB Type C interface, or the like. The USB interface 110 may be used to connect a charger to charge the terminal device 100, and may also be used to transmit data between the terminal device 100 and a peripheral device. And the earphone can also be used for connecting an earphone and playing audio through the earphone.
The charging management module 120 is configured to receive a charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 120 may receive charging input from a wired charger via the USB interface 110. In some wireless charging embodiments, the charging management module 120 may receive a wireless charging input through a wireless charging coil of the terminal device 100. The charging management module 120 may also supply power to the terminal device 100 through the power management module 121 while charging the battery 122.
The power management module 121 is used to connect the battery 122, the charging management module 120 and the processor 130. The power management module 121 receives input from the battery 122 and/or the charge management module 120, and provides power to the processor 130, the memory 140, the camera 170, and the like. The power management module 121 may also be used to monitor parameters such as battery capacity, battery cycle count, battery state of health (leakage, impedance), etc. In some other embodiments, the power management module 121 may also be disposed in the processor 130. In other embodiments, the power management module 121 and the charging management module 120 may be disposed in the same device.
The memory 140 may be used to store software programs and modules. The memory 140 in the embodiment of the present application mainly includes a program storage area and a data storage area. The storage program area can store an operating system, various application programs, a driver program and the like; the storage data area may store data (such as various multimedia files like pictures, video files, etc.) created according to the use of the terminal, etc. Further, the memory 140 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The processor 130 executes various functional applications and data processing of the terminal 100 by executing the software programs and modules stored in the memory 140, and may implement part or all of the processes in the embodiments of the present invention when the processor 130 executes the program codes in the memory 140.
Specifically, in this embodiment of the present application, the processor 130 caches a correspondence between a service in the lock resource management mechanism in the terminal device and a kernel lock, and a locking/unlocking state of the kernel by the service. The processor 130 is further configured to maintain a correspondence between a service cached inside the processor 130 and a kernel lock, and maintain a locking/unlocking state of the kernel by the service. Further, after the service is started and operated, the processor 130 locks the kernel, and updates the locked/unlocked state of the service cached in the processor 130 to the kernel to be a locked state. The processor 130 is further configured to obtain a correspondence between a service cached in the processor 130 and a kernel lock, monitor an operation state of the service for locking the kernel, release the corresponding kernel lock in the kernel after determining that the service for locking the kernel normally operates, and update a locking/unlocking state of the kernel by the service in the lock resource management mechanism in the kernel.
Optionally, the processor 130 may include one or more processing units. Optionally, the processor 130 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, an application program, and the like, and the modem processor mainly processes wireless communication. It will be appreciated that the modem processor described above may not be integrated into the processor 130.
The input unit 150 may be used to receive numeric or character information input by a user and to generate key signal inputs related to user settings and function control of the terminal 100. The processor 130 is a control center of the terminal 100, connects various components using various interfaces and lines, performs various functions of the terminal 100 and processes data by operating or executing software programs and/or modules stored in the memory 140 and calling data stored in the memory 140, thereby implementing various services based on the terminal.
The display unit 160 may be used to display information input by a user or information provided to the user and various menus of the terminal 100. The display unit 160 is a display system of the terminal 100, and is used for presenting an interface to implement human-computer interaction.
The camera 170 is configured to implement a shooting function of the terminal 100, and shoot pictures or videos.
The bluetooth module 180 is configured to enable the terminal device 100 to perform data transmission through the bluetooth module 180.
The WiFi module 190 belongs to a short-distance wireless transmission technology, and the terminal 100 realizes Access to a data network through an Access Point (AP) to which the WiFi module 190 can be connected. The WiFi module 190 may be used for receiving and transmitting data during communication.
Although not shown, the terminal device 100 may further include at least one sensor, an audio circuit, and the like, which are not described in detail herein.
Based on the hardware structure of the terminal device shown in fig. 1, the embodiment of the present application further provides a software structure of the terminal device. The following describes a software structure of the terminal device provided by the embodiment of the present application, taking an Android operating system as an example.
Fig. 2 shows a block diagram of a software structure of a terminal device according to an embodiment of the present application. As shown in fig. 2, the software structure of the terminal device adopts a layered architecture. The layered architecture divides the software into several layers, each layer having a clear role and division of labor. The layers communicate with each other through a software interface. In some embodiments, the Android system is divided into three layers, which are an application framework layer, a system running layer, and a kernel layer from top to bottom.
The application framework layer comprises a service monitoring module. And the service monitoring module is used for monitoring the operation state of the service in the terminal equipment and informing the system operation layer of the monitoring result. For example, it is assumed that the services in the terminal device mainly include bluetooth service, GPS service, and WIFI service. If the service monitoring module in the application framework layer monitors that the Bluetooth service, the GPS service and the WIFI service in the terminal equipment are in an abnormal operation state, a normal operation state and a normal operation state, the service monitoring module informs the system operation layer of the monitoring results of the Bluetooth service, the GPS service and the WIFI service.
The system operation layer comprises a lock holding decision module and a lock holding monitoring module.
The lock-holding decision module is used for receiving a service running state sent by the service monitoring module in the application program framework layer and receiving a condition that the kernel adds a kernel lock sent by the lock-holding monitoring module. And the lock holding decision module performs core lock protection processing according to the received condition of adding the core lock to the core and the operation state of the service after determining that the service of adding the core lock to the core is in an abnormal operation state. That is, after determining that the service for adding the kernel lock to the kernel is in an abnormal operation state, sending a decision instruction for releasing the kernel lock added to the kernel by the service to the kernel layer.
The lock holding monitoring module is used for acquiring the condition that the kernel in the kernel layer adds the kernel lock, and informing the lock holding decision module of the condition that the kernel adds the kernel lock.
The kernel layer is mainly used for managing kernel locks, recording states of all services in the terminal equipment for adding and removing the kernel locks to and corresponding relations between kernel lock identifiers and service identifiers for managing the kernel locks in the terminal equipment, and executing kernel lock abnormity protection actions according to decision instructions sent by the lock holding decision module, namely, when the kernel layer receives the decision instructions sent by the lock holding decision module for releasing the kernel locks added to the kernels by a certain service, the kernel locks added to the kernels by the service are released, and the states of the services for adding and removing the kernel locks to the kernels are updated.
Further, based on the software structure shown in fig. 2 in the embodiment of the present application, the embodiment of the present application further provides a kernel lock management method, and the flow of the method is described below with reference to fig. 3.
S300: and the service monitoring module monitors the operation state of the service in the terminal equipment.
Optionally, in this embodiment of the present application, the service monitoring module may determine a service that needs to be monitored by obtaining service information of a lock that adds a kernel to the kernel in the kernel. Namely, the monitoring module only needs to monitor the running state of the service of adding the kernel lock to the kernel;
s301: and the service monitoring module informs the lock-holding decision module of the monitoring result.
S302: and the lock-holding decision module receives the operation state of the service sent by the service monitoring module.
S303: and the lock holding monitoring module acquires the condition that the kernel lock is added to the kernel in the kernel.
S304: and the lock holding monitoring module informs the lock holding decision module of the condition that the kernel adds the kernel lock.
S305: and the lock-holding decision module receives the condition that the kernel adds the kernel lock sent by the lock-holding monitoring module.
S306: and the lock holding decision module determines whether a kernel lock needing to be released exists according to the received service running state and the condition that the kernel adds the kernel lock.
S307: and the lock holding decision module sends a decision instruction to the kernel layer after determining that the kernel lock needing to be released exists.
Wherein: the decision instruction comprises kernel lock information to be released, and the information comprises a service identifier corresponding to the kernel lock or an identifier corresponding to the kernel lock.
S308: and the kernel layer receives the decision instruction and releases the kernel lock corresponding to the kernel according to the decision.
It should be noted that, in the embodiment of the present application, the steps S300 to S302 and the steps S303 to S305 may be performed simultaneously, and the order of execution is not limited herein.
As shown in fig. 4, the management method of a kernel lock provided in the embodiment of the present application specifically includes:
s400, after a service in the terminal equipment adds a kernel lock to a kernel, updating the locking and unlocking state of the service to the kernel in a lock resource management list in the kernel; the kernel lock is used for guaranteeing the continuous operation of the CPU;
s401, the terminal device monitors the locking and unlocking state in the lock resource list as the running state of the locked service; .
S402, after the terminal device determines that the operation state of the service is abnormal operation, the terminal device releases the kernel lock added by the service to the kernel, and updates the locking and unlocking state of the service in the lock resource management list to be unlocking. By the method, the terminal equipment can determine the current service of adding the kernel lock to the kernel through the lock management mechanism in the kernel so as to monitor the service, and can determine the kernel lock to be released when the service is determined to be abnormally operated, thereby saving the power consumption of the terminal.
Illustratively, in the embodiment of the present application, a lock resource management mechanism exists in a kernel of the terminal device, and is configured to manage a state of a service in the terminal device that adds or subtracts a kernel lock to the kernel and a correspondence between the service and the kernel lock. It is assumed that the services in the embodiment of the present application include a WIFI service, a bluetooth service, a GPS driving service, and the like, where a correspondence between a service identifier and a kernel lock identifier of a kernel lock is shown in table 1.
Business Service identification Kernel lock identification
WIFI service Service 1 WIFI_wake lock
Bluetooth service Service 2 BT_wake lock
GPS service Service 3 GPS_wake lock
TABLE 1 correspondence between service identification and Kernel Lock identification of Kernel Lock
Further, in the lock resource management mechanism in this embodiment of the present application, the lock resource management mechanism is further configured to manage a lock/unlock state of the kernel by the service, for example, it is assumed that the lock/unlock state of the kernel by the current terminal service is shown in table 2, where it can be seen from table 2 that the kernel is currently in a lock state by the WIFI service and the kernel lock identifier of the kernel lock added to the kernel by the WIFI service is WIFI _ wake lock; the kernel is also in a state of being locked by the GPS service and the kernel lock, and the kernel lock identifier of the kernel lock added to the kernel by the GPS service is GPS _ wakelock.
Business Kernel lock identification Locked and unlocked state
WIFI service WIFI_wake lock Lock with inner core
Bluetooth service BT_wake lock Lock with inner core
GPS service GPS_wake lock Lock without inner core
TABLE 2 service Lock-unlock State to Kernel (1)
It should be noted that, in the embodiment of the present application, the correspondence between the service identifier and the kernel lock identifier and the correspondence between the service and the kernel lock/unlock state are not limited to the manners in table 1 and table 2, and any manner that can implement the method in the embodiment of the present application may be applied to the embodiment of the present application.
Further, in this embodiment, after determining that a kernel lock is added to a kernel by a service, the terminal device monitors an operating state of the service. For example, as can be seen from table 2, if the current service of adding the kernel lock to the kernel is a WIFI service and a bluetooth service, the terminal device monitors the operating states of the WIFI service and the bluetooth service. If the terminal device monitors abnormal operation of the bluetooth service, and the terminal device determines that the bluetooth service still adds the kernel lock to the kernel according to the service locking and unlocking state in the lock resource management mechanism, the terminal device releases the BT _ wake lock kernel lock added to the kernel by the bluetooth service. After the terminal device releases the kernel lock added to the kernel by the bluetooth device, in order to ensure the accuracy of the information in the lock resource management list, the locked/unlocked state of the bluetooth service in the lock resource list is updated to an unlocked state, for example, as shown in table 3.
Business Kernel lock identification Locked and unlocked state
WIFI service WIFI_wake lock Lock with inner core
Bluetooth service BT_wake lock Lock without inner core
GPS service GPS_wake lock Lock without inner core
TABLE 3 service Lock-unlock State to Kernel (1)
In this embodiment of the present application, when monitoring whether a service for adding a kernel lock to the kernel is in an abnormal operation state, the terminal device may determine in multiple ways, which is not limited to the following.
Determination method 1: and the time length of adding the kernel lock to the kernel by the service reaches the threshold time length.
In the embodiment of the present application, a threshold duration may be set to limit the time for the service to add the kernel lock to the kernel. That is, after the duration of adding the kernel lock to the kernel by the service exceeds the set threshold duration, it may be determined that the service satisfies the abnormal execution condition.
For example, in this embodiment of the present application, it is assumed that a threshold duration is 30 minutes, where after the bluetooth service adds a kernel lock to the kernel, the terminal device monitors an operation state of the bluetooth service, and after it is determined that a duration for the bluetooth service to add the kernel lock to the kernel reaches the threshold duration for 30 minutes, it is default that the bluetooth service is in an abnormal operation state, the kernel lock added to the kernel by the bluetooth device is released, and the lock resource management module in the kernel is updated.
Optionally, in this embodiment of the present application, a timer may be set, so as to monitor a duration that a kernel lock is added to a kernel by a service.
Determination mode 2: and the service of adding the kernel lock to the kernel in the terminal equipment is in an idle state.
In this embodiment, the service being in the idle state mainly refers to a process in which the service is not currently running, for example, if it is determined that no data is currently transmitted or the data is completely transmitted in the bluetooth service when the embodiment monitors the bluetooth service in which the kernel lock is added to the kernel, the terminal device may determine that the bluetooth service is in the idle state, that is, the terminal device satisfies an abnormal running state. And the terminal equipment releases the kernel lock added to the kernel by the Bluetooth equipment and updates the lock resource management module in the kernel lock. Determination mode 3: and the service of adding the kernel lock to the kernel in the terminal equipment is in a fault execution state.
For example, assuming that the bluetooth service in the terminal device adds a kernel lock to the kernel, when monitoring the bluetooth service, if it is found that the bluetooth service is interrupted during data transmission or an error alarm occurs and data transmission cannot be continued, the terminal device defaults that the bluetooth service is in an abnormal execution state. And the terminal equipment releases the kernel lock added to the kernel by the Bluetooth equipment and updates the lock resource management module in the kernel lock.
As shown in fig. 5, the present application relates to an apparatus for information synchronization, which includes a processor 500, a memory 501, and a transceiver 502;
the processor 500 is responsible for managing the bus architecture and general processing, and the memory 501 may store data used by the processor 500 in performing operations. The transceiver 502 is used to receive and transmit data under the control of the processor 500.
The bus architecture may include any number of interconnected buses and bridges, with one or more processors represented by processor 500 and various circuits of memory represented by memory 501 being linked together. The bus architecture may also link together various other circuits such as peripherals, voltage regulators, power management circuits, and the like, which are well known in the art, and therefore, will not be described any further herein. The bus interface provides an interface. The processor 500 is responsible for managing the bus architecture and general processing, and the memory 501 may store data used by the processor 500 in performing operations.
The processes disclosed in the embodiments of the present invention may be applied to the processor 500, or implemented by the processor 500. In implementation, the steps of the signal processing flow may be implemented by integrated logic circuits of hardware or instructions in the form of software in the processor 500. The processor 500 may be a general purpose processor, a digital signal processor, an application specific integrated circuit, a field programmable gate array or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination thereof that may implement or perform the methods, steps, and logic blocks disclosed in embodiments of the present invention. A general purpose processor may be a microprocessor or any conventional processor or the like. The steps of a method disclosed in connection with the embodiments of the present invention may be directly implemented by a hardware processor, or may be implemented by a combination of hardware and software modules in the processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in the memory 501, and the processor 500 reads the information in the memory 501, and completes the steps of the signal processing flow in combination with the hardware thereof.
Specifically, the processor 500 is configured to read the program in the memory 501 and execute:
after a kernel lock of a service on a kernel is determined, updating the locking and unlocking state of the service on the kernel in a lock resource management list in the kernel; the kernel lock is used for guaranteeing the continuous operation of the CPU; monitoring the locking and unlocking state in the lock resource list as the running state of the locked service; and after the operation state of the service is determined to be abnormal operation, releasing the kernel lock added by the service to the kernel, and updating the locking and unlocking state of the service in the lock resource management list to be unlocking.
In a possible implementation method, the processor 500 is specifically configured to:
determining that the time length of the service for adding the kernel lock to the kernel reaches a threshold time length; or determining that the service is in an idle state; or the service is in an execution failure state.
In a possible implementation method, the processor 500 is specifically configured to:
determining a kernel lock identifier of a kernel lock added by the service to the kernel according to the corresponding relation between the service identifier and the kernel lock identifier in the lock resource list; and releasing the kernel lock corresponding to the kernel lock identification.
As shown in fig. 6, the present invention provides a kernel lock management apparatus, including:
the update module 600: the system comprises a kernel lock module, a kernel unlocking module and a kernel locking module, wherein the kernel lock module is used for updating the locking and unlocking state of a service to a kernel in a lock resource management list in the kernel after determining that the service locks the kernel;
the monitoring module 601: the system is used for monitoring the locking and unlocking state in the lock resource list as the running state of the locked service;
the processing module 602: and the system is used for releasing the kernel lock added by the service to the kernel after the operation state of the service is determined to be abnormal operation, and updating the locking and unlocking state of the service in the lock resource management list to be unlocking.
In a possible implementation method, the processing module 602 is specifically configured to:
determining that the time length of the service for adding the kernel lock to the kernel reaches a threshold time length; or determining that the service is in an idle state; or the terminal equipment determines that the service is in the execution failure state.
In a possible implementation method, the processing module 602 is specifically configured to:
determining a kernel lock identifier of a kernel lock added by the service to the kernel according to the corresponding relation between the service identifier and the kernel lock identifier in the lock resource list; and releasing the kernel lock corresponding to the kernel lock identification.
In some possible implementations, the various aspects of the method for management of a kernel lock provided by the embodiments of the present invention may also be implemented in the form of a program product including program code for causing a computer device to perform the steps in the method for management of a kernel lock according to various exemplary implementations of the present invention described in this specification when the program code runs on the computer device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
A program product for kernel lock management according to an embodiment of the present invention may employ a portable compact disc read only memory (CD-ROM) and include program code, and may be run on a server device. However, the program product of the present invention is not limited thereto, and in this document, the readable storage medium may be any tangible medium containing or storing the program, which can be used by or in connection with an information transmission, apparatus, or device.
A readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium that can transmit, propagate, or transport the program for use by or in connection with the periodic network action system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device.
The method for managing the kernel lock in the embodiment of the application further provides a storage medium readable by the computing device, namely, the content is not lost after the power is off. The storage medium stores therein a software program comprising program code which, when executed on a computing device, when read and executed by one or more processors, implements any of the above aspects of kernel lock management of embodiments of the present application.
The present application is described above with reference to block diagrams and/or flowchart illustrations of methods, apparatus (systems) and/or computer program products according to embodiments of the application. It will be understood that one block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, and/or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer and/or other programmable data processing apparatus, create means for implementing the functions/acts specified in the block diagrams and/or flowchart block or blocks.
Accordingly, the subject application may also be embodied in hardware and/or in software (including firmware, resident software, micro-code, etc.). Furthermore, the present application may take the form of a computer program product on a computer-usable or computer-readable storage medium having computer-usable or computer-readable program code embodied in the medium for use by or in connection with an instruction execution system. In the context of this application, a computer-usable or computer-readable medium may be any medium that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device.
Although the present application has been described in conjunction with specific features and embodiments thereof, it will be evident that various modifications and combinations can be made thereto without departing from the spirit and scope of the application. Accordingly, the specification and figures are merely exemplary of the present application as defined in the appended claims and are intended to cover any and all modifications, variations, combinations, or equivalents within the scope of the present application. It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include such modifications and variations.

Claims (10)

1. A method for managing a kernel lock, the method comprising:
after a service in the terminal equipment adds a kernel lock to a kernel, updating the locking and unlocking state of the service to the kernel in a lock resource management list in the kernel; the kernel lock is used for guaranteeing the continuous operation of the CPU;
the terminal equipment monitors the locking and unlocking state in the lock resource list as the running state of the locked service;
and after the terminal equipment determines that the operation state of the service is abnormal operation, releasing the kernel lock added by the service to the kernel, and updating the locking and unlocking state of the service in the lock resource management list to be unlocking.
2. The method according to claim 1, wherein the determining, by the terminal device, that the operation state of the service is abnormal operation includes:
the terminal equipment determines that the time length of the service for adding the kernel lock to the kernel reaches the threshold time length; or
The terminal equipment determines that the service is in an idle state; or
And the terminal equipment determines that the service is in a fault execution state.
3. The method according to claim 1 or 2, wherein the releasing the kernel lock applied by the service to the kernel after the terminal device determines that the operation state of the service is abnormal operation comprises:
the terminal equipment determines a kernel lock identifier of a kernel lock added by the service to the kernel according to the corresponding relation between the service identifier and the kernel lock identifier in the lock resource list;
and the terminal equipment releases the kernel lock corresponding to the kernel lock identification.
4. A terminal device, comprising: a processing unit and a communication unit;
the processing unit is used for updating the locking and unlocking states of the kernel by the service in the kernel lock resource management list after the kernel is locked by the service; the kernel lock is used for guaranteeing the continuous operation of the CPU; monitoring the locking and unlocking state in the lock resource list as the running state of the locked service; and after the operation state of the service is determined to be abnormal operation, releasing the kernel lock added by the service to the kernel, and updating the locking and unlocking state of the service in the lock resource management list to be unlocking.
5. The terminal device of claim 4, wherein the processing unit is specifically configured to:
determining that the time length of the service for adding the kernel lock to the kernel reaches a threshold time length; or determining that the service is in an idle state; or the terminal equipment determines that the service is in the execution failure state.
6. The terminal device according to claim 4 or 5, wherein the processing unit is specifically configured to:
determining a kernel lock identifier of a kernel lock added by the service to the kernel according to the corresponding relation between the service identifier and the kernel lock identifier in the lock resource list; and releasing the kernel lock corresponding to the kernel lock identification.
7. A terminal device, comprising: one or more processors; a memory; one or more programs; wherein the one or more programs are stored in the memory, the one or more programs comprising instructions which, when executed by the processor, cause the terminal device to perform the method steps of any of claims 1-3.
8. A computer-readable storage medium comprising computer instructions which, when run on a terminal device, cause the terminal device to perform the method of any one of claims 1-3.
9. A program product, characterized in that it causes a terminal device to carry out the method according to any one of claims 1-3, when said program product is run on said terminal device.
10. A chip system, comprising: one or more processors; a memory; wherein the memory is adapted to store a computer program and the processor is adapted to retrieve and run the computer program from the memory such that the terminal device on which the system-on-chip is installed performs the method steps as claimed in any of claims 1 to 3.
CN201910941306.XA 2019-09-30 2019-09-30 Management method of kernel lock and terminal equipment Pending CN110837290A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910941306.XA CN110837290A (en) 2019-09-30 2019-09-30 Management method of kernel lock and terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910941306.XA CN110837290A (en) 2019-09-30 2019-09-30 Management method of kernel lock and terminal equipment

Publications (1)

Publication Number Publication Date
CN110837290A true CN110837290A (en) 2020-02-25

Family

ID=69575127

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910941306.XA Pending CN110837290A (en) 2019-09-30 2019-09-30 Management method of kernel lock and terminal equipment

Country Status (1)

Country Link
CN (1) CN110837290A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113220105A (en) * 2021-03-19 2021-08-06 珠海全志科技股份有限公司 Android-based electronic book and reading control method thereof

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103402027A (en) * 2013-07-29 2013-11-20 广东欧珀移动通信有限公司 Mobile terminal and method for putting same into sleeping state
US20150234442A1 (en) * 2014-02-20 2015-08-20 Qualcomm Incorporated Wake lock management through application monitoring
CN105183137A (en) * 2015-09-09 2015-12-23 厦门美图移动科技有限公司 Mobile terminal and wake lock control method and system thereof
CN106125891A (en) * 2016-06-24 2016-11-16 北京奇虎科技有限公司 Terminal power optimization method, device and terminal
CN106502687A (en) * 2016-10-24 2017-03-15 深圳市金立通信设备有限公司 A kind of method and terminal for entering resting state
CN106662907A (en) * 2015-10-29 2017-05-10 华为技术有限公司 Terminal based wake-up lock control method, device and terminal
CN107608724A (en) * 2017-09-26 2018-01-19 深圳市金立通信设备有限公司 A kind of method, terminal and computer-readable recording medium for managing application program

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103402027A (en) * 2013-07-29 2013-11-20 广东欧珀移动通信有限公司 Mobile terminal and method for putting same into sleeping state
US20150234442A1 (en) * 2014-02-20 2015-08-20 Qualcomm Incorporated Wake lock management through application monitoring
CN105183137A (en) * 2015-09-09 2015-12-23 厦门美图移动科技有限公司 Mobile terminal and wake lock control method and system thereof
CN106662907A (en) * 2015-10-29 2017-05-10 华为技术有限公司 Terminal based wake-up lock control method, device and terminal
CN106125891A (en) * 2016-06-24 2016-11-16 北京奇虎科技有限公司 Terminal power optimization method, device and terminal
CN106502687A (en) * 2016-10-24 2017-03-15 深圳市金立通信设备有限公司 A kind of method and terminal for entering resting state
CN107608724A (en) * 2017-09-26 2018-01-19 深圳市金立通信设备有限公司 A kind of method, terminal and computer-readable recording medium for managing application program

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113220105A (en) * 2021-03-19 2021-08-06 珠海全志科技股份有限公司 Android-based electronic book and reading control method thereof

Similar Documents

Publication Publication Date Title
KR102147088B1 (en) Method and apparatus for offering received information to user in a electronic device
US8990795B2 (en) Automatic application updates
US20210389973A1 (en) Electronic device and method for operating the same
EP3391634B1 (en) Electronic device and method for controlling application and component
EP2911084B1 (en) Service authorization methods and apparatuses
CN111800462A (en) Micro-service instance processing method and device, computer equipment and storage medium
KR102071530B1 (en) Apparatas and method for proposing a response manual of occurring denial in an electronic device
US10057751B2 (en) Electronic device and method for updating accessory information
CN111459629A (en) Azkaban-based project operation method and device and terminal equipment
CN110881224B (en) Network long connection method, device, equipment and storage medium
CN110837290A (en) Management method of kernel lock and terminal equipment
CN111400085A (en) Transaction rollback exception processing method and device, computer equipment and storage medium
CN117130824A (en) Method for processing exception, electronic equipment and storage medium
CN109857720B (en) Database table monitoring method, device, computer device and readable storage medium
CN110007968B (en) Information processing method, information processing device, computer equipment and computer readable storage medium
CN109977659A (en) Weblogic automatically creates method, system, device and the storage medium of local user
CN110365839A (en) Closedown method, device, medium and electronic equipment
CN109460291A (en) Electronic device, the method for controller perturbation server cluster and storage medium
CN114968551B (en) Process management method and device, electronic equipment and storage medium
CN112732568B (en) System log acquisition method and device, storage medium and terminal
JP5836499B2 (en) Information processing apparatus having user support function, user support program, and user support method
WO2023202406A1 (en) Display method and electronic device
US20240028776A1 (en) Input/output (i/o) attack prevention system and method of using the same
CN112241322A (en) Memory management method and device and mobile device
CN115904642A (en) Cloud server control method and device, storage medium and electronic equipment

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20200225

RJ01 Rejection of invention patent application after publication