CN109471716A - A kind of application thread processing method, terminal and computer readable storage medium - Google Patents

A kind of application thread processing method, terminal and computer readable storage medium Download PDF

Info

Publication number
CN109471716A
CN109471716A CN201811126564.4A CN201811126564A CN109471716A CN 109471716 A CN109471716 A CN 109471716A CN 201811126564 A CN201811126564 A CN 201811126564A CN 109471716 A CN109471716 A CN 109471716A
Authority
CN
China
Prior art keywords
thread
memory
optimized
terminal
running
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
CN201811126564.4A
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.)
Nubia Technology Co Ltd
Original Assignee
Nubia 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 Nubia Technology Co Ltd filed Critical Nubia Technology Co Ltd
Priority to CN201811126564.4A priority Critical patent/CN109471716A/en
Publication of CN109471716A publication Critical patent/CN109471716A/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/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/485Task life-cycle, e.g. stopping, restarting, resuming execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5018Thread allocation

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The present invention provides a kind of application thread processing method, terminal and computer readable storage medium, when terminal is in using operating status, obtains current all using the thread information of thread;The default optimal conditions of thread information satisfaction are applied into thread, are determined as all using to be optimized using thread in thread;When application thread to be optimized is in inoperative state, by the running memory to be optimized for producing terminal using thread;When reaching the preset thread operation preparation moment, application thread to be optimized is gone back in running memory and is run.By the way that all running memory will be produced in inoperative state using the application thread to be optimized in thread, and it goes back in running memory and runs when reaching and running and prepare the moment, reduce the occupied running memory of thread on the whole, improves the operation fluency and the speed of service of application.

Description

A kind of application thread processing method, terminal and computer readable storage medium
Technical field
The present invention relates to intelligent terminal technical field, more specifically to a kind of application thread processing method, terminal and Computer readable storage medium.
Background technique
With the continuous development of terminal technology, the popularity rate of intelligent terminal in social life is higher and higher, and user is in day Often also higher and higher using the frequency of intelligent terminal in life, the intelligent terminal for applying various new technologies also comes into being, people Intelligent terminal not only can be used make a phone call, send short messages, can also see video, listen to music, instant messaging, play game etc., make Obtaining intelligent terminal becomes the indispensable important tool of people.
Application program currently based on the different scenes of terminal is ten hundreds of, as what user installed at the terminal applies number Measure it is more and more, and application operation logic become increasingly complex, in usual terminal operation in application, can open simultaneously multiple Thread, and be run mode in usually only a small number of threads of same time, and more threads are then in inoperative state, however it is existing These threads are stored in the running memory of terminal simultaneously in technology, more running memory can be occupied, and terminal is interior It deposits resource to be limited again, when memory source occurs insufficient, then the frequent Caton of system is easy to appear, so that user experience is not It is good.
Summary of the invention
The technical problem to be solved in the present invention is that in the prior art that the institute including inoperative state thread of application is wired Journey is stored in the running memory of terminal, and caused running memory utilization efficiency is low, using in operational process be easy Caton, For the technical problem, a kind of application thread processing method, terminal and computer readable storage medium are provided.
In order to solve the above technical problems, the present invention provides a kind of using thread processing method, this applies thread processing method Include:
When terminal is in using operating status, obtain current all using the thread information of thread;
The default optimal conditions of thread information satisfaction are applied into thread, are determined as all using the application to be optimized in thread Thread;
When application thread to be optimized is in inoperative state, by the running memory to be optimized for producing terminal using thread;
When reaching the preset thread operation preparation moment, application thread to be optimized is gone back in running memory and is run.
Optionally, obtain it is current all using the thread information of thread before, further includes:
Whether judgement meets preset thread process trigger condition using operating status;
If so, obtaining current all using the thread information of thread.
Optionally, judge that whether meeting preset thread process trigger condition using operating status includes following at least one Kind:
Whether judgement is higher than default number of threads threshold value using thread total amount using what is created under operating status;
Judgement presets total memory usage threshold value using whether total memory usage under operating status is higher than.
Optionally, thread information includes: running frequency and/or running memory occupancy;
Optimal conditions include: running frequency lower than preset operating frequency threshold value;And/or memory usage is higher than in default Deposit occupancy threshold.
Optionally, include: by the running memory to be optimized for producing terminal using thread
By the running memory to be optimized for producing terminal using thread, and it is transferred to the disk of terminal itself and/or is installed External disk.
Optionally, inoperative state comprises at least one of the following: suspended state, blocked state.
Optionally, application thread to be optimized is being gone back in running memory before operation, further includes:
Time of running when according to the history run moment distributed data of thread to be optimized and the last operation, prediction Thread to be optimized switches to the switching moment of run mode again;
Determine that thread operation prepares the moment based on switching moment.
Optionally, determine that the thread operation preparation moment includes: based on switching moment
By the identified moment after switching moment preset in advance time interval, it is determined as thread operation and prepares the moment.
Further, the present invention also provides a kind of terminal, which includes processor, memory, communication bus;
Communication bus is for realizing the connection communication between processor, memory;
Processor is for executing one or more program stored in memory, to realize above-mentioned application thread process The step of method.
Further, the present invention also provides a kind of computer readable storage medium, which is deposited One or more program is contained, one or more program can be executed by one or more processor, above-mentioned to realize The step of using thread processing method.
Beneficial effect
The present invention provides a kind of application thread processing method, terminal and computer readable storage medium, for the prior art It is middle that all threads including inoperative state thread of application are stored in the running memory of terminal, caused running memory Utilization efficiency is low, using the defect for being easy Caton in operational process, when terminal is in using operating status, obtains currently all Using the thread information of thread;The default optimal conditions of thread information satisfaction are applied into thread, are determined as all using in thread It is to be optimized apply thread;When application thread to be optimized is in inoperative state, by the fortune to be optimized for producing terminal using thread Row memory;When reaching the preset thread operation preparation moment, application thread to be optimized is gone back in running memory and is run.Pass through Running memory all will be produced in inoperative state using the application thread to be optimized in thread, and prepare the moment reaching to run When go back in running memory and run, reduce the occupied running memory of thread on the whole, the operation for improving application is smooth Degree and the speed of service, improve user experience.
Detailed description of the invention
Present invention will be further explained below with reference to the attached drawings and examples, in attached drawing:
The hardware structural diagram of Fig. 1 each embodiment one optional mobile terminal to realize the present invention;
Fig. 2 is the wireless communication system schematic diagram of mobile terminal as shown in Figure 1;
Fig. 3 is the basic flow chart using thread processing method that first embodiment of the invention provides;
Fig. 4 is the refined flow chart using thread processing method that second embodiment of the invention provides;
Fig. 5 is the refined flow chart using thread processing method that third embodiment of the invention provides;
Fig. 6 is the structural schematic diagram for the terminal that fourth embodiment of the invention provides.
Specific embodiment
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, it is not intended to limit the present invention.
In subsequent description, it is only using the suffix for indicating such as " module ", " component " or " unit " of element Be conducive to explanation of the invention, itself there is no a specific meaning.Therefore, " module ", " component " or " unit " can mix Ground uses.
Terminal can be implemented in a variety of manners.For example, terminal described in the present invention may include such as mobile phone, plate Computer, laptop, palm PC, personal digital assistant (Personal Digital Assistant, PDA), portable Media player (Portable Media Player, PMP), navigation device, wearable device, Intelligent bracelet, pedometer etc. move The fixed terminals such as dynamic terminal, and number TV, desktop computer.
It will be illustrated by taking mobile terminal as an example in subsequent descriptions, it will be appreciated by those skilled in the art that in addition to special Except element for moving purpose, the construction of embodiment according to the present invention can also apply to the terminal of fixed type.
Referring to Fig. 1, a kind of hardware structural diagram of its mobile terminal of each embodiment to realize the present invention, the shifting Dynamic terminal 100 may include: RF (Radio Frequency, radio frequency) unit 101, WiFi module 102, audio output unit 103, A/V (audio/video) input unit 104, sensor 105, display unit 106, user input unit 107, interface unit 108, the components such as memory 109, processor 110 and power supply 111.It will be understood by those skilled in the art that shown in Fig. 1 Mobile terminal structure does not constitute the restriction to mobile terminal, and mobile terminal may include components more more or fewer than diagram, Perhaps certain components or different component layouts are combined.
It is specifically introduced below with reference to all parts of the Fig. 1 to mobile terminal:
Radio frequency unit 101 can be used for receiving and sending messages or communication process in, signal sends and receivees, specifically, by base station Downlink information receive after, to processor 110 handle;In addition, the data of uplink are sent to base station.In general, radio frequency unit 101 Including but not limited to antenna, at least one amplifier, transceiver, coupler, low-noise amplifier, duplexer etc..In addition, penetrating Frequency unit 101 can also be communicated with network and other equipment by wireless communication.Any communication can be used in above-mentioned wireless communication Standard or agreement, including but not limited to GSM (Global System of Mobile communication, global system for mobile telecommunications System), GPRS (General Packet Radio Service, general packet radio service), CDMA2000 (Code Division Multiple Access 2000, CDMA 2000), WCDMA (Wideband Code Division Multiple Access, wideband code division multiple access), TD-SCDMA (Time Division-Synchronous Code Division Multiple Access, TD SDMA), FDD-LTE (Frequency Division Duplexing-Long Term Evolution, frequency division duplex long term evolution) and TDD-LTE (Time Division Duplexing-Long Term Evolution, time division duplex long term evolution) etc..
WiFi belongs to short range wireless transmission technology, and mobile terminal can help user to receive and dispatch electricity by WiFi module 102 Sub- mail, browsing webpage and access streaming video etc., it provides wireless broadband internet access for user.Although Fig. 1 shows Go out WiFi module 102, but it is understood that, and it is not belonging to must be configured into for mobile terminal, it completely can be according to need It to omit within the scope of not changing the essence of the invention.
Audio output unit 103 can be in call signal reception pattern, call mode, record mould in mobile terminal 100 When under the isotypes such as formula, speech recognition mode, broadcast reception mode, by radio frequency unit 101 or WiFi module 102 it is received or The audio data stored in memory 109 is converted into audio signal and exports to be sound.Moreover, audio output unit 103 Audio output relevant to the specific function that mobile terminal 100 executes can also be provided (for example, call signal receives sound, disappears Breath receives sound etc.).Audio output unit 103 may include loudspeaker, buzzer etc..
A/V input unit 104 is for receiving audio or video signal.A/V input unit 104 may include graphics processor (Graphics Processing Unit, GPU) 1041 and microphone 1042, graphics processor 1041 is in video acquisition mode Or the image data of the static images or video obtained in image capture mode by image capture apparatus (such as camera) carries out Reason.Treated, and picture frame may be displayed on display unit 106.Through graphics processor 1041, treated that picture frame can be deposited Storage is sent in memory 109 (or other storage mediums) or via radio frequency unit 101 or WiFi module 102.Mike Wind 1042 can connect in telephone calling model, logging mode, speech recognition mode etc. operational mode via microphone 1042 Quiet down sound (audio data), and can be audio data by such acoustic processing.Audio that treated (voice) data can To be converted to the format output that can be sent to mobile communication base station via radio frequency unit 101 in the case where telephone calling model. Microphone 1042 can be implemented various types of noises elimination (or inhibition) algorithms and send and receive sound to eliminate (or inhibition) The noise generated during frequency signal or interference.
Mobile terminal 100 further includes at least one sensor 105, such as optical sensor, motion sensor and other biographies Sensor.Specifically, optical sensor includes ambient light sensor and proximity sensor, wherein ambient light sensor can be according to environment The light and shade of light adjusts the brightness of display panel 1061, and proximity sensor can close when mobile terminal 100 is moved in one's ear Display panel 1061 and/or backlight.As a kind of motion sensor, accelerometer sensor can detect in all directions (general For three axis) size of acceleration, it can detect that size and the direction of gravity when static, can be used to identify the application of mobile phone posture (such as horizontal/vertical screen switching, dependent game, magnetometer pose calibrating), Vibration identification correlation function (such as pedometer, percussion) etc.; The fingerprint sensor that can also configure as mobile phone, pressure sensor, iris sensor, molecule sensor, gyroscope, barometer, The other sensors such as hygrometer, thermometer, infrared sensor, details are not described herein.
Display unit 106 is for showing information input by user or being supplied to the information of user.Display unit 106 can wrap Display panel 1061 is included, liquid crystal display (Liquid Crystal Display, LCD), Organic Light Emitting Diode can be used Forms such as (Organic Light-Emitting Diode, OLED) configure display panel 1061.
User input unit 107 can be used for receiving the number or character information of input, and generate the use with mobile terminal Family setting and the related key signals input of function control.Specifically, user input unit 107 may include touch panel 1071 with And other input equipments 1072.Touch panel 1071, also referred to as touch screen collect the touch operation of user on it or nearby (for example user uses any suitable objects or attachment such as finger, stylus on touch panel 1071 or in touch panel 1071 Neighbouring operation), and corresponding attachment device is driven according to preset formula.Touch panel 1071 may include touch detection Two parts of device and touch controller.Wherein, the touch orientation of touch detecting apparatus detection user, and detect touch operation band The signal come, transmits a signal to touch controller;Touch controller receives touch information from touch detecting apparatus, and by it It is converted into contact coordinate, then gives processor 110, and order that processor 110 is sent can be received and executed.In addition, can To realize touch panel 1071 using multiple types such as resistance-type, condenser type, infrared ray and surface acoustic waves.In addition to touch panel 1071, user input unit 107 can also include other input equipments 1072.Specifically, other input equipments 1072 can wrap It includes but is not limited in physical keyboard, function key (such as volume control button, switch key etc.), trace ball, mouse, operating stick etc. It is one or more, specifically herein without limitation.
Further, touch panel 1071 can cover display panel 1061, when touch panel 1071 detect on it or After neighbouring touch operation, processor 110 is sent to determine the type of touch event, is followed by subsequent processing device 110 according to touch thing The type of part provides corresponding visual output on display panel 1061.Although in Fig. 1, touch panel 1071 and display panel 1061 be the function that outputs and inputs of realizing mobile terminal as two independent components, but in certain embodiments, it can The function that outputs and inputs of mobile terminal is realized so that touch panel 1071 and display panel 1061 is integrated, is not done herein specifically It limits.
Interface unit 108 be used as at least one external device (ED) connect with mobile terminal 100 can by interface.For example, External device (ED) may include wired or wireless headphone port, external power supply (or battery charger) port, wired or nothing Line data port, memory card port, the port for connecting the device with identification module, audio input/output (I/O) end Mouth, video i/o port, ear port etc..Interface unit 108 can be used for receiving the input from external device (ED) (for example, number It is believed that breath, electric power etc.) and the input received is transferred to one or more elements in mobile terminal 100 or can be with For transmitting data between mobile terminal 100 and external device (ED).
Memory 109 can be used for storing software program and various data.Memory 109 can mainly include storing program area The storage data area and, wherein storing program area can (such as the sound of application program needed for storage program area, at least one function Sound playing function, image player function etc.) etc.;Storage data area can store according to mobile phone use created data (such as Audio data, phone directory etc.) etc..In addition, memory 109 may include high-speed random access memory, it can also include non-easy The property lost memory, a for example, at least disk memory, flush memory device or other volatile solid-state parts.
Processor 110 is the control centre of mobile terminal, utilizes each of various interfaces and the entire mobile terminal of connection A part by running or execute the software program and/or module that are stored in memory 109, and calls and is stored in storage Data in device 109 execute the various functions and processing data of mobile terminal, to carry out integral monitoring to mobile terminal.Place Managing device 110 may include one or more processing units;Preferably, processor 110 can integrate application processor and modulatedemodulate is mediated Manage device, wherein the main processing operation system of application processor, user interface and application program etc., modem processor is main Processing wireless communication.It is understood that above-mentioned modem processor can not also be integrated into processor 110.
Mobile terminal 100 can also include the power supply 111 (such as battery) powered to all parts, it is preferred that power supply 111 Can be logically contiguous by power-supply management system and processor 110, to realize management charging by power-supply management system, put The functions such as electricity and power managed.
Although Fig. 1 is not shown, mobile terminal 100 can also be including bluetooth module etc., and details are not described herein.
Embodiment to facilitate the understanding of the present invention, the communications network system that mobile terminal of the invention is based below into Row description.
Referring to Fig. 2, Fig. 2 is a kind of communications network system architecture diagram provided in an embodiment of the present invention, the communication network system System is the LTE system of universal mobile communications technology, which includes UE (User Equipment, the use of successively communication connection Family equipment) (the land Evolved UMTS Terrestrial Radio Access Network, evolved UMTS 201, E-UTRAN Ground wireless access network) 202, EPC (Evolved Packet Core, evolved packet-based core networks) 203 and operator IP operation 204。
Specifically, UE201 can be above-mentioned terminal 100, and details are not described herein again.
E-UTRAN202 includes eNodeB2021 and other eNodeB2022 etc..Wherein, eNodeB2021 can be by returning Journey (backhaul) (such as X2 interface) is connect with other eNodeB2022, and eNodeB2021 is connected to EPC203, ENodeB2021 can provide the access of UE201 to EPC203.
EPC203 may include MME (Mobility Management Entity, mobility management entity) 2031, HSS (Home Subscriber Server, home subscriber server) 2032, other MME2033, SGW (Serving Gate Way, Gateway) 2034, PGW (PDN Gate Way, grouped data network gateway) 2035 and PCRF (Policy and Charging Rules Function, policy and rate functional entity) 2036 etc..Wherein, MME2031 be processing UE201 and The control node of signaling, provides carrying and connection management between EPC203.HSS2032 is all to manage for providing some registers Such as the function of home location register (not shown) etc, and preserves some related service features, data rates etc. and use The dedicated information in family.All customer data can be sent by SGW2034, and PGW2035 can provide the IP of UE 201 Address distribution and other functions, PCRF2036 are strategy and the charging control strategic decision-making of business data flow and IP bearing resource Point, it selects and provides available strategy and charging control decision with charge execution function unit (not shown) for strategy.
IP operation 204 may include internet, Intranet, IMS (IP Multimedia Subsystem, IP multimedia System) or other IP operations etc..
Although above-mentioned be described by taking LTE system as an example, those skilled in the art should know the present invention is not only Suitable for LTE system, be readily applicable to other wireless communication systems, such as GSM, CDMA2000, WCDMA, TD-SCDMA with And the following new network system etc., herein without limitation.
Based on above-mentioned mobile terminal hardware configuration and communications network system, each embodiment of the method for the present invention is proposed.
First embodiment
To solve that all threads including inoperative state thread of application are stored in the operation of terminal in the prior art In memory, caused running memory utilization efficiency is low, using the defect for being easy Caton in operational process, present embodiments provides It is a kind of to apply thread processing method, it is illustrated in figure 3 the basic flow chart provided in this embodiment using thread processing method, it should Using thread processing method specifically includes the following steps:
S301, when terminal is in using operating status, obtain current all using the thread information of thread.
When the terminal of the present embodiment is in using operating status, it can be and individually apply in foreground or running background, it can also To be that multiple applications can open many threads, same in each application operational process in foreground or running background simultaneously Time, usually only a small number of threads be in run mode, remaining is in terminal in the present embodiment and applies all in inoperative state All application threads under operating status are monitored and analyze, to obtain current each thread information using thread.
Optionally, obtain it is current all using the thread information of thread before, further includes: judge be using operating status It is no to meet preset thread process trigger condition;If so, obtaining current all using the thread information of thread.
Specifically, in practical applications, not having the demand using thread process under all application scenarios, such as eventually Hold currently running thread limited or current running memory redundancy, terminal operating is functional in this case, opens application Thread process process will cause the waste of terminal capabilities without causing to be obviously improved to terminal applies operation instead, be based on this, In the present embodiment, it can just be triggered when terminal applies operating status meets certain trigger condition at application thread of the invention Manage process.
Optionally, judge that whether meeting preset thread process trigger condition using operating status includes following at least one Kind: whether judgement is higher than default number of threads threshold value using thread total amount using what is created under operating status;Judgement application fortune Whether total memory usage under row state, which is higher than, is preset total memory usage threshold value.
Specifically, commonly used number of threads is more, the number of applications currently run can be characterized to a certain extent More or application operation logic is complex, needs to expend the more performance of terminal, therefore, in some embodiments, can be real-time What is created when to application operation counts using the total amount of thread, when being more than preset threshold, shows currently have application Thread process is necessary, thus triggering following process.In further embodiments, can also be under current application operating status, institute There is the total amount for occupying running memory using thread to be counted, when being more than preset threshold, shows currently have using at thread Reason is necessary, thus triggering following process.It should be noted that also in some embodiments, what is counted applies thread total amount And total memory usage can be the average value counted within the particular historical time cycle.Certainly, in practical applications also CPU total amount occupied etc. can be made whether to meet the judgement of trigger condition by statistics, do not limited uniquely herein, it can It is selected according to actual use demand.
Optionally, thread information includes: running frequency and/or running memory occupancy.
Specifically, the thread information in the present embodiment is used to evaluate the attribute of different threads.Wherein, its attribute of different threads The present running frequency of different entire bodies and the aspect of running memory occupancy two, certain threads can frequently be pulled up operation, thus its Running frequency is then relatively high, on the contrary then running frequency is lower, such as some applies A, and creation has thread in the process of running 1, thread 2, thread 3, thread 4, thread 5, are precipitated according to statistical, and the running frequency of thread 1 and thread 3 is all very low, are applying During operation, running frequency is 5 times/hour;Thread 2, thread 4, the running frequency of thread 5 are higher, are 100 times/hour.It is logical Sample, it is different also different using occupancy of the thread to memory, such as the memory of the occupancy of thread 1 10KB, and thread 2 only accounts for With the memory of 2KB, so that thread 1 keeps higher occupancy.It should be noted that the system of running frequency and running memory occupancy Meter mode periodically reads the information of each thread by monitoring thread stack, for example, applied described in thread, current state, operation when Quarter, internal storage data etc., and combined data obtains.
S302, thread information meets to default optimal conditions apply thread, be determined as all using in thread to excellent Change and applies thread.
In some embodiments, optimal conditions include: running frequency lower than preset operating frequency threshold value;And/or memory accounts for It is higher than default memory usage threshold value with rate.
Specifically, to be optimized in the present embodiment is the required thread handled using thread, it is handled with Achieve the purpose that running memory optimizes.Wherein, when thread information is running frequency, if running frequency is higher, illustrate the line Journey frequently switches between run mode and inoperative state, higher to the degree of dependence of the thread when using operation, this In the case of be then unsuitable for processed, the lower thread of running frequency instead, it is lower to its degree of dependence when using operation, more When be in inoperative state, instream factor is relatively low, and if placing it in running memory and will cause in operation for a long time The waste deposited, therefore the lower thread of running frequency is more suitable for being handled and realizing running memory and optimize.Further, it is also possible to For memory usage, occupying higher thread to running memory keeps the load of running memory relatively large, a large amount of EMS memory occupations The presence of the high thread of rate can be easier to lead to the Caton using in operational process, thus in practical applications can also be by memory The high thread of occupancy applies thread as to be optimized.
S303, when application thread to be optimized is in inoperative state, produced to be optimized in the operation of terminal using thread It deposits.
Specifically, optimizing to realize to running memory in the present embodiment, used mode is will to be in non-fortune The running memory to be optimized that terminal is produced using thread of row state, and the useful space will be vacateed in running memory, and except to excellent Change is whether in run mode using other threads except thread and does not deal with, can effectively improve the operation speed of thread Degree.It should be noted that the present embodiment in running memory be the internal storage that data are directly exchanged with CPU, also known as with Machine memory (Random Access Memory, RAM), facilitates read-write, and speed is fast, usually as operating system or it is other The ephemeral data storaging medium of running application.It should be noted that in practical applications inoperative state include it is following at least It is a kind of: suspended state, blocked state.
It optionally, include: that application thread to be optimized is produced into end by the running memory to be optimized for producing terminal using thread The running memory at end, and be transferred to the disk of terminal itself and/or the external disk installed.
Specifically, in the present embodiment, the application thread to be optimized produced from running memory is transferred into terminal certainly The disk of body installs external disk at the terminal, the disk namely read-only memory (Read-Only of terminal itself Memory, ROM), as a long-term storage device of terminal, storing data is stablized, and stored data will not change after power-off. And external disk then may include SD card, TF card etc., for being mounted in terminal groove to expand terminal disk space, Details are not described herein.
S304, when reaching the operation of preset thread and preparing the moment, application thread to be optimized is gone back in running memory and is transported Row.
Specifically, since application thread to be optimized needs to turn again in running memory when being pulled up operation to run, because This, the present embodiment is for example whole from other storages by the application thread to be optimized when reaching the preset thread operation preparation moment It holds and transfers back to running memory on the disk of itself or the external disk installed.And the thread high for running frequency, in the line Even if journey switches to inoperative state, still the internal storage data of its inoperative state is pre-stored in running memory, in this way by It is very high in its switching frequency, when switching back into run mode, so that it may directly using the data being pre-stored in memory headroom, and Program need not be recalled and carry out the movement such as data generation, to improve the speed of service of such thread.Such as thread A is in run mode When internal storage data have 10KB, running frequency is very high, then when the thread is switched to inoperative state, the memory number of this 10KB It according to can not go to recycle, but is still pre-stored in running memory, in this way when thread A reverts to run mode again, so that it may Directly use the data of this 10KB.
Optionally, application thread to be optimized is being gone back in running memory before operation, further includes: according to thread to be optimized History run moment distributed data and time of running when the last operation, predict that thread to be optimized switches to fortune again The switching moment of row state;Determine that thread operation prepares the moment based on switching moment.
Specifically, the operation when history run moment distributed data and last time in the present embodiment based on thread are run At the time of moment predicts that the application thread to be optimized in inoperative state switches to run mode next time, such as transported according to history Row moment distributed data predict the adjacent time interval switched twice be ten minutes, if last time runing time be 13 points 10 minutes, Switch to the next time so predicted run mode time be 13 points 20 minutes.It certainly, in further embodiments can be with It is determined in conjunction with the running frequency of thread, to improve forecasting accuracy.
Determine that the thread operation preparation moment includes: that institute after switching moment preset in advance time interval is true based on switching moment At the time of determining, it is determined as thread operation and prepares the moment.
In practical applications, if just starting to transfer back to thread from other storages at the time of thread switches to run mode Running memory, to will cause the delay of thread operation, is based on this, in this implementation since the process gone back to needs to handle the time In example, a certain moment at the time of thread predicted switches to run mode forward runs as thread prepares the moment, Thread is transferred back into running memory in advance and carries out operation and prepares, to realize the raising of thread state switch speed, continues to hold Connect a citing, switch to the next time predicted run mode time be 13 points 20 minutes, then when 13: 18, The thread deposited of the thread in terminal itself disk can be transferred in running memory in advance, it thus can be at this Just by DSR before the state switching of thread.
The present invention provide it is a kind of using thread processing method, for by application including in the prior art inoperative state thread All threads be stored in the running memory of terminal, caused running memory utilization efficiency is low, using in operational process It is easy the defect of Caton, when terminal is in using operating status, is obtained current all using the thread information of thread;By thread The default optimal conditions of information satisfaction apply thread, are determined as all using to be optimized using thread in thread;To be optimized When being in inoperative state using thread, by the running memory to be optimized for producing terminal using thread;Reach preset thread fortune When row prepares the moment, application thread to be optimized is gone back in running memory and is run.By will be all using to be optimized in thread Running memory is produced in inoperative state using thread, and is gone back in running memory and run when reaching and running and prepare the moment, from Reduce the occupied running memory of thread on the whole, improves the operation fluency and the speed of service of application, improve user Usage experience.
Second embodiment
In order to better understand the present invention, the present embodiment is said with a specific example to using thread processing method Bright, Fig. 4 is the refined flow chart using thread processing method that second embodiment of the invention provides, this applies thread processing method Include:
S401, when terminal is in using operating status, judge created whether be higher than default line using thread total amount Journey amount threshold, if so, S402 is executed, if it is not, then executing S401.
In practical applications, commonly used number of threads is more, can characterize answering of currently being run to a certain extent With quantity it is more or application operation logic it is complex, need to expend the more performance of terminal, therefore, in some embodiments, can It is counted with what is created when being run in real time to application using the total amount of thread, when being more than preset threshold, shows currently have Standby application thread process is necessary, thus triggering following process.
S402, the current running frequency for respectively applying thread is obtained.
S403, running frequency is applied into thread lower than preset operating frequency threshold value, be determined as all using in thread It is to be optimized to apply thread.
If higher using thread running frequency, illustrate that the thread is frequently cut between run mode and inoperative state Change, using operation when it is higher to the degree of dependence of the thread, be then unsuitable in this case it is processed, instead running frequency compared with Low thread, it is lower to its degree of dependence when using operation, inoperative state is in when more, instream factor is relatively It is low, and if place it in running memory the waste that will cause running memory for a long time, therefore the lower thread of running frequency is more It is adapted for handling and realizing running memory and optimize.
S404, when application thread to be optimized is in inoperative state, by it is to be optimized using thread from the running memory of terminal It is transferred to the disk of terminal itself.
It will be in the running memory to be optimized for producing terminal using thread of inoperative state, and will have been vacateed in running memory Space is imitated, and is not dealt with except other threads to be optimized using in addition to thread are whether in run mode, Ke Yiyou Effect improves the speed of service of thread.
S405, according to the history run moment distributed data of thread to be optimized and it is the last run when operation when It carves, predicts that thread to be optimized switches to the switching moment of run mode again.
S406, by the identified moment after switching moment preset in advance time interval, be determined as thread operation and prepare the moment.
S407, reach thread operation prepare the moment when, application thread to be optimized is transferred back into running memory.
Time of running when history run moment distributed data in the present embodiment based on thread and last operation At the time of prediction switches to run mode in the application thread to be optimized of inoperative state next time, and mentioned on the basis of the moment It is preceding that the thread deposited of the thread in terminal itself disk is transferred in running memory, it thus can be in the shape of the thread Just by DSR before state switching, to realize the raising of thread state switch speed.
The present invention provide it is a kind of using thread processing method, when terminal is in using operating status, if current application line Journey total amount is more than preset threshold, then triggers and obtain each running frequency using thread, and is answered running frequency is relatively low It uses thread as to be optimized using thread, and is produced when the application thread to be optimized is in inoperative state from running memory, and It is transferred to terminal itself disk, predicts to cut again at the time of being then based on history run moment distributed data and last time operation At the time of shifting to run mode, and this is gone back in running memory in advance using thread based on the moment and is run, reduced on the whole The occupied running memory of thread, improves the operation fluency and the speed of service of application.
3rd embodiment
In order to better understand the present invention, the present embodiment also with another specific example to application thread processing method into Row explanation, Fig. 5 are the refined flow chart using thread processing method that third embodiment of the invention provides, this applies thread process Method includes:
S501, when terminal is in using operating status, judge whether total memory usage is higher than and preset total EMS memory occupation Rate threshold value, if so, S502 is executed, if it is not, then executing S501.
With a upper embodiment the difference is that being accounted in all application processes to the current running memory of terminal in the present embodiment When meeting larger with higher namely running memory, the application thread process process of triggering following.
S502, the current running frequency and running memory occupancy for respectively applying thread is obtained.
S503, by running frequency lower than preset operating frequency threshold value and running memory occupancy is higher than default memory and accounts for Thread is applied with rate threshold value, is determined as all using to be optimized using thread in thread.
With a upper embodiment the difference is that combining each application thread running frequency and running memory to account in the present embodiment It is to be optimized using thread that determination is integrated with rate, reasonability is higher.
S504, when application thread to be optimized is in inoperative state, by it is to be optimized using thread from the running memory of terminal It is transferred to the disk of terminal itself.
S505, according to the history run moment distributed data of thread to be optimized and it is the last run when operation when It carves, predicts that thread to be optimized switches to the switching moment of run mode again.
S506, by the identified moment after switching moment preset in advance time interval, be determined as thread operation and prepare the moment.
S507, reach thread operation prepare the moment when, application thread to be optimized is transferred back into running memory.
The present invention provides a kind of using thread processing method, when terminal is in using operating status, all answers if current It is more than preset threshold with total memory usage of thread, then triggers to obtain each accounting for using the running frequency and running memory of thread With rate, and running frequency is relatively low, running memory occupancy is relatively high application thread applies thread as to be optimized, And it is produced when the application thread to be optimized is in inoperative state from running memory, and be transferred to terminal itself disk, then base At the time of at the time of history run moment distributed data and last time are run to predict to switch to run mode again, and being based on should This is gone back in running memory using thread run in advance by the moment, is reduced the occupied running memory of thread on the whole, is mentioned The high operation fluency and the speed of service of application.
Fourth embodiment
A kind of terminal is present embodiments provided, it is shown in Figure 6, including processor 601, memory 602, communication bus 603;
Communication bus 603 is for realizing the connection communication between processor 601, memory 602;
Memory 602 is for storing one or more programs, and processor 601 is for executing one stored in memory 602 A or multiple programs, it is no longer superfluous herein to realize the step of applying thread processing method shown in the various embodiments described above It states.
5th embodiment
The present invention also provides a kind of computer readable storage medium, one is stored in the computer readable storage medium Or multiple programs, which can be executed by one or more processor, to realize the various embodiments described above Shown in application thread processing method the step of, details are not described herein.
It should be noted that, in this document, the terms "include", "comprise" or its any other variant are intended to non-row His property includes, so that the process, method, article or the device that include a series of elements not only include those elements, and And further include other elements that are not explicitly listed, or further include for this process, method, article or device institute it is intrinsic Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including being somebody's turn to do There is also other identical elements in the process, method of element, article or device.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side Method can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but in many cases The former is more preferably embodiment.Based on this understanding, technical solution of the present invention substantially in other words does the prior art The part contributed out can be embodied in the form of software products, which is stored in a storage medium In (such as ROM/RAM, magnetic disk, CD), including some instructions are used so that a terminal (can be mobile phone, computer, service Device, air conditioner or network equipment etc.) execute method described in each embodiment of the present invention.
The embodiment of the present invention is described with above attached drawing, but the invention is not limited to above-mentioned specific Embodiment, the above mentioned embodiment is only schematical, rather than restrictive, those skilled in the art Under the inspiration of the present invention, without breaking away from the scope protected by the purposes and claims of the present invention, it can also make very much Form, all of these belong to the protection of the present invention.

Claims (10)

1. a kind of apply thread processing method, which is characterized in that the application thread processing method includes:
When terminal is in using operating status, obtain current all using the thread information of thread;
The default optimal conditions of thread information satisfaction are applied into thread, are determined as described all using to be optimized in thread Using thread;
When the application thread to be optimized is in inoperative state, by the operation to be optimized for producing the terminal using thread Memory;
When reaching the preset thread operation preparation moment, the application thread to be optimized is gone back in the running memory and is transported Row.
2. applying thread processing method as described in claim 1, which is characterized in that current all using the line of thread obtaining Before journey information, further includes:
Judge whether the application operating status meets preset thread process trigger condition;
If so, obtaining current all using the thread information of thread.
3. applying thread processing method as claimed in claim 2, which is characterized in that described to judge that the application operating status is It is no to meet preset thread process trigger condition and comprise at least one of the following:
Judge described using being created whether be higher than default number of threads threshold value using thread total amount under operating status;
Judge whether total memory usage using under operating status is higher than and presets total memory usage threshold value.
4. applying thread processing method as described in claim 1, which is characterized in that the thread information includes: running frequency And/or running memory occupancy;
The optimal conditions include: running frequency lower than preset operating frequency threshold value;And/or memory usage is higher than in default Deposit occupancy threshold.
5. applying thread processing method as described in claim 1, which is characterized in that described to turn the application thread to be optimized The running memory of the terminal includes: out
By the running memory to be optimized for producing the terminal using thread, and be transferred to the terminal itself disk and/ Or the external disk installed.
6. applying thread processing method as described in claim 1, which is characterized in that the inoperative state includes following at least one Kind: suspended state, blocked state.
7. applying thread processing method as described in any one of claims 1 to 6, which is characterized in that will be described to be optimized It is gone back in the running memory using thread before running, further includes:
Time of running when according to the history run moment distributed data of the thread to be optimized and the last operation, prediction The thread to be optimized switches to the switching moment of run mode again;
Determine that the thread operation prepares the moment based on the switching moment.
8. thread processing method the use as claimed in claim 7, which is characterized in that described to determine institute based on the switching moment State thread operation prepare the moment include:
By the identified moment after the switching moment preset in advance time interval, it is determined as the thread operation and prepares the moment.
9. a kind of terminal, which is characterized in that the terminal includes processor, memory, communication bus;
The communication bus is for realizing the connection communication between processor, memory;
The processor is for executing one or more program stored in memory, to realize as appointed in claim 1 to 8 Described in one the step of application thread processing method.
10. a kind of computer readable storage medium, which is characterized in that the computer-readable recording medium storage have one or Multiple programs, one or more of programs can be executed by one or more processor, to realize such as claim 1 to 8 Any one of described in application thread processing method the step of.
CN201811126564.4A 2018-09-26 2018-09-26 A kind of application thread processing method, terminal and computer readable storage medium Pending CN109471716A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811126564.4A CN109471716A (en) 2018-09-26 2018-09-26 A kind of application thread processing method, terminal and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811126564.4A CN109471716A (en) 2018-09-26 2018-09-26 A kind of application thread processing method, terminal and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN109471716A true CN109471716A (en) 2019-03-15

Family

ID=65663303

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811126564.4A Pending CN109471716A (en) 2018-09-26 2018-09-26 A kind of application thread processing method, terminal and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN109471716A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112100017A (en) * 2019-06-17 2020-12-18 腾讯科技(深圳)有限公司 Memory resource monitoring method and device
WO2021254526A1 (en) * 2020-06-16 2021-12-23 深圳Tcl新技术有限公司 Memory operating-frequency adjustment method, smart terminal, and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103914121A (en) * 2013-01-04 2014-07-09 华为技术有限公司 Multicomputer system and method and device for optimizing power consumption of same
CN104850460A (en) * 2015-06-02 2015-08-19 上海斐讯数据通信技术有限公司 Service program thread management method
CN105528366A (en) * 2014-09-30 2016-04-27 阿里巴巴集团控股有限公司 A data synchronization control method and device
CN105930218A (en) * 2016-04-18 2016-09-07 深圳市万普拉斯科技有限公司 Computing resource frequency adjustment method and system
CN107463441A (en) * 2017-06-30 2017-12-12 大唐软件技术股份有限公司 A kind of number of threads control method and equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103914121A (en) * 2013-01-04 2014-07-09 华为技术有限公司 Multicomputer system and method and device for optimizing power consumption of same
CN105528366A (en) * 2014-09-30 2016-04-27 阿里巴巴集团控股有限公司 A data synchronization control method and device
CN104850460A (en) * 2015-06-02 2015-08-19 上海斐讯数据通信技术有限公司 Service program thread management method
CN105930218A (en) * 2016-04-18 2016-09-07 深圳市万普拉斯科技有限公司 Computing resource frequency adjustment method and system
CN107463441A (en) * 2017-06-30 2017-12-12 大唐软件技术股份有限公司 A kind of number of threads control method and equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
罗智华: "数字语音传输系统的软件设计与实现", 《中国优秀硕士学位论文全文数据库信息科技辑(月刊)》 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112100017A (en) * 2019-06-17 2020-12-18 腾讯科技(深圳)有限公司 Memory resource monitoring method and device
CN112100017B (en) * 2019-06-17 2023-07-21 腾讯科技(深圳)有限公司 Memory resource monitoring method and device
WO2021254526A1 (en) * 2020-06-16 2021-12-23 深圳Tcl新技术有限公司 Memory operating-frequency adjustment method, smart terminal, and storage medium

Similar Documents

Publication Publication Date Title
CN110377251A (en) A kind of screen refresh rate method of adjustment, terminal and computer readable storage medium
CN109614176A (en) A kind of application interface layout method, terminal and computer readable storage medium
CN108628430A (en) A kind of game electricity-saving control method, terminal and computer readable storage medium
CN110300435A (en) A kind of communication pattern switching method, terminal and computer readable storage medium
CN109453523A (en) A kind of game picture display processing method, terminal and computer readable storage medium
CN109316743A (en) A kind of game control method, terminal and computer readable storage medium
CN108834157A (en) Internet wide band distribution, mobile terminal and computer readable storage medium
CN107656774A (en) Adaptive regulation method, device, terminal device and the storage medium of systematic parameter
CN109005574A (en) Cell selecting method, mobile terminal and computer readable storage medium
CN109040441A (en) Using display methods of attending to anything else, mobile terminal and computer readable storage medium
CN108965602A (en) Application program display methods, mobile terminal and computer readable storage medium
CN107678698A (en) Data cached method for cleaning, server, terminal and computer-readable recording medium
CN110069333A (en) Backstage management-control method, mobile terminal and the computer readable storage medium of application
CN110198379A (en) Method for controlling mobile terminal, mobile terminal and computer readable storage medium
CN109862184A (en) Terminal and its resource management-control method, computer readable storage medium
CN109889651A (en) A kind of notification message processing method, terminal and computer readable storage medium
CN109379777A (en) A kind of network search method, terminal and computer readable storage medium
CN109471716A (en) A kind of application thread processing method, terminal and computer readable storage medium
CN108958932A (en) A kind of control method of background application, terminal and computer readable storage medium
CN108696909A (en) Based reminding method, terminal and the computer readable storage medium of network connection
CN110099173A (en) Method, terminal and the storage medium of touch experience pattern switching
CN109889660A (en) Temporary information recording method, storage medium and mobile terminal
CN109151201A (en) A kind of Anti-addiction method, mobile terminal and computer storage medium
CN109460338A (en) A kind of application resource control method, terminal and computer readable storage medium
CN109947519A (en) Hardware-accelerated control method, terminal and computer readable storage medium

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: 20190315

RJ01 Rejection of invention patent application after publication