CN105550032A - CPU (Central Processing Unit) optimization method and system based on Android - Google Patents

CPU (Central Processing Unit) optimization method and system based on Android Download PDF

Info

Publication number
CN105550032A
CN105550032A CN201510701887.1A CN201510701887A CN105550032A CN 105550032 A CN105550032 A CN 105550032A CN 201510701887 A CN201510701887 A CN 201510701887A CN 105550032 A CN105550032 A CN 105550032A
Authority
CN
China
Prior art keywords
infinite loop
message queue
data
queue
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.)
Pending
Application number
CN201510701887.1A
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.)
Shenzhen Meibeike Technology Co Ltd
Original Assignee
Shenzhen Meibeike Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Meibeike Technology Co Ltd filed Critical Shenzhen Meibeike Technology Co Ltd
Priority to CN201510701887.1A priority Critical patent/CN105550032A/en
Publication of CN105550032A publication Critical patent/CN105550032A/en
Pending legal-status Critical Current

Links

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/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5038Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration
    • 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 invention provides a CPU (Central Processing Unit) optimization method and system based on Android. The CPU optimization method comprises the following steps: an application program creates a linear message Queue; certain unit intention in the linear message Queue is added into a message Queue; after the application program creates a while(true) infinite loop, the message Queue is added into the infinite loop; the intention in the message Queue is obtained in the infinite loop, and a data processing module is operated to process the intention; and when a result that the data of the message Queue is empty in the infinite loop and the message Queue does not contain data is obtained, a data locking module is operated, and the infinite loop is locked. Compared with the prior art, the CPU optimization method has the following beneficial effects that the problem of overhigh use ratio of the CPU when software is used is solved, the use power consumption of Android equipment is effectively lowered, the power consumption amount of the Android equipment is effectively lowered, and various problems, including non-smoothness, crash, restarting and the like, caused by the overhigh use ratio of the CPU can be reduced.

Description

Based on CPU optimization method, the system of android system
Technical field
The invention belongs to Android system application, particularly a kind of CPU optimization method based on android system.
Background technology
As everyone knows, in the power consumption seniority among brothers and sisters of Android system, the power consumption of CPU account for larger a part of ratio, that is, the utilization rate of CPU and frequency of utilization are by the direct or indirect distribution affecting electricity and use, the frequency of operation unit hertz of CPU or megahertz, the frequency of operation of CPU is higher, power consumption is larger. but it's a pity, developer not for android in android-sdk provides the similar CPU function managed, but but the cpu management software of a lot of power saving class application or specialty both provides the frequency reducing of CPU or even the function of overclocking instantly. these power savings application is not fundamentally solve the excessive solution of CPU temporary rate.
For solving the too high problem of CPU usage, fundamentally should solve, when the most basic problem is exactly Android application process data, occupying too many cpu resource.If just short time equipment does not also have any problem, but when CPU is for a long time by words that program takies, power consumption will be caused to increase, cause because the series of problems of the too high generation of CPU, such as: system Compulsory Removal internal memory, then load the card that internal memory produces to pause, crash, to restart etc. problem.So first will avoid applying the problem taking cpu resource for a long time.And there will be application and take this situation of cpu resource for a long time, be generally there is infinite loop in application program load data or obtain data.
Summary of the invention
For the deficiency that above-mentioned prior art exists, the object of the invention is to solve the problem that application takies cpu resource for a long time, infinite loop should be avoided to obtain data or load the situation of data, but (while (true)) infinite loop must be used again in a lot of situation, be achieved by the following technical solution.
Based on a CPU optimization method for android system, wherein, described method comprises the steps:
S1. application program creates linear message queue Queue, and every unit information is the intention of the operation in infinite loop;
S2. application program adds described intention in message queue Queue;
S3. application program creates while (true) infinite loop, joins in infinite loop by described message queue Queue;
S4. obtain in message queue Queue in described infinite loop and be intended to, service data processing module;
S5. obtain in described infinite loop message queue there are data time, intention be added in message queue Queue, service data unlocked state, unlocks this infinite loop;
S6. when the data obtaining message queue in described infinite loop are for empty, obtain message queue Queue when not having data, service data locking module, locks this infinite loop.
Application program creates and service data unlocked state, removes the locking data in infinite loop.
For a system for CPU optimization method, be included in the application program module run in CPU, described application program module comprises:
The linear message queue Queue module created by application program;
While (true) infinite loop module is created by application program;
The data interlock module created by application program, when the infinite loop module for running locks;
The unlocking data module created by application program, removes the locking data in infinite loop;
The data processing module created by application program, for processing data according to the intention in message queue;
Obtain in message queue Queue in described infinite loop module and be intended to, service data processing module, when intentional being added in message queue Queue, described infinite loop unlocks by service data unlocked state, when obtaining the data of message queue in infinite loop for empty, obtain message queue Queue when not having data, described infinite loop locks by service data locking module.
The present invention compared with prior art has following beneficial effect: solve the problem that when using software, CPU usage is too high, effective reduction Android device uses power consumption, effective reduction Android device power consumption, and reduce because the too high various problems caused of CPU usage, such as card, crash, restart etc.
Accompanying drawing explanation
Fig. 1 is the flowage structure block diagram of a kind of CPU optimization method based on android system of the present invention.
Fig. 2 is the structured flowchart of a kind of system for CPU optimization method of the present invention.
Fig. 3 is the flowage structure figure of a specific embodiment of Fig. 1.
Embodiment
Below in conjunction with accompanying drawing, the embodiment of the present invention is described in detail.
As shown in Figure 1, Fig. 1 is the flowage structure block diagram of a kind of CPU optimization method based on android system of the present invention, and this CPU optimization method comprises the following steps:
S1. application program creates linear message queue Queue, and every unit information is the intention of the operation in infinite loop;
S2. create and service data unlocked state, remove the locking data in infinite loop, add described intention in message queue Queue;
S3. application program creates while (true) infinite loop, joins in infinite loop by described message queue Queue;
S4. obtain in message queue Queue in described infinite loop and be intended to, service data processing module;
S5. obtain in described infinite loop message queue there are data time, intention be added in message queue Queue, service data unlocked state, unlocks this infinite loop;
S6. when the data obtaining message queue in described infinite loop are for empty, obtain message queue Queue when not having data, service data locking module, locks this infinite loop.
As shown in Figure 2, be the structured flowchart of a kind of system for CPU optimization method of the present invention, described system is included in the application program module run in CPU, and described application program module comprises:
The linear message queue module created by application program;
Infinite loop module is created by application program;
The data interlock module created by application program, when the infinite loop module for running locks;
The unlocking data module created by application program, removes the locking data in infinite loop;
The data processing module created by application program, for processing data according to the intention in message queue;
Obtain in message queue Queue in described infinite loop module and be intended to, service data processing module, when intentional being added in message queue Queue, described infinite loop unlocks by service data unlocked state, when obtaining the data of message queue in infinite loop for empty, obtain message queue Queue when not having data, described infinite loop locks by service data locking module.
Being convenient to understand, in conjunction with Fig. 1-2, is a specific embodiment structure flow chart of Fig. 1 with reference to figure 3, Fig. 3.
In the present invention, application program creates linear message queue Queue, and in linear message queue Queue, each unit information arranges all in order, acts on first in first out, and every unit information is the intention of the operation in infinite loop.
Application program creates while (true) infinite loop, in figure 3, extracts unit partly or completely and enter in while (true) infinite loop in the unit information in linear message queue Queue.
Application program creates data interlock module, and act as and run this module, infinite loop is locked in here, until service data unlocked state, just can continue to run, and create unlocking data module, act as and run this module, remove the locking data in infinite loop.
Meanwhile, application program creates data processing module, act as and processes data according to the intention in message queue.Obtain in infinite loop in message queue Queue and be intended to, service data processing module, such as, obtain data, loads data etc.
When the data obtaining message queue in infinite loop for empty obtain message queue Queue there is no data time, service data locking module, locks this infinite loop, until run unlocked state.
When intentional being added in message queue Queue, service data unlocked state, unlocks this infinite loop.
In Android system, the problem of cpu resource is taken for a long time for solving application, infinite loop should be avoided to obtain data or load the situation of data, but (while (true)) infinite loop must be used again in a lot of situation, therefore judge whether intentionally to be added in message queue Queue by wireless circulating, and perform data unlocked state or data interlock module, by locking infinite loop, effectively can solve application program and take the too much problem of cpu resource.
Above content is only preferred embodiment of the present invention, and for those of ordinary skill in the art, according to thought of the present invention, all will change in specific embodiments and applications, this description should not be construed as limitation of the present invention.

Claims (3)

1., based on a CPU optimization method for android system, comprising:
S1. application program creates linear message queue Queue, and every unit information is the intention of the operation in infinite loop;
S2. application program adds described intention in message queue Queue;
S3. application program creates while (true) infinite loop, joins in infinite loop by described message queue Queue;
S4. obtain in message queue Queue in described infinite loop and be intended to, service data processing module;
S5. obtain in described infinite loop message queue there are data time, intention be added in message queue Queue, service data unlocked state, unlocks this infinite loop;
S6. when the data obtaining message queue in described infinite loop are for empty, obtain message queue Queue when not having data, service data locking module, locks this infinite loop.
2. for a system for CPU optimization method, be included in the application program module run in CPU, described application program module comprises:
The linear message queue Queue module created by application program;
While (true) infinite loop module is created by application program;
The data interlock module created by application program, when the infinite loop module for running locks;
The unlocking data module created by application program, removes the locking data in infinite loop;
The data processing module created by application program, for processing data according to the intention in message queue;
Obtain in message queue Queue in described infinite loop module and be intended to, service data processing module, when intentional being added in message queue Queue, described infinite loop unlocks by service data unlocked state, when obtaining the data of message queue in infinite loop for empty, obtain message queue Queue when not having data, described infinite loop locks by service data locking module.
3. system according to claim 2, is characterized in that, described data processing module user obtains data, loads data.
CN201510701887.1A 2015-10-27 2015-10-27 CPU (Central Processing Unit) optimization method and system based on Android Pending CN105550032A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510701887.1A CN105550032A (en) 2015-10-27 2015-10-27 CPU (Central Processing Unit) optimization method and system based on Android

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510701887.1A CN105550032A (en) 2015-10-27 2015-10-27 CPU (Central Processing Unit) optimization method and system based on Android

Publications (1)

Publication Number Publication Date
CN105550032A true CN105550032A (en) 2016-05-04

Family

ID=55829229

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510701887.1A Pending CN105550032A (en) 2015-10-27 2015-10-27 CPU (Central Processing Unit) optimization method and system based on Android

Country Status (1)

Country Link
CN (1) CN105550032A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114237728A (en) * 2021-12-23 2022-03-25 北京奕斯伟计算技术有限公司 Control method and operating system of electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080104601A1 (en) * 2006-10-26 2008-05-01 Nokia Corporation Scheduler for multiple software tasks to share reconfigurable hardware
CN101470627A (en) * 2007-12-29 2009-07-01 北京天融信网络安全技术有限公司 Method for implementing parallel multi-core configuration lock on MIPS platform
US20130227583A1 (en) * 2012-02-23 2013-08-29 Qualcomm Incorporated Method and System For Scheduling Requests In A Portable Computing Device
CN103377078A (en) * 2012-04-11 2013-10-30 广州市地下铁道总公司 Real-time task scheduling method and system for vehicular ATP
CN104123177A (en) * 2014-07-18 2014-10-29 无锡梵天信息技术股份有限公司 Lockless multithreading data synchronization method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080104601A1 (en) * 2006-10-26 2008-05-01 Nokia Corporation Scheduler for multiple software tasks to share reconfigurable hardware
CN101470627A (en) * 2007-12-29 2009-07-01 北京天融信网络安全技术有限公司 Method for implementing parallel multi-core configuration lock on MIPS platform
US20130227583A1 (en) * 2012-02-23 2013-08-29 Qualcomm Incorporated Method and System For Scheduling Requests In A Portable Computing Device
CN103377078A (en) * 2012-04-11 2013-10-30 广州市地下铁道总公司 Real-time task scheduling method and system for vehicular ATP
CN104123177A (en) * 2014-07-18 2014-10-29 无锡梵天信息技术股份有限公司 Lockless multithreading data synchronization method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114237728A (en) * 2021-12-23 2022-03-25 北京奕斯伟计算技术有限公司 Control method and operating system of electronic equipment
CN114237728B (en) * 2021-12-23 2024-03-29 北京奕斯伟计算技术股份有限公司 Control method and operating system of electronic equipment

Similar Documents

Publication Publication Date Title
Bansal et al. Speed scaling to manage energy and temperature
Khdr et al. Thermal constrained resource management for mixed ILP-TLP workloads in dark silicon chips
Huang et al. Energy efficient DVFS scheduling for mixed-criticality systems
CN105893148B (en) A kind of accidental task low energy consumption dispatching method based on RM strategy
CN102566739B (en) Multicore processor system and dynamic power management method and control device thereof
TWI425422B (en) Multi-cpu domain mobile electronic device and operation method thereof
Kataoka et al. Power Consumption and Computation Models of a Server with a Multi-core CPU and Experiments
CN104798008B (en) The configurable peak performance limit of control processor
CN104615415B (en) A kind of information processing method and electronic equipment
KR102425341B1 (en) System maximum current protection
US20100005323A1 (en) Semiconductor integrated circuit
EP3376379A1 (en) Task management methods and system, and computer storage medium
DE112013005278T5 (en) Dynamically balancing performance across a plurality of processor domains in accordance with performance balancing BIAS
TW201335841A (en) Collaborative processor and system performance and power management
CN101901159B (en) Method and system for loading Linux operating system on multi-core CPU
CN105320570B (en) Method for managing resource and system
CN103049319A (en) Method for managing background application program in divided period and terminal thereof
CN109313477A (en) The performance boost of core based on activation
US9448617B2 (en) Systems and methods for messaging-based fine granularity system-on-a-chip power gating
CN105550032A (en) CPU (Central Processing Unit) optimization method and system based on Android
CN107506286A (en) CPU and memory block automatically upper inserting method and system
US20120102342A1 (en) Active display processor sleep state
CN104756043B (en) For controlling the system and method for central processing unit power with the guaranteed transient state deadline date
CN105573860A (en) STD (Suspend to disk) management method and STD management system used in computer system
CN105245372A (en) Optimization method for loading network resources based on cache and asynchronous mechanism

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20160504

WD01 Invention patent application deemed withdrawn after publication