CN103942113B - The detection method of system reboot reason, device and terminal unit - Google Patents
The detection method of system reboot reason, device and terminal unit Download PDFInfo
- Publication number
- CN103942113B CN103942113B CN201310594935.2A CN201310594935A CN103942113B CN 103942113 B CN103942113 B CN 103942113B CN 201310594935 A CN201310594935 A CN 201310594935A CN 103942113 B CN103942113 B CN 103942113B
- Authority
- CN
- China
- Prior art keywords
- thread
- lock
- mutual exclusion
- message
- data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Abstract
The embodiment of the present disclosure discloses a kind of system reboot reason detection method, device and terminal unit, after intelligent terminal is restarted, described system reboot reason detection method is firstly the need of acquisition syslog file, then, search and whether comprise in syslog file to force the process message of ends with system process, when the process message comprising to force ends with system process, the reason obtaining related thread stacks data, and system deadlock led to according to described thread stacks data acquisition;When the reason lead to system deadlock be due to cross-thread interlock when, determine interlocking thread;When holding the lock time for thread when the reason lead to system deadlock and exceeding Preset Time, determine and hold the thread that the lock time exceedes Preset Time.Whether thus can quick detection go out because system deadlock leads to restart after intelligent terminal is restarted, if because system deadlock leads to restart, can quickly determine the thread of deadlock, without research staff's analysis system message one by one, therefore, speed be fast, efficiency high.
Description
Technical field
It relates to field of computer technology, the more particularly to detection method of system reboot reason, device and terminal
Equipment.
Background technology
With the extensive application of intelligent terminal, intelligent terminal manufacturer has the product of oneself characteristic to release,
The intelligent terminal depth of oneself would generally be directed to and customize one's own system (for example, android system).Due to system
The deficiency of understanding systematicly to intelligent terminal for the research staff, coding is lack of standardization so that system resource allocation strategy is improper, leads to
Process (or thread) produces deadlock situation because of competitive resource, and then leads to system frequently to be restarted.But, when intelligent terminal is restarted
Afterwards, system research and development personnel need one by one analysis system message to determine whether to lead to intelligent terminal to be restarted due to deadlock, this kind of mode
Speed is slow, efficiency is low.
Content of the invention
Detection method, device and the terminal unit of system reboot reason is provided, to realize in intelligence in the embodiment of the present disclosure
After energy terminal is restarted, can fast and efficiently detect whether to lead to restart due to system deadlock, if because system deadlock is led
When causing system reboot, can quickly determine the thread leading to system deadlock.
In order to solve above-mentioned technical problem, the embodiment of the present disclosure discloses following technical scheme:
In a first aspect, the disclosure provides a kind of detection method of system reboot reason, including:Obtain syslog file;
Search the process message whether comprising to force ends with system process in described syslog file;When comprising in syslog file
During the process message of pressure ends with system process, obtain thread stacks data, and led to according to described thread stacks data acquisition
The reason system deadlock;When interlocking when the reason lead to system deadlock, determine the thread of interlocking for cross-thread;When leading to system dead
When the reason lock holds the lock time for thread and exceedes Preset Time, determine and hold the thread that the lock time exceedes Preset Time.
In conjunction with a first aspect, in the first possible implementation in first aspect, also including:Search described pressure to terminate
Whether comprise thread name in the process message of system process, when described force ends with system process process message in comprise line
During journey title, the step that execution obtains thread stacks data;When not comprising thread name, determine thread hold the lock time exceed pre-
If the time leads to system deadlock.
In conjunction with first aspect or the first possible implementation of first aspect, in the possible realization of first aspect second
In mode, obtain thread stacks data, and step the reason system deadlock is led to according to described thread stacks data acquisition, adopt
Use following manner:
Obtain first thread corresponding first thread stacked data in described process message;
Search and whether comprise in described first thread stacked data to wait mutual exclusion lock message, described wait mutual exclusion lock message package
Containing the second thread holding the waited mutual exclusion lock of first thread;
When first thread stacked data do not comprise wait mutual exclusion lock message when, determine first thread hold the lock time exceed default
Time leads to system deadlock;
When first thread stacked data exists and waits mutual exclusion lock message, obtain and hold the waited mutual exclusion lock of first thread
The corresponding second thread stacks data of second thread;
Search and whether comprise in described second thread stacks data to wait mutual exclusion lock message;
When the second thread stacks data does not comprise to wait mutual exclusion lock message, determine that the second thread is held lock overlong time and led to
System deadlock;
When the second thread stacks packet contains and waits mutual exclusion lock message, judge whether the second thread is constituted with first thread
Hold lock dependence;
When the second thread and first thread constitute and hold lock dependence, determine and lead to system dead due to cross-thread interlocking
Lock;
When the second thread and first thread do not constitute and hold lock dependence, the waited mutual exclusion lock of the second thread will be held
Thread, as the second new thread, returns execution and obtains second new thread correspondence the second thread stacks data.
In conjunction with the possible implementation of the second of first aspect, in the third possible implementation in first aspect,
Judge whether the second thread and first thread constitute the step holding lock dependence, in the following way:
Judge whether the mutual exclusion lock that first thread is held is the mutual exclusion lock that the second thread is waited;When first thread is held
When mutual exclusion lock is the mutual exclusion lock that the second thread is waited, determine that first thread and the second cross-thread composition hold lock dependence;When
When the mutual exclusion lock that first thread is held is not the mutual exclusion lock that the second thread is waited, determine first thread and the non-structure of the second cross-thread
Cheng Chisuo dependence.
In conjunction with the possible implementation of the second of first aspect, in the 4th kind of possible implementation of first aspect,
Judge whether the second thread and first thread constitute the step holding lock dependence, in the following way:
According to the wait mutual exclusion lock message in the thread stacks data obtaining, build and hold lock dependence diagram data;Judge
Described holding in lock dependence diagram data whether there is loop, if described lock dependence diagram data of holding has loop, determines
Hold lock dependence because each thread on loop is constituted.
The third possible implementation in conjunction with first aspect or the 4th kind of possible implementation of first aspect,
In 5th kind of possible implementation of first aspect, determine the thread that the thread that composition holds lock dependence is interlocking.
Second aspect, the disclosure additionally provides a kind of detection means of system reboot reason, including:
First acquisition unit, for obtaining syslog file;
Whether the first searching unit, for comprising in described syslog file to force the process of ends with system process to disappear
Breath;
Second acquisition unit, for when described syslog file comprise force ends with system process process message when,
The reason obtain thread stacks data, and system deadlock led to according to the thread stacks data acquisition obtaining;
First determining unit, during for interlocking when the reason lead to system deadlock, determines the thread of interlocking for cross-thread;
Second determining unit, when exceeding Preset Time for holding the lock time for thread when the reason lead to system deadlock, really
Surely hold the thread that the lock time exceedes Preset Time.
In conjunction with second aspect, in the first possible implementation in second aspect, also include:
Second searching unit, for search described force ends with system process process message in whether comprise thread name
Claim, when comprising thread name in the described process message forcing ends with system process, triggering second acquisition unit obtains thread
Stacked data;When not comprising thread name, determine that thread is held the lock time and exceeded Preset Time and lead to system deadlock.
In conjunction with second aspect or the first possible implementation of second aspect, in the possible realization of second aspect second
In mode, described second acquisition unit includes:
First acquisition subelement, for obtaining first thread corresponding first thread stacked data in described process message;
Whether the first lookup subelement, comprise in described first thread stacked data to wait mutual exclusion lock message for searching,
Described wait mutual exclusion lock message package contains the second thread holding the waited mutual exclusion lock of first thread;
First determination subelement, for when first thread stacked data does not comprise to wait mutual exclusion lock message, determining first
Thread is held the lock time and is exceeded Preset Time and lead to system deadlock;
Second acquisition subelement, for when first thread stacked data exists and waits mutual exclusion lock message, obtaining and holding the
The corresponding second thread stacks data of second thread of the waited mutual exclusion lock of one thread;
Whether the second lookup subelement, comprise in described second thread stacks data to wait mutual exclusion lock message for searching;
Second determination subelement, for when the second thread stacks data does not comprise to wait mutual exclusion lock message, determining second
Thread is held lock overlong time and is led to system deadlock;
First judgment sub-unit, for when the second thread stacks packet contains and waits mutual exclusion lock message, judging the second line
Whether journey and first thread are constituted is held lock dependence;
3rd determination subelement, for when the second thread and first thread constitute and hold lock dependence, determining due to line
Between journey, interlocking leads to system deadlock;
Thread updating block, for when the second thread and first thread do not constitute and hold lock dependence, holding second
The thread of the waited mutual exclusion lock of thread is as the second new thread, and triggers the second new thread pair of the second acquisition subelement acquisition
The the second thread stacks data answered.
In conjunction with the possible implementation of second aspect second, in the third possible implementation in second aspect, institute
State the first judgment sub-unit to include:
Second judgment sub-unit, for judging whether the mutual exclusion lock that first thread is held is the mutual exclusion that the second thread is waited
Lock;
4th determination subelement, for when the mutual exclusion lock that first thread is held is the mutual exclusion lock that the second thread is waited,
Determine that first thread and the second cross-thread composition hold lock dependence;Or, when the mutual exclusion lock that first thread is held is not second
During the mutual exclusion lock that thread is waited, determine first thread and the second cross-thread does not constitute and holds lock dependence.
In conjunction with the possible implementation of second aspect second, in the 4th kind of possible implementation of second aspect, institute
State the first judgment sub-unit to include:
Construction unit, holds lock dependence pass for according to the wait mutual exclusion lock message in the thread stacks data obtaining, building
It is diagram data;
3rd judgment sub-unit, whether there is loop for holding described in judging in lock dependence diagram data;
5th determination subelement, for when described hold lock dependence diagram data there is loop when, determine each on loop
Individual thread is constituted holds lock dependence.
The third possible implementation or the 4th kind of possible implementation of second aspect in conjunction with second aspect, second
In the 5th kind of possible implementation of aspect, the first determining unit is configured to determine that the thread that composition holds lock dependence is mutual
The thread of lock.
The third aspect, present disclose provides a kind of terminal unit, including memorizer, and one or more than one finger
Order, one of or more than one instruction is stored in memorizer, and is configured to by one or more than one processor
Execution is one or more than one instruction is comprised the instruction for carrying out following operation:
Obtain syslog file;
Search the process message whether comprising to force ends with system process in described syslog file;
When the process message comprising in syslog file to force ends with system process, obtain thread stacks data, and
The reason system deadlock is led to according to described thread stacks data acquisition;
When the reason lead to system deadlock be due to cross-thread interlock when, determine interlocking thread;
When holding the lock time for thread when the reason lead to system deadlock and exceeding Preset Time, determine hold the lock time exceed default
The thread of time.
The beneficial effect of the disclosure can include:After intelligent terminal is restarted, obtain syslog file first, judge institute
State the process message whether comprising to force ends with system process in syslog file, if comprising, determining and being led to due to deadlock
Intelligent terminal is restarted, and determines whether to lead to deadlock due to cross-thread interlocking, or holding lock overlong time due to thread leads to extremely
Lock, if because cross-thread interlocking leads to deadlock, determine the thread of interlocking;If thread holds lock, overlong time leads to deadlock, really
This thread fixed.Thus, after intelligent terminal is restarted, without research staff's analysis system message one by one, can be fast and efficiently true
Make the thread of existing deadlock.
Brief description
For the technical scheme being illustrated more clearly that in the embodiment of the present disclosure, below by use required in embodiment
Accompanying drawing be briefly described it should be apparent that, for those of ordinary skills, do not paying creative labor
Under the premise of, other accompanying drawings can also be obtained according to these accompanying drawings.
Fig. 1 is a kind of schematic diagram of cross-thread interlocked relationship;
Fig. 2 is a kind of schematic flow sheet of the detection method of embodiment of the present disclosure system reboot reason;
Fig. 3 is the schematic flow sheet of step S230 of embodiment illustrated in fig. 2;
Fig. 4 is the schematic flow sheet of the detection method of embodiment of the present disclosure another kind system reboot reason;
Fig. 5 is a kind of schematic flow sheet of the detection method example of disclosure system reboot reason;
Fig. 6 is a kind of structural representation of embodiment of the present disclosure system reboot reason detection means;
Fig. 7 is the structural representation of embodiment of the present disclosure another kind system reboot reason detection means;
Fig. 8 is the structural representation of the second acquisition unit of the embodiment of the present disclosure;
Fig. 9 is a kind of structural representation of terminal unit of the embodiment of the present disclosure.
Specific embodiment
Present disclose provides a kind of system reboot reason detection method, device and terminal unit, after intelligent terminal is restarted,
Whether described system reboot reason detection method, firstly the need of obtaining syslog file, then, searches in syslog file
Comprise to force the process message of ends with system process, when the process message comprising to force ends with system process, obtain correlation
Thread stacks data, and the reason system deadlock is led to according to described thread stacks data acquisition;When leading to the former of system deadlock
Because when interlocking, determine the thread of interlocking due to cross-thread;When the reason lead to system deadlock for thread hold the lock time exceed pre-
If during the time, determine and hold the thread that the lock time exceedes Preset Time.Thus quick detection can go out and be after intelligent terminal is restarted
No lead to restart due to system deadlock, if because system deadlock leads to restart, can quickly determine the thread of deadlock, need not grind
Send out personnel's analysis system message one by one, therefore, speed is fast, efficiency high.
It is more than the core concept of the disclosure, in order that those skilled in the art more fully understand disclosure scheme, below
By with reference to the accompanying drawing in the embodiment of the present disclosure, the technical scheme in the embodiment of the present disclosure is clearly and completely described, shows
So, the embodiment of described description is only a part of embodiment of the disclosure, rather than whole embodiments.Based on the reality in the disclosure
Apply example, the every other embodiment that those of ordinary skill in the art are obtained under the premise of not making creative work, all belong to
Scope in disclosure protection.
Before embodiment of the disclosure is discussed in detail, introduce the related content of lower system deadlock first.
System deadlock (deadlock) refers to two or more processes in the process of implementation, because contention resource causes
The phenomenon waiting mutually, without external force effect, they all will be unable to continue executing with, and now claims system to be in deadlock state.
Due to the resource-constrained in intelligent terminal, therefore resource occupation has alternative, that is, when certain process (thread) accounts for
With after resource so that other processes (thread) under the assistance of no external force it is impossible to getting this resource and cannot continuing to run with.?
In multi-process (thread) application, generally using mutual exclusion lock, the shared resource in system is protected.When a process (thread)
When request takies shared resource, obtain the mutual exclusion lock of this resource first, could be taken this after obtaining corresponding mutual exclusion lock and share
Resource, finally discharges described mutual exclusion lock, so that other processes (thread) obtain and then take described shared resource.If resource
Allocation strategy improper it would be possible to mutual exclusion lock occur by the indefinite occupancy of certain process (thread), lead to other processes (thread)
Shared resource cannot be used, finally cause process (thread) deadlock.
Refer to Fig. 1, show a kind of schematic diagram of cross-thread interlocked relationship, have multiple parallel runnings in same process
Thread.
Assume in android system, thread 1, thread 2 and thread 3 parallel running in system_server process,
Wherein, thread 1 holds mutual exclusion lock A wait mutual exclusion lock B, and thread 2 is held mutual exclusion lock B and waited mutual exclusion lock C, and meanwhile, thread 3 is held mutually
Lock C is scolded to wait mutual exclusion lock A.And, after each thread will obtain the mutual exclusion lock of wait, just discharge that other threads are waited is mutual
Scold lock, that is, thread 1 just discharges mutual exclusion lock A and thread 2 just discharges mutual exclusion lock B after obtaining mutual exclusion lock C after obtaining mutual exclusion lock B,
Thread 3 just discharges mutual exclusion lock C after obtaining mutual exclusion lock A, the mutual exclusion lock that now thread 1, thread 2, thread 3 all cannot wait,
And can wait always and stay, thus cause thread deadlock.Now, the WatchDog program in android system will be forced
(killing) the system_server process of end, ultimately results in android system and restarts.
Refer to Fig. 2, show a kind of schematic flow sheet of the detection method of embodiment of the present disclosure system reboot reason, should
Method is applied to terminal unit, as shown in Fig. 2 methods described may comprise steps of:
First, in step S210, obtain syslog file.Described syslog file is record system Action Events
Log file or file set.
Then, in step S220, search and whether comprise in described syslog file to force the process of ends with system process
Message, if comprise in syslog file to force the process message of ends with system process, execution step S230;If system journal is civilian
Do not comprise in part to force the process message of ends with system process to lead to system reboot it is determined that being not due to system deadlock, and then
Terminate.
When operating system is android system, whether wrapped by searching in the syslog file in android system
Contain " Watchdog killing system process:The process message of thread1 ", wherein, " thread1 " represents thread
Title.If comprising described process message in syslog file, show that android system there occurs deadlock.If do not comprised
Similar information, shows that android system does not occur deadlock.Art technology is it is understood that in other operating systems
In, can be the process message of the pressure ends with system process of other forms.
Then, in step S230, obtain thread stacks data, and system is led to according to described thread stacks data acquisition
The reason deadlock.
This step obtains the thread stacks data with the related linear program of process message forcing ends with system process, described phase
Close thread include described force ends with system process the corresponding thread of the thread name entrained by process message and with described line
The thread that journey title corresponding thread stacks data is directly or indirectly associated.Follow up further acquisition thread stacks data true
Surely the reason lead to system deadlock.
In step S240, when interlocking when the reason lead to system deadlock, determine the thread of interlocking for cross-thread.
In step S250, when holding the lock time for thread when the reason lead to system deadlock and exceeding Preset Time, determine and hold lock
Time exceedes the thread of Preset Time.
The detection method of the system reboot reason that the present embodiment provides, after system reboot, obtains system journal literary composition first
Part, by judging the process message whether comprising in syslog file to force ends with system process, it is determined whether be that system is dead
Lock leads to system reboot;If comprising in syslog file to force the process message of ends with system process, show due to being
System deadlock leads to system reboot, then, obtains the thread stacks data of related linear program, so that it is determined that leading to the former of system deadlock
Cause, and then determine the thread leading to system deadlock.From above-mentioned detection process, system can automatic detection go out whether due to
System deadlock leads to system reboot, and then when system deadlock leads to system reboot, is capable of determining that the line leading to system deadlock
Journey, without research staff's analysis system message one by one, therefore, detection speed is fast, efficiency high.
In an embodiment of the disclosure, as shown in figure 3, step S230 in above-described embodiment can include following walking
Suddenly:
First, in step S310, obtain the corresponding First Line of first thread in the process message forcing ends with system process
Journey stacked data.Described first thread be force ends with system process process message included in thread name, this step from
Described First Line is obtained in application error message feedback file (for example, the traces.txt file in android system)
Journey corresponding first thread stacked data.
Next, in step S320, searching and whether comprise in described first thread stacked data to wait mutual exclusion lock message;Institute
State and wait mutual exclusion lock message package to contain the second thread holding the waited mutual exclusion lock of first thread.
For example, in android system, search in first thread stacked data whether comprise " waiting**held by
The similar message of tid=* ", wherein, " * * " represents the title of the mutual exclusion lock that first thread is waited, and " * " represents and hold mutual exclusion lock
The thread number of " * * ", if there is similar message, then shows to comprise in first thread stacked data to wait mutual exclusion lock message;If
There is not similar message, then show not comprising in first thread stacked data to wait mutual exclusion lock message.
When first thread stacked data does not comprise to wait mutual exclusion lock message, execution step S330, determine that first thread is held
The lock time exceedes Preset Time and leads to system deadlock;That is, first thread execute certain versus time and exceed Preset Time lead to be
System deadlock.
When first thread stacked data exists and waits mutual exclusion lock message, execution step S340, obtain the second thread and correspond to
The second thread stacks data.
It is assumed that the wait mutual exclusion lock message comprising in first thread stacked data is " waiting A held by tid=
2 ", thread lock A that this wait mutual exclusion lock message sign first thread waits by thread number, held by the thread " thread2 " by 2,
Then thread " thread2 " is the second thread in this step.Obtain the corresponding second thread stacks data of the second thread.
Then, in step S350, search and whether comprise in described second thread stacks data to wait mutual exclusion lock message.This step
Rapid search procedure is identical with the search procedure of step S320, and here is omitted.
When the second thread stacks data does not comprise to wait mutual exclusion lock message, in step S360, determine that the second thread holds lock
Overlong time leads to system deadlock;Lead to system deadlock because the second thread executes certain versus time and exceedes Preset Time.
When the second thread stacks packet contains and waits mutual exclusion lock message, in step S370, judge the second thread and first
Whether thread is constituted is held lock dependence.
In an embodiment of the disclosure, judge whether the second thread and first thread constitute the mistake holding lock dependence
Journey can include following sub-step:
First, it is determined that the mutual exclusion lock that the second the thread whether mutual exclusion lock that first thread is held is up-to-date is waited.
When the mutual exclusion lock that the second thread that the mutual exclusion lock that first thread is held is up-to-date is waited, determine first thread and
The second whole cross-threads is constituted holds lock dependence.
When the mutual exclusion lock that the second thread that the mutual exclusion lock that first thread is held is not up-to-date is waited, determine first thread
Do not constitute with the second whole cross-threads and hold lock dependence.
In another embodiment of the disclosure, judge whether the second thread and first thread are constituted and hold lock dependence
Process can include following sub-step:
First, according to the wait mutual exclusion lock message in the thread stacks data obtaining, build and hold lock dependence diagram data.
When lock dependence diagram data held by structure, with thread as node, connected with directed line segment and there is mutual exclusion lock wait
The thread of relation, and the thread of request mutual exclusion lock is pointed in the direction of directed line segment, thus generate holding lock dependence diagram data.
Then, hold described in judgement in lock dependence diagram data and whether there is loop, if described hold lock dependence graph
There is loop in data, determine and hold lock dependence because each thread on loop is constituted.
It is tracked with holding each node in lock dependence diagram data for starting point along the direction of directed line segment successively, with
Inquiry whether there is loop, if there is loop it is determined that lock dependence is held in each cross-thread presence being on loop.
If step S370 judges that the second thread and first thread are constituted holds lock dependence, in step S380, determine by
Lead to system deadlock in cross-thread interlocking.
If step S370 judges that the second thread and first thread are not constituted holds lock dependence, in step S390, will hold
The thread having the waited mutual exclusion lock of the second thread, as the second new thread, returns execution step S340 and obtains the second new thread
Corresponding second thread stacks data, until judging to constitute the thread holding lock dependence, or, determine that certain thread holds lock
Time exceedes Preset Time.
Refer to Fig. 4, show the schematic flow sheet of the detection method of embodiment of the present disclosure another kind system reboot reason,
On the basis of the corresponding embodiment of Fig. 2, increase and search in the process message forcing ends with system process whether comprise thread name
The process claiming, as shown in figure 4, methods described may comprise steps of:
First, in step S210, obtain syslog file.
Then, in step S220, search and whether comprise in described syslog file to force the process of ends with system process
Message, if comprise in syslog file to force the process message of ends with system process, execution step S260;If system journal is civilian
Do not comprise in part to force the process message of ends with system process to lead to system reboot it is determined that being not due to system deadlock, and then
Terminate.
Then, in step S260, in the process message searching described pressure ends with system process, whether comprise thread name;
When comprising thread name, execution step S230;When not comprising thread name (i.e. thread name is Null), show due to being
System thread (in android system, described system thread be ServerThread) is held the lock time and is exceeded Preset Time and lead to system
Deadlock;I.e. system thread executes certain versus time and exceedes Preset Time and leads to system deadlock.
In step S230, obtain corresponding thread stacks data, and system is led to according to described thread stacks data acquisition
The reason deadlock.
In step S240, when interlocking when the reason lead to system deadlock, determine the thread of interlocking for cross-thread.
In step S250, when holding the lock time for thread when the reason lead to system deadlock and exceeding Preset Time, determine and hold lock
Time exceedes the thread of Preset Time.
The detection method of the system reboot reason that the present embodiment provides, comprises to force knot in finding syslog file
After the process message of beam system process, further search for whether comprising thread name in described process message, if not comprising thread
Title is it is determined that system thread executes certain versus time exceedes Preset Time and lead to system deadlock;If wrapping thread name, then
Obtain the thread stacks data of the corresponding thread of described thread name further, and then determine the thread leading to system deadlock, that is, only
Have and force the process message of ends with system process to meet during certain condition just acquisition thread stacks data, save system resource.
The detection method of system reboot reason is described below, as shown in figure 5, methods described is with permissible with an instantiation
Comprise the following steps:
After system reboot, in step S510, obtain syslog file.
Then, in step S520, search and whether comprise in described syslog file to force the process of ends with system process
Message;
When the process message comprising in syslog file to force ends with system process, execution step S530;Work as system
Do not comprise in journal file during the process message forcing ends with system process it is determined that not being that system deadlock leads to system reboot,
And then terminate.
In step S530, search in the process message forcing ends with system process whether comprise thread name;Assume described
Process message is " Watchdog killing system process:Thread1 ", the thread name being comprised is
" Thread1 ", then execution step S540;
In step S540, obtain the corresponding thread stacks data of thread " Thread1 ".
If do not comprise thread name (i.e. thread name is Null) in described process message, in step S550, determine
System thread is held the lock time and is exceeded Preset Time and lead to deadlock, when that is, system thread executes time of certain function and exceedes default
Between lead to system deadlock.For example, in android system, ServerThread thread execute certain function time exceed pre-
If the time leads to android system deadlock.
After obtaining the thread stacks data of thread " Thread1 ", in step S560, search the thread stacks of " Thread1 "
Whether comprise in data to wait mutual exclusion lock message.
If not comprising in the thread stacks data of " Thread1 " to wait mutual exclusion lock message, in step S570, determine thread
" Thread1 " executes certain versus time and exceedes Preset Time and lead to system deadlock.
Assume to wait mutual exclusion lock message:" waiting A held by tid=2 ", this message table open-wire line journey " Thread1 "
Mutual exclusion lock A waiting by thread number, held by the thread by 2, then in step S580, obtain the thread stacks number of " Thread2 "
According to.
After obtaining the thread stacks data of " Thread2 ", in step S590, search the thread stacks number of " Thread2 "
According in whether comprise wait mutual exclusion lock message.
If not comprising in the thread stacks data of " Thread2 " to wait mutual exclusion lock message, in step S5100, determine line
Journey " Thread2 " executes certain versus time and exceedes Preset Time and leads to system deadlock.
If comprising in the thread stacks data of " Thread2 " to wait mutual exclusion lock message, in step S5110, judge thread
Whether " Thread2 " and thread " Thread1 " are constituted is held lock dependence;
Assume described wait mutual exclusion lock message:" waiting B held by tid=3 ", shows thread " Thread2 " institute
Mutual exclusion lock B waiting by thread number, held by the thread " Thread3 " by 3, and mutual exclusion lock B that thread " Thread2 " is waited is simultaneously
Non- held by thread " Thread1 ", therefore, thread " Thread2 " and thread " Thread1 " are not constituted holds lock dependence.
After judging that thread " Thread2 " and thread " Thread1 " do not constitute and hold lock dependence, in step S5130, will
" Thread2 " is updated to " Thread3 ";Wherein, thread " Thread3 " holds the mutual exclusion lock that thread " Thread2 " waits.
Then, return execution step S580, obtain the thread stacks data of thread " Thread3 ".And then, in step
Whether S590, comprise in the thread stacks data searching thread " Thread3 " to wait mutual exclusion lock message.
If not comprising in the thread stacks data of " Thread3 " to wait mutual exclusion lock message, in step S5100, determine line
Journey " Thread3 " executes certain versus time and exceedes Preset Time and leads to system deadlock.
If comprising in the thread stacks data of " Thread3 " to wait mutual exclusion lock message:“waiting C held by tid
=1 ", show that held by the thread " Thread1 " by 1 by thread number for mutual exclusion lock C that thread " Thread3 " waited, therefore,
Step S5110, judges that thread " Thread3 " is constituted with thread " Thread1 " and holds lock dependence.
In step S5120, determine that cross-thread interlocking leads to system deadlock, and determine the thread of interlocking.Thread
" Thread1 ", " Thread2 " and " Thread3 " is the thread of interlocking.Thread " Thread1 ", " Thread2 " and " Thread3 "
Hold lock dependence identical with the relation schematic diagram shown in Fig. 1.
Corresponding with the detection method embodiment of the system reboot reason of the disclosure, it is former that the disclosure additionally provides system reboot
The detection means embodiment of cause.
Refer to Fig. 6, show a kind of structural representation of the detection means of embodiment of the present disclosure system reboot reason, institute
State device can include:First acquisition unit 100, the first searching unit 200, second acquisition unit 300, the first determining unit
400 and second determining unit 500, wherein:
First acquisition unit 100, for obtaining syslog file.
Whether the first searching unit 200, for comprising in described syslog file to force the process of ends with system process
Message.In android system, the process message forcing ends with system process is " Watchdog killing system
process:The similar message of thread1 ".
Second acquisition unit 300, for disappearing when the process comprising pressure ends with system process in described syslog file
During breath, the reason obtaining corresponding thread stacks data, and system deadlock led to according to the thread stacks data acquisition obtaining.
First determining unit 400, during for interlocking when the reason lead to system deadlock, determines the line of interlocking for cross-thread
Journey.
Second determining unit 500, when exceeding Preset Time for holding the lock time for thread when the reason lead to system deadlock,
Determine and hold the thread that the lock time exceedes Preset Time.
The detection means of the system reboot reason that the present embodiment provides, after system reboot, can be according to system journal literary composition
Part judges whether to lead to system reboot due to system deadlock, if system reboot reason is system deadlock, is further able to really
Surely lead to the thread of system deadlock, without research staff's analysis system message one by one, therefore, detection speed is fast, efficiency high.
Refer to Fig. 7, show the structural representation of the detection means of embodiment of the present disclosure another kind system reboot reason
Figure, on the basis of device shown in Fig. 6 for this device, increased the second searching unit 600.The device bag that the present embodiment provides
Include:First acquisition unit 100, the first searching unit 200, second acquisition unit 300, the first determining unit 400, second determine single
Unit 500 and the second searching unit 600.
Wherein, title, numbering and the embodiment identical unit shown in Fig. 6 in the present embodiment, its function is also identical, herein
Repeat no more, highlight the second searching unit 600 below.
Second searching unit 600 is connected between the first searching unit 200 and second acquisition unit 300.Second searches list
Unit is used for whether comprising thread name, when described pressure ends with system in the process message search described pressure ends with system process
When comprising thread name in the process message of process, triggering second acquisition unit 300 obtains thread stacks data;When not comprising line
During journey title, determine that thread is held the lock time and exceeded Preset Time and lead to system deadlock.
The detection means of the system reboot reason that the present embodiment provides, comprises to force knot in finding syslog file
After the process message of beam system process, further search for whether comprising thread name in described process message, if not comprising thread
Title is it is determined that system thread executes certain versus time exceedes Preset Time and lead to system deadlock;If wrapping thread name, then
Obtain the thread stacks data of the corresponding thread of described thread name further, and then determine the thread leading to system deadlock, that is, only
Have and force the process message of ends with system process to meet during certain condition just acquisition thread stacks data, save system resource.
Shown in Figure 8, show the structural representation of the second acquisition unit that the embodiment of the present disclosure provides, described the
Two acquiring units can include:First obtains subelement 310, first searches subelement 320, the first determination subelement 330, second
Obtain subelement 340, second and search subelement 350, the second determination subelement 360, the first judgment sub-unit the 370, the 3rd determination
Subelement 380 and thread updating block 390.
First acquisition subelement 310, for obtaining first thread corresponding first thread storehouse number in described process message
According to.Described first thread is by forcing the corresponding thread of thread name that the process message of ends with system process is comprised.
Whether the first lookup subelement 320, comprise in described first thread stacked data to wait mutual exclusion lock to disappear for searching
Breath;Described wait mutual exclusion lock message package contains the second thread holding the waited mutual exclusion lock of first thread.
First determination subelement 330, for when first thread stacked data does not comprise to wait mutual exclusion lock message, determining the
One thread is held the lock time and is exceeded Preset Time and lead to system deadlock.
Second acquisition subelement 340, for when first thread stacked data exists and waits mutual exclusion lock message, acquisition is held
The corresponding second thread stacks data of second thread of the waited mutual exclusion lock of first thread.
Whether the second lookup subelement 350, comprise in described second thread stacks data to wait mutual exclusion lock to disappear for searching
Breath.
Second determination subelement 360, for when the second thread stacks data does not comprise to wait mutual exclusion lock message, determining the
Two threads are held lock overlong time and are led to system deadlock.
First judgment sub-unit 370, for when the second thread stacks packet contains and waits mutual exclusion lock message, judging second
Whether thread and first thread are constituted is held lock dependence.
In a possible embodiment of the disclosure, described first judgment sub-unit can include:Second judges that son is single
Unit and the 4th determination subelement, wherein:
Second judgment sub-unit, for judging whether the mutual exclusion lock that first thread is held is the mutual exclusion that the second thread is waited
Lock.
4th determination subelement, for when the mutual exclusion lock that first thread is held is the mutual exclusion lock that the second thread is waited,
Determine that first thread and the second cross-thread composition hold lock dependence;Or, when the mutual exclusion lock that first thread is held is not second
During the mutual exclusion lock that thread is waited, determine first thread and the second cross-thread does not constitute and holds lock dependence.
In another possible embodiment of the disclosure, described first judgment sub-unit can include:Construction unit,
Three judgment sub-unit and the 5th determination subelement, wherein:
Construction unit, holds lock dependence pass for according to the wait mutual exclusion lock message in the thread stacks data obtaining, building
It is diagram data.
3rd judgment sub-unit, whether there is loop for holding described in judging in lock dependence diagram data.
5th determination subelement, for when described hold lock dependence diagram data there is loop when, determine each on loop
Individual thread is constituted holds lock dependence.
3rd determination subelement 380 is connected with the first judgment sub-unit 370, for constituting with first thread when the second thread
When holding lock dependence, determine and system deadlock is led to due to cross-thread interlocking.And then by the corresponding embodiment of Fig. 6 or Fig. 7
First determining unit determines the thread that the thread that composition holds lock dependence is interlocking.
Thread updating block 390 is connected to the first judgment sub-unit 370 and second and obtains between subelement 340, for working as
Second thread and first thread are not constituted when holding lock dependence, using the thread holding the waited mutual exclusion lock of the second thread as new
The second thread, and trigger the second acquisition subelement and obtain the new corresponding second thread stacks data of the second thread.
The detection method of the system reboot reason providing with respect to above-described embodiment and device, the disclosure additionally provides terminal
Equipment.
Refer to Fig. 9, show it relates to terminal unit structural representation, this terminal unit can be used for reality
Apply the detection method of the system reboot reason providing in above-described embodiment, specifically:
Terminal unit can include RF (Radio Frequency, radio frequency) circuit 110, include one or more
The memorizer 120 of computer-readable recording medium, input block 130, display unit 140, sensor 150, voicefrequency circuit 160,
The parts such as WiFi module 170, the processor 180 including or more than one processing core and power supply 190.Ability
Field technique personnel are appreciated that the terminal unit structure shown in Fig. 9 does not constitute the restriction to terminal unit, can include comparing
Illustrate more or less of part, or combine some parts, or different part arrangements.Wherein:
RF circuit 110 can be used for receiving and sending messages or communication process in, the reception of signal and transmission, especially, by base station
After downlink information receives, transfer to one or more than one processor 180 is processed;In addition, by be related to up data is activation to
Base station.Generally, RF circuit 110 includes but is not limited to antenna, at least one amplifier, tuner, one or more agitator, use
Family identity module (SIM) card, transceiver, bonder, LNA (Low Noise Amplifier, low-noise amplifier), duplex
Device etc..Additionally, RF circuit 110 can also be communicated with network and other equipment by radio communication.This radio communication can use
Arbitrary communication standard or agreement, including but not limited to GSM (Global System of Mobile communication, the whole world
Mobile communcations system), GPRS (General Packet Radio Service, general packet radio service), CDMA (Code
Division Multiple Access, CDMA), WCDMA (Wideband Code Division Multiple
Access, WCDMA), LTE (Long Term Evolution, Long Term Evolution), Email, SMS (Short
Messaging Service, Short Message Service) etc..
Memorizer 120 can be used for storing software program and module, and processor 180 is stored in memorizer 120 by operation
Software program and module, thus executing various function application and data processing.Memorizer 120 can mainly include storing journey
Sequence area and storage data field, wherein, storing program area can (compare the application program needed for storage program area, at least one function
As sound-playing function, image player function etc.) etc.;Storage data field can store according to terminal unit using the number being created
According to (such as voice data, phone directory etc.) etc..Additionally, memorizer 120 can include high-speed random access memory, can also wrap
Include nonvolatile memory, for example, at least one disk memory, flush memory device or other volatile solid-state parts.
Correspondingly, memorizer 120 can also include Memory Controller, to provide processor 180 and input block 130 to memorizer
120 access.
Input block 130 can be used for numeral or the character information of receives input, and produces and user setup and function
Control relevant keyboard, mouse, action bars, optics or trace ball signal input.Specifically, input block 130 can include
Touch sensitive surface 131 and other input equipments 132.Touch sensitive surface 131, also referred to as touch display screen or Trackpad, can collect
User thereon or neighbouring touch operation (such as user uses any suitable object such as finger, stylus or adnexa touch-sensitive
Operation on surface 131 or near Touch sensitive surface 131), and corresponding attachment means are driven according to formula set in advance.Can
Choosing, Touch sensitive surface 131 may include touch detecting apparatus and two parts of touch controller.Wherein, touch detecting apparatus detection
The touch orientation of user, and detect the signal that touch operation brings, transmit a signal to touch controller;Touch controller is from tactile
Touch reception touch information in detection means, and be converted into contact coordinate, then give processor 180, and can receiving processor
180 orders sent simultaneously are executed.Furthermore, it is possible to using multiple types such as resistance-type, condenser type, infrared ray and surface acoustic waves
Touch sensitive surface 131 realized by type.Except Touch sensitive surface 131, input block 130 can also include other input equipments 132.Specifically
Ground, other input equipments 132 can include but is not limited to physical keyboard, function key (such as volume control button, switch key
Deng), trace ball, mouse, one or more of action bars etc..
Display unit 140 can be used for showing by the information of user input or is supplied to the information of user and terminal unit
Various graphical user interface, these graphical user interface can be made up of figure, text, icon, video and its combination in any.
Display unit 140 may include display floater 141, optionally, can adopt LCD (Liquid Crystal Display, liquid crystal
Show device), the form such as OLED (Organic Light-Emitting Diode, Organic Light Emitting Diode) to be configuring display floater
141.Further, Touch sensitive surface 131 can cover display floater 141, when Touch sensitive surface 131 detects thereon or neighbouring touches
After touching operation, send processor 180 to determine the type of touch event, with preprocessor 180 according to the type of touch event
Corresponding visual output is provided on display floater 141.Although in fig .9, Touch sensitive surface 131 and display floater 141 are conducts
Two independent parts realizing input and input function, but in some embodiments it is possible to by Touch sensitive surface 131 and display
Panel 141 integrated and realize input and output function.
Terminal unit may also include at least one sensor 150, such as optical sensor, motion sensor and other sensings
Device.Specifically, optical sensor may include ambient light sensor and proximity transducer, and wherein, ambient light sensor can be according to environment
Adjusting the brightness of display floater 141, proximity transducer can cut out display when terminal unit moves in one's ear to the light and shade of light
Panel 141 and/or backlight.As one kind of motion sensor, Gravity accelerometer can detect in all directions (generally
Three axles) acceleration size, can detect that size and the direction of gravity when static, can be used for identify mobile phone attitude application (ratio
As horizontal/vertical screen switching, dependent game, magnetometer pose calibrating), Vibration identification correlation function (such as pedometer, tap) etc.;Extremely
The other sensors such as the gyroscope that can also configure in terminal unit, barometer, drimeter, thermometer, infrared ray sensor, here
Repeat no more.
Voicefrequency circuit 160, speaker 161, microphone 162 can provide the audio interface between user and terminal unit.Sound
The signal of telecommunication after the voice data receiving conversion can be transferred to speaker 161, is converted to by speaker 161 by frequency circuit 160
Acoustical signal exports;On the other hand, the acoustical signal of collection is converted to the signal of telecommunication by microphone 162, is received by voicefrequency circuit 160
After be converted to voice data, then after voice data output processor 180 is processed, such as another to be sent to through RF circuit 110
Terminal unit, or voice data is exported to memorizer 120 to process further.Voicefrequency circuit 160 is also possible that ear
Tip jack, to provide the communication of peripheral hardware earphone and terminal unit.
WiFi belongs to short range wireless transmission technology, and terminal unit can help user's transmitting-receiving electricity by WiFi module 170
Sub- mail, browse webpage and access streaming video etc., it has provided the user wireless broadband internet and has accessed.Although Fig. 9 shows
Go out WiFi module 170, but it is understood that, it is simultaneously not belonging to must be configured into of terminal unit, completely can be according to need
To omit in the scope of essence not changing invention.
Processor 180 is the control centre of terminal unit, using each portion of various interfaces and connection whole mobile phone
Point, it is stored in software program and/or module in memorizer 120 by running or executing, and call and be stored in memorizer 120
Interior data, the various functions of execution terminal unit and processing data, thus carry out integral monitoring to mobile phone.Optionally, process
Device 180 may include one or more processing cores;Preferably, processor 180 can integrated application processor and modulation /demodulation process
Device, wherein, application processor mainly processes operating system, user interface and application program etc., and modem processor is mainly located
Reason radio communication.It is understood that above-mentioned modem processor can not also be integrated in processor 180.
Terminal unit also includes the power supply 190 (such as battery) powered to all parts it is preferred that power supply can be by electricity
Management system is logically contiguous with processor 180, thus realizing management charging, electric discharge and power consumption by power-supply management system
The functions such as management.Power supply 190 can also include one or more direct current or alternating current power supply, recharging system, power supply event
Barrier testing circuit, power supply changeover device or the random component such as inverter, power supply status indicator.
Although not shown, terminal unit can also include photographic head, bluetooth module etc., will not be described here.In this enforcement
In example, the touch-screen display during display unit of terminal unit.
Described terminal unit also includes one or more than one instruction (instruction or program), and wherein one
Individual or more than one instruction is stored in memorizer, and is configured to one described in one or more than one computing device
Individual or more than one instruction is comprised the instruction for carrying out following operation:
Obtain syslog file;
Search the process message whether comprising to force ends with system process in described syslog file;
When the process message comprising in syslog file to force ends with system process, obtain thread stacks data, and
The reason system deadlock is led to according to described thread stacks data acquisition;
When the reason lead to system deadlock be due to cross-thread interlock when, determine interlocking thread;
When holding the lock time for thread when the reason lead to system deadlock and exceeding Preset Time, determine hold the lock time exceed default
The thread of time.
It is preferred that the instruction that one or more than one instruction also includes for carrying out following operation:
Whether comprise thread name in the process message searching described pressure ends with system process, force to terminate system when described
When comprising thread name in the process message of system process, the step that execution obtains thread stacks data;When not comprising thread name
When, determine that thread is held the lock time and exceeded Preset Time and lead to system deadlock.
It is preferred that the instruction that one or more than one instruction also includes for carrying out following operation:
Obtain first thread corresponding first thread stacked data in process message;
Search and whether comprise in described first thread stacked data to wait mutual exclusion lock message, described wait mutual exclusion lock message package
Containing the second thread holding the waited mutual exclusion lock of first thread;
When first thread stacked data do not comprise wait mutual exclusion lock message when, determine first thread hold the lock time exceed default
Time leads to system deadlock;
When first thread stacked data exists and waits mutual exclusion lock message, obtain and hold the waited mutual exclusion lock of first thread
The corresponding second thread stacks data of second thread;
Search and whether comprise in described second thread stacks data to wait mutual exclusion lock message;
When the second thread stacks data does not comprise to wait mutual exclusion lock message, determine that the second thread is held lock overlong time and led to
System deadlock;
When the second thread stacks packet contains and waits mutual exclusion lock message, judge whether the second thread is constituted with first thread
Hold lock dependence;
When the second thread and first thread constitute and hold lock dependence, determine and lead to system dead due to cross-thread interlocking
Lock;
When the second thread and first thread do not constitute and hold lock dependence, the waited mutual exclusion lock of the second thread will be held
Thread, as the second new thread, returns execution and obtains second new thread correspondence the second thread stacks data.
In a possible embodiment of the disclosure, one or more than one instruction also include for carry out with
The instruction of lower operation:
Judge whether the mutual exclusion lock that first thread is held is the mutual exclusion lock that the second thread is waited;
When the mutual exclusion lock that first thread is held is the mutual exclusion lock that the second thread is waited, determine first thread and the second line
Constitute between journey and hold lock dependence;And determine the thread that the thread that composition holds lock dependence is interlocking.
When the mutual exclusion lock that first thread is held is not the mutual exclusion lock that the second thread is waited, determine first thread and second
Cross-thread is not constituted holds lock dependence.
In another possible embodiment of the disclosure, one or more than one instruction is also included for carrying out
The instruction below operating:
According to the wait mutual exclusion lock message in the thread stacks data obtaining, build and hold lock dependence diagram data;
Hold described in judgement in lock dependence diagram data and whether there is loop, if described lock dependence diagram data of holding is deposited
In loop, determine and hold lock dependence because each thread on loop is constituted.And determine that composition holds the thread of lock dependence
Thread for interlocking.
The disclosure also provides a kind of computer-readable recording medium, and this computer-readable recording medium can be above-mentioned enforcement
The computer-readable recording medium included in memorizer in example;Can also be individualism, without the meter allocated in terminal
Calculation machine readable storage medium storing program for executing.Described computer-readable recording medium storage have one or more than one instruction, one or
More than one instruction of person is used for executing Fig. 2 by one or more than one processor, Fig. 3, Fig. 4, embodiment illustrated in fig. 5 carry
For system reboot reason detection method.
Those skilled in the art can be understood that technology in the embodiment of the present disclosure can be by software plus required
General hardware platform mode realizing.Based on such understanding, the technical scheme in the embodiment of the present disclosure substantially or
Say that what prior art was contributed partly can be embodied in the form of software product, this computer software product can be deposited
In storage medium, such as ROM/RAM, magnetic disc, CD etc., including some instructions with so that a computer equipment is (permissible for storage
Be personal computer, server, or the network equipment etc.) execution each embodiment of the disclosure or embodiment some part institutes
The method stated.
Each embodiment in this specification is all described by the way of going forward one by one, identical similar portion between each embodiment
Divide mutually referring to what each embodiment stressed is the difference with other embodiment.Real especially for system
For applying example, because it is substantially similar to embodiment of the method, so description is fairly simple, referring to embodiment of the method in place of correlation
Part illustrate.
Above-described disclosure embodiment, does not constitute the restriction to disclosure protection domain.Any in the disclosure
Spirit and principle within modification, equivalent and improvement of being made etc., should be included within the protection domain of the disclosure.
Claims (11)
1. a kind of detection method of system reboot reason is it is characterised in that include:
Obtain syslog file;
Search the process message whether comprising to force ends with system process in described syslog file;
When the process message comprising in syslog file to force ends with system process, obtain thread stacks data, and according to
The reason described thread stacks data acquisition leads to system deadlock;
When interlocking when the reason lead to system deadlock, determine the thread of interlocking for cross-thread;
When holding the lock time for thread when the reason lead to system deadlock and exceeding Preset Time, determine that holding the lock time exceedes Preset Time
Thread;
Wherein, the step of the reason obtain thread stacks data, and system deadlock is led to according to described thread stacks data acquisition,
In the following way:
Obtain first thread corresponding first thread stacked data in described process message;
Search and whether comprise in described first thread stacked data to wait mutual exclusion lock message, described wait mutual exclusion lock message package contains holds
There is the second thread of the waited mutual exclusion lock of first thread;
When first thread stacked data does not comprise to wait mutual exclusion lock message, determine that first thread is held the lock time and exceeded Preset Time
Lead to system deadlock;
When first thread stacked data exists and waits mutual exclusion lock message, obtain and hold the second of the waited mutual exclusion lock of first thread
The corresponding second thread stacks data of thread;
Search and whether comprise in described second thread stacks data to wait mutual exclusion lock message;
When the second thread stacks data does not comprise to wait mutual exclusion lock message, determine that the second thread is held lock overlong time and led to system
Deadlock;
When the second thread stacks packet contains and waits mutual exclusion lock message, judge whether the second thread and first thread are constituted and hold lock
Dependence;
When the second thread and first thread constitute and hold lock dependence, determine and system deadlock is led to due to cross-thread interlocking;
When the second thread and first thread do not constitute and hold lock dependence, the thread of the waited mutual exclusion lock of the second thread will be held
As the second new thread, return execution and obtain second new thread correspondence the second thread stacks data.
2. method according to claim 1 is it is characterised in that also include:
Whether thread name is comprised, when described pressure ends with system is entered in the process message searching described pressure ends with system process
When comprising thread name in the process message of journey, the step that execution obtains thread stacks data;When not comprising thread name, really
Alignment journey is held the lock time and is exceeded Preset Time and lead to system deadlock.
3. method according to claim 1 it is characterised in that judge the second thread and first thread whether constitute hold lock according to
The step of bad relation, in the following way:
Judge whether the mutual exclusion lock that first thread is held is the mutual exclusion lock that the second thread is waited;
When the mutual exclusion lock that first thread is held is the mutual exclusion lock that the second thread is waited, determine first thread and the second cross-thread
Constitute and hold lock dependence;
When the mutual exclusion lock that first thread is held is not the mutual exclusion lock that the second thread is waited, determine first thread and the second thread
Between do not constitute and hold lock dependence.
4. method according to claim 1 it is characterised in that judge the second thread and first thread whether constitute hold lock according to
The step of bad relation, in the following way:
According to the wait mutual exclusion lock message in the thread stacks data obtaining, build and hold lock dependence diagram data;
Hold described in judgement in lock dependence diagram data and whether there is loop, if described lock dependence diagram data of holding has ring
Road, determines and holds lock dependence because each thread on loop is constituted.
5. the method according to claim 3 or 4 constitutes the thread holding lock dependence for interlocking it is characterised in that determining
Thread.
6. a kind of detection means of system reboot reason is it is characterised in that include:
First acquisition unit, for obtaining syslog file;
Whether the first searching unit, for comprising in described syslog file to force the process message of ends with system process;
Second acquisition unit, for when described syslog file comprises the process message forcing ends with system process, obtaining
Thread stacks data, and according to obtain thread stacks data acquisition lead to system deadlock the reason;
First determining unit, during for interlocking when the reason lead to system deadlock, determines the thread of interlocking for cross-thread;
Second determining unit, when exceeding Preset Time for holding the lock time for thread when the reason lead to system deadlock, determination is held
The lock time exceedes the thread of Preset Time;
Wherein, described second acquisition unit includes:
First acquisition subelement, for obtaining first thread corresponding first thread stacked data in described process message;
Whether the first lookup subelement, comprise to wait mutual exclusion lock message for searching in described first thread stacked data, described
Mutual exclusion lock message package is waited to contain the second thread holding the waited mutual exclusion lock of first thread;
First determination subelement, for when first thread stacked data does not comprise to wait mutual exclusion lock message, determining first thread
Holding the lock time exceedes Preset Time and leads to system deadlock;
Second acquisition subelement, for when first thread stacked data exists and waits mutual exclusion lock message, obtaining and holding First Line
The corresponding second thread stacks data of second thread of the waited mutual exclusion lock of journey;
Whether the second lookup subelement, comprise in described second thread stacks data to wait mutual exclusion lock message for searching;
Second determination subelement, for when the second thread stacks data does not comprise to wait mutual exclusion lock message, determining the second thread
Hold lock overlong time and lead to system deadlock;
First judgment sub-unit, for when the second thread stacks packet contain wait mutual exclusion lock message when, judge the second thread and
Whether first thread is constituted is held lock dependence;
3rd determination subelement, for when the second thread and first thread constitute and hold lock dependence, determining due to cross-thread
Interlocking leads to system deadlock;
Thread updating block, for when the second thread and first thread do not constitute and hold lock dependence, holding the second thread
The thread of waited mutual exclusion lock is as the second new thread, and it is corresponding to trigger the second new thread of the second acquisition subelement acquisition
Second thread stacks data.
7. the detection means of system reboot reason according to claim 6 is it is characterised in that also include:
Second searching unit, for search described force ends with system process process message in whether comprise thread name, when
When comprising thread name in the process message of described pressure ends with system process, triggering second acquisition unit obtains thread stacks number
According to;When not comprising thread name, determine that thread is held the lock time and exceeded Preset Time and lead to system deadlock.
8. the detection means of system reboot reason according to claim 6 is it is characterised in that described first judgment sub-unit
Including:
Second judgment sub-unit, for judging whether the mutual exclusion lock that first thread is held is the mutual exclusion lock that the second thread is waited;
4th determination subelement, for when the mutual exclusion lock that first thread is held is the mutual exclusion lock that the second thread is waited, determining
First thread and the second cross-thread composition hold lock dependence;Or, when the mutual exclusion lock that first thread is held is not the second thread
During the mutual exclusion lock being waited, determine first thread and the second cross-thread does not constitute and holds lock dependence.
9. the detection means of system reboot reason according to claim 6 is it is characterised in that described first judgment sub-unit
Including:
Construction unit, for according to the wait mutual exclusion lock message in the thread stacks data obtaining, building and holding lock dependence graph
Data;
3rd judgment sub-unit, whether there is loop for holding described in judging in lock dependence diagram data;
5th determination subelement, for when described hold lock dependence diagram data there is loop when, determine each line on loop
Journey is constituted holds lock dependence.
10. the detection means of system reboot reason according to claim 8 or claim 9 is it is characterised in that the first determining unit is joined
It is set to the thread determining that the thread that composition holds lock dependence is interlocking.
A kind of 11. terminal units are it is characterised in that include memorizer, and one or more than one instruction, one of
Or more than one instruction is stored in memorizer, and it is configured to one by one or more than one computing device
Or more than one instruction is comprised the instruction for carrying out following operation:
Obtain syslog file;
Search the process message whether comprising to force ends with system process in described syslog file;
When the process message comprising in syslog file to force ends with system process, obtain thread stacks data, and according to
The reason described thread stacks data acquisition leads to system deadlock;
When the reason lead to system deadlock be due to cross-thread interlock when, determine interlocking thread;
When holding the lock time for thread when the reason lead to system deadlock and exceeding Preset Time, determine that holding the lock time exceedes Preset Time
Thread;
Wherein, the step of the reason obtain thread stacks data, and system deadlock is led to according to described thread stacks data acquisition,
In the following way:
Obtain first thread corresponding first thread stacked data in described process message;
Search and whether comprise in described first thread stacked data to wait mutual exclusion lock message, described wait mutual exclusion lock message package contains holds
There is the second thread of the waited mutual exclusion lock of first thread;
When first thread stacked data does not comprise to wait mutual exclusion lock message, determine that first thread is held the lock time and exceeded Preset Time
Lead to system deadlock;
When first thread stacked data exists and waits mutual exclusion lock message, obtain and hold the second of the waited mutual exclusion lock of first thread
The corresponding second thread stacks data of thread;
Search and whether comprise in described second thread stacks data to wait mutual exclusion lock message;
When the second thread stacks data does not comprise to wait mutual exclusion lock message, determine that the second thread is held lock overlong time and led to system
Deadlock;
When the second thread stacks packet contains and waits mutual exclusion lock message, judge whether the second thread and first thread are constituted and hold lock
Dependence;
When the second thread and first thread constitute and hold lock dependence, determine and system deadlock is led to due to cross-thread interlocking;
When the second thread and first thread do not constitute and hold lock dependence, the thread of the waited mutual exclusion lock of the second thread will be held
As the second new thread, return execution and obtain second new thread correspondence the second thread stacks data.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310594935.2A CN103942113B (en) | 2013-11-21 | 2013-11-21 | The detection method of system reboot reason, device and terminal unit |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310594935.2A CN103942113B (en) | 2013-11-21 | 2013-11-21 | The detection method of system reboot reason, device and terminal unit |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103942113A CN103942113A (en) | 2014-07-23 |
CN103942113B true CN103942113B (en) | 2017-03-01 |
Family
ID=51189788
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310594935.2A Active CN103942113B (en) | 2013-11-21 | 2013-11-21 | The detection method of system reboot reason, device and terminal unit |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103942113B (en) |
Families Citing this family (20)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104794016A (en) * | 2015-04-23 | 2015-07-22 | 惠州Tcl移动通信有限公司 | Mobile terminal crash testing and processing method and system |
CN105930247B (en) * | 2016-04-14 | 2018-09-04 | 北京小米移动软件有限公司 | Processing method, device and the mobile terminal of system reboot problem |
CN106339285A (en) * | 2016-08-19 | 2017-01-18 | 浪潮电子信息产业股份有限公司 | Method for analyzing unexpected restart of LINUX system |
CN107451257A (en) * | 2017-07-31 | 2017-12-08 | 郑州云海信息技术有限公司 | A kind of maintainable system and method based on distributed file system |
KR102313664B1 (en) * | 2017-09-30 | 2021-10-15 | 후아웨이 테크놀러지 컴퍼니 리미티드 | Methods and devices for handling timeouts of system services |
CN108038038B (en) * | 2017-11-30 | 2021-11-16 | 努比亚技术有限公司 | Mobile terminal restart positioning method, mobile terminal and computer readable storage medium |
CN108012031B (en) * | 2017-11-30 | 2021-03-26 | 努比亚技术有限公司 | Mobile terminal restart positioning method, mobile terminal and computer readable storage medium |
CN108228423B (en) * | 2017-12-28 | 2022-04-19 | 努比亚技术有限公司 | Mobile terminal restart positioning method, mobile terminal and computer readable storage medium |
CN108108257B (en) * | 2017-12-28 | 2022-03-18 | 努比亚技术有限公司 | Restart positioning method based on MDSS, mobile terminal and readable storage medium |
CN108595311B (en) * | 2017-12-28 | 2021-11-16 | 努比亚技术有限公司 | Restart positioning method based on peripheral interface, mobile terminal and readable storage medium |
CN108182133B (en) * | 2017-12-28 | 2022-01-14 | 努比亚技术有限公司 | Mobile terminal restart positioning method, mobile terminal and computer readable storage medium |
CN108182123A (en) * | 2017-12-28 | 2018-06-19 | 努比亚技术有限公司 | Mobile terminal restarts localization method, mobile terminal and computer readable storage medium |
CN108170549B (en) * | 2017-12-28 | 2021-11-16 | 努比亚技术有限公司 | Mobile terminal restart positioning method, mobile terminal and computer readable storage medium |
CN109165110A (en) * | 2018-07-27 | 2019-01-08 | 努比亚技术有限公司 | Mobile terminal restarts localization method, mobile terminal and computer readable storage medium |
CN109343996A (en) * | 2018-10-30 | 2019-02-15 | 努比亚技术有限公司 | Mobile terminal restarts localization method, mobile terminal and computer readable storage medium |
CN110087034B (en) * | 2019-04-25 | 2020-11-10 | 山西潞安金源煤层气开发有限责任公司 | Coal bed gas remote monitoring system |
CN111090528B (en) * | 2019-12-25 | 2023-09-26 | 北京天融信网络安全技术有限公司 | Deadlock determination method and device and electronic equipment |
CN111159051B (en) * | 2019-12-31 | 2023-07-04 | 北京天融信网络安全技术有限公司 | Deadlock detection method, deadlock detection device, electronic equipment and readable storage medium |
CN111552618B (en) * | 2020-05-06 | 2024-03-12 | 上海龙旗科技股份有限公司 | Method and equipment for collecting logs |
CN112099960A (en) * | 2020-09-21 | 2020-12-18 | 天津神舟通用数据技术有限公司 | Distributed deadlock detection method based on path propulsion |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103034577A (en) * | 2011-10-08 | 2013-04-10 | 腾讯科技(深圳)有限公司 | Method and device for positioning slow shutdown |
CN103399818A (en) * | 2013-08-13 | 2013-11-20 | 中国科学技术大学苏州研究院 | Deadlock detection method in operating system |
-
2013
- 2013-11-21 CN CN201310594935.2A patent/CN103942113B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103034577A (en) * | 2011-10-08 | 2013-04-10 | 腾讯科技(深圳)有限公司 | Method and device for positioning slow shutdown |
CN103399818A (en) * | 2013-08-13 | 2013-11-20 | 中国科学技术大学苏州研究院 | Deadlock detection method in operating system |
Also Published As
Publication number | Publication date |
---|---|
CN103942113A (en) | 2014-07-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103942113B (en) | The detection method of system reboot reason, device and terminal unit | |
JP6467526B2 (en) | Communication message transmission method and wearable device | |
CN104519485B (en) | Communication means, device and system between a kind of terminal | |
CN103389863B (en) | A kind of display control method and device | |
KR20190046995A (en) | Memory Return Method and Device | |
CN104902531B (en) | Connect method, application authorization server, terminal and the router of network | |
CN104142868B (en) | Establish the method and device of connection | |
CN103365419B (en) | A kind of method and apparatus triggering alarm clock control command | |
CN103310009B (en) | Method, device and terminal for updating webpage data | |
CN103455603A (en) | Method and device for caching webpage content and loading webpage and terminal device | |
CN104077184B (en) | A kind of course control method and computer system of application program | |
WO2015007232A1 (en) | Method, device and mobile terminal for checking message | |
CN106502703A (en) | A kind of function calling method and device | |
CN105526944B (en) | Information cuing method and device | |
CN105302452A (en) | Gesture interaction-based operation method and device | |
CN106550046A (en) | Push the method and device of member card | |
CN103399706B (en) | Page interaction, device and terminal | |
CN105094501A (en) | Display method, device and system for messages in mobile terminal | |
EP3105912B1 (en) | Application-based service providing method and system | |
CN104901992A (en) | Resource transfer method and device | |
CN103729283B (en) | System log output method and device and terminal device | |
CN104391629A (en) | Method for sending message in orientation manner, method for displaying message, server and terminal | |
CN106681884A (en) | System call monitoring method and device | |
CN104092657A (en) | Information transmission method, device and system | |
CN105022621A (en) | Method and device for collecting session message and terminal |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |