CN1811730A - Method for testing closed loop or similar closed loop task - Google Patents

Method for testing closed loop or similar closed loop task Download PDF

Info

Publication number
CN1811730A
CN1811730A CN 200610020335 CN200610020335A CN1811730A CN 1811730 A CN1811730 A CN 1811730A CN 200610020335 CN200610020335 CN 200610020335 CN 200610020335 A CN200610020335 A CN 200610020335A CN 1811730 A CN1811730 A CN 1811730A
Authority
CN
China
Prior art keywords
endless loop
task
priority
class
infinite loop
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.)
Granted
Application number
CN 200610020335
Other languages
Chinese (zh)
Other versions
CN100394399C (en
Inventor
刘洋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Maipu Huaxin Information Technology Co., Ltd.
Original Assignee
MAIPU (SICHUAN) COMMUNICATION 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 MAIPU (SICHUAN) COMMUNICATION TECHNOLOGY Co Ltd filed Critical MAIPU (SICHUAN) COMMUNICATION TECHNOLOGY Co Ltd
Priority to CNB2006100203355A priority Critical patent/CN100394399C/en
Publication of CN1811730A publication Critical patent/CN1811730A/en
Application granted granted Critical
Publication of CN100394399C publication Critical patent/CN100394399C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

An infinite loop or infinite loop like task detection method refers to computer operation system field, especially infinite loop task detecting and processing technology. Present invention overcomes problem of more system resources wasting in current infinite loop or infinite loop like technical detection, determining infinite loop or infinite loop like task and calling system task storehouse accuracy positioning infinite loop position through generating system highest priority infinite loop monitoring task and system lowest priority infinite loop test task. In priority occupying type operation system, present invention only uses two simple tasks effectively detecting infinite loop or infinite loop like task without utilizing system clock interruption handling and task switching processing, to judge whether infinite loop or infinite loop like occurred, having small process frequency and saving CPU resource.

Description

A kind of endless loop or class endless loop task detection method
Technical field
The present invention relates to the computer operating system field, particularly the detection and the treatment technology of relevant endless loop task in operating system task management and the monitoring.
Background technology
In computer operating system, the detection of relevant endless loop task and processing are unusual important techniques.On February 25th, 2004 described a kind of in Real-time Multi-task System in Chinese invention disclosed patent " disposal route of endless loop under 01112526.8 real-time multi-task ", a kind of monitoring and the disposal route of class endless loop or endless loop appears in the task abnormity operation.The concrete grammar of this patent is system clock to be set interrupt, using system clock interrupt service routine ISR comes monitor task working time, a threshold values of setting task overrun, after the task run time surpassed threshold values, the expression task entered endless loop or class endless loop.The present invention need the installation task be switched hook and clock interrupt service routine ISR, and constantly does relative recording and detection when clock interruption and task switching.In real time operating system, clock interrupts and the task switching generally all took place to the frequency of part between second at 1/tens seconds, if clock is more accurate, the clock interruption frequency will be bigger so, the Interrupt Process that increases so big frequency was exactly a kind of consumption to cpu resource originally, and was added with a lot of detection record actions in frequent the interruption; Originally in task implementation, do not interrupt interrupting in longer following period of time, in this patent, interrupt because artificially added high-frequency clock, task will be interrupted repeatedly by force, interruption and task are switched all needs system overhead, so this patent can consume very big system resource.In addition, existing some other endless loop detection technique is basic identical, and the detection of adopting interruption of similar system clock and hook function to carry out endless loop is handled, and all has identical shortcoming.
Summary of the invention
The technical problem to be solved in the present invention is: when overcoming prior art detection endless loop or class endless loop task system resource is had the problem of more consumption, proposed a kind of detection method of more saving system resource.
The present invention is based on the preemptive priority formula operating system of non-round-robin, the detection method of a kind of endless loop or class endless loop task is provided, comprise the steps:
A), system generates the endless loop monitor task of a limit priority and the endless loop test assignment of a lowest priority:
B), the endless loop test assignment sends notice by certain cycle length to the endless loop monitor task;
C), with regard to the expression system endless loop or class endless loop do not appear when the endless loop monitor task obtains notice under rated condition;
D), endless loop monitor task reporting system is hung up inter-related task, and is positioned and debug.
Further, rated condition described in the above step c) is meant that system is provided with time-out time and expired times that the endless loop monitor task is waited for described notice.
Further, above-described time-out time is greater than the cycle length described in the step b).
Further, after system hangs up endless loop or class endless loop task in the described step d), this task stack of modular system Functional Analysis that the call operation system provides, accurately the position appears in orientation problem.
Further, comprise also between described step c) and the step d) that the step of determining endless loop or class endless loop task is as follows:
C1), determine the priority of endless loop or class endless loop task by the priority of continuous adjustment endless loop test assignment;
C2), call, find out all and step c1 by system standard) in the endless loop determined or class endless loop task priority identical and be ready to be operated the task of system call;
C3), the loop test task of checkmating is adjusted to step c1) in endless loop or the class endless loop task priority determined, and by reducing step c2 one by one) in find out task priority to minimum, whether obtain dispatching according to the endless loop test assignment respectively and determine whether the current task of being lowered priority is endless loop or class endless loop task.
At above step c1) in, adjust before the endless loop test assignment priority, dwindle described cycle length, time-out time and expired times, to accelerate the detection of endless loop or class endless loop task.
The above step c1) in, the priority of adjusting the endless loop test assignment adopts dichotomy, constantly dwindles definite scope of endless loop or class endless loop task priority.
Above step c3) if described endless loop test assignment does not obtain scheduling, the then current task of being lowered priority is not endless loop or class endless loop task.Recovering current is not the former priority of endless loop or class endless loop task.
The invention has the beneficial effects as follows: in the preemptive priority formula operating system of non-round-robin, only use two simple tasks, can effectively detect endless loop or class endless loop task, not need to utilize system clock Interrupt Process and task to switch the hook processing and just can judge whether to occur endless loop or class endless loop; It is very little to handle frequency, saves very much cpu resource; The location of endless loop is simultaneously passed through to System Reports, and system can hang up this task, and with the task stack analytical standard system call that system provides, accurately locatees the code position that endless loop occurs.
Description of drawings
Fig. 1 basic flow sheet of the present invention.
Fig. 2 the invention process example location endless loop task priority synoptic diagram.
Embodiment
The present invention utilizes in the preemptive priority formula operating system of non-round-robin, high-priority task only otherwise block or initiatively abdicate CPU, other task of low priority task and equal priority Principles of Operating System that just can not obtain dispatching so.According to process flow diagram shown in Figure 1, the present invention generates the endless loop monitor task with system's limit priority and has the endless loop test assignment of system's lowest priority in implementation process.The endless loop monitor task is by obtaining the notice that the endless loop test assignment provides certain cycle length, thereby the scheduling situation of system works task is monitored; In case there is task to enter endless loop or class endless loop, because its priority ratio endless loop monitor task is low, but than endless loop test assignment height, so the endless loop test assignment can not obtain scheduling, but the endless loop monitor task can obtain scheduling.If so the endless loop monitor task can access the notice that the endless loop test assignment provides in rated condition, show that the endless loop test assignment is working properly, promptly there is not the endless loop task in the system; If in regulation time-out time (being greater than the cycle length that the endless loop test assignment sends notice) and expired times, do not obtain notice, just show to have the endless loop task in the system.Determine which task is absorbed in before endless loop or the endless loop, must determine the priority of this task earlier.According to ultimate principle of the present invention, present embodiment adopts the priority of the tentative adjustment endless loop of dichotomy test assignment to determine the priority of endless loop task.By dwindling cycle length, wait timeout time and the expired times that notice sends, so that accelerate to detect frequency.If still can not obtain scheduling after endless loop test assignment priority is heightened, show that the current endless loop test assignment of the priority ratio priority of endless loop or class endless loop task wants high, then need to continue to heighten endless loop test assignment priority; Otherwise represent current endless loop test assignment priority ratio endless loop task priority height, then need to turn down endless loop test assignment priority.Like this by dwindling definite scope of endless loop or class endless loop task priority repeatedly, finally find one just than the priority of the high grade of priority of endless loop task, make under this grade, the endless loop test assignment can normal consistency, but just can not dispatch under low grade situation.Be exactly the limit priority that the endless loop test assignment can not obtain normal consistency with regard to the priority of making the endless loop task like this.After determining the endless loop task priority, same priority has a plurality of tasks, so next will determine endless loop task real under the identical endless loop task priority.Key step is adjusted to the endless loop task priority by the loop test task priority of checkmating, and endless loop this moment test assignment can not be dispatched.The standard calls that provides by system is found out the task of all equal priority then.To these tasks, it is minimum to system successively to reduce its task priority one by one.If after this task priority reduced, the endless loop test assignment obtained having dispatched, and represents that so this task is the endless loop task; Otherwise represent that this task is not the endless loop task, reduce its priority, judge one by one by that analogy.Can first reporting chain to the endless loop task, system can hang up task, and the standard storehouse analytic system of utilizing system to provide is again called, and finds out the invoked procedure of endless loop, just can accurately locate the appearance position of endless loop.
For the present invention, lift examples of implementation again and describe.The scope of all task priorities is 0-255 in certain system, and wherein the big more priority of numerical value is low more.It is the current limit priority 5 of system that endless loop monitor task (abbreviation monitor task) is set, endless loop test assignment (abbreviation test assignment) is the current lowest priority 255 of system, needs the detected priority limit of endless loop or class endless loop task that whether occurs in the system between 10-255.It is 15 seconds that system is provided with the time-out time that the endless loop monitor task waits for that test assignment provides the binary signal amount; Under system's normal operation, test assignment was to send out a binary signal amount time cycle to give monitor task with 10 seconds; And be provided with and judge that endless loop or class endless loop task are arranged after monitor task is waited for overtime 3 times of binary signal amount.The endless loop monitor task blocked for waiting for the binary signal amount that the endless loop test assignment provides when system was initial, up to getting this semaphore or wait timeout.As priority is 50 endless loop task X when occurring, and the endless loop monitor task is waited for overtime 3 times of binary signal amount, finds that test assignment can not obtain scheduling on 255 priority, determine that endless loop appears in system.For determining fast the endless loop task priority determining the endless loop task, system's adjustment cycle time is 1 wonderful, time-out time to 1.5 second, and expired times are set is 1.Because endless loop task priority scope is 10-255, according to dichotomy (10+255)/2=132, monitor task is adjusted test assignment priority to 132.After monitor task waits for that the binary signal amount is overtime,, monitor task still can not obtain scheduling if finding test assignment.Endless loop this moment task priority scope is 10-132, and according to dichotomy (10+132)/2=71, monitor task is adjusted test assignment priority to 71.The rest may be inferred, as shown in Figure 2, up to monitor task test assignment priority adjusted at 47 o'clock, and monitor task begins the binary signal amount of receiving that test assignment is sent, and promptly monitor task finds that test assignment can obtain scheduling.Determine that endless loop task priority scope is 47-55 (result of last dichotomy) this moment, according to dichotomy (47+55)/2=51, monitor task is adjusted test assignment priority to 51.Wait for that the binary signal amount is overtime, monitor task finds that test assignment still can not obtain scheduling.Endless loop this moment task priority scope is 47-51, and according to dichotomy (47+51)/2=49, monitor task is adjusted test assignment priority to 49.Receive the binary signal amount, monitor task finds that test assignment can obtain scheduling.Endless loop this moment task priority scope is 49-51, and according to dichotomy (49+51)/2=50, monitor task is adjusted test assignment priority to 50.Wait for that the binary signal amount is overtime, monitor task finds that test assignment still can not be able to not obtain scheduling.Endless loop this moment task priority scope is 49-50, the only poor one-level of grade that test assignment can be dispatched and can not be dispatched; Monitor task judges that endless loop priority is 50 thus.Monitor task is found out from system and is all priority 50 and prepares by the task of CPU dispatch state three A, B, X are arranged; Monitor task is at first adjusted the priority to 255 of A, and test assignment still can not obtain scheduling, and the task A of judging is not the endless loop task, the priority to 50 of reduction A.Monitor task reduces the priority to 255 of B again, and test assignment still can not obtain scheduling, and the task B of judging is not the endless loop task, the priority to 50 of reduction B.Monitor task reduces the priority to 255 of X, and test assignment can obtain scheduling.Therefore monitor task judges that X is the endless loop task, next is exactly the code position of utilizing system call location endless loop, is that modular system calls, and no longer describes in detail.

Claims (10)

1, a kind of endless loop or class endless loop task detection method is characterized in that, may further comprise the steps:
A), generate the endless loop monitor task of system's limit priority and the endless loop test assignment of system's lowest priority:
B), the endless loop test assignment sends notice by certain cycle length to the endless loop monitor task;
C), with regard to the expression system endless loop or class endless loop do not appear when the endless loop monitor task obtains notice under rated condition;
D), endless loop monitor task reporting system is hung up inter-related task, and is positioned and debug.
2, endless loop or class endless loop task detection method according to claim 1 is characterized in that rated condition is meant that system is provided with time-out time and expired times that the endless loop monitor task is waited for described notice in the described step c).
3, as described in claim 2, state endless loop or class endless loop task detection method, it is characterized in that described time-out time is greater than described cycle length.
4, endless loop or class endless loop task detection method according to claim 1, it is characterized in that, after system hangs up endless loop or class endless loop task in the described step d), this task stack of modular system Functional Analysis that the call operation system provides, accurately the position appears in orientation problem.
5, endless loop or class endless loop task detection method as claimed in claim 1 or 2 is characterized in that, comprise also between described step c) and the step d) that the step of determining endless loop or class endless loop task is as follows:
C1), determine the priority of endless loop or class endless loop task by the priority of continuous adjustment endless loop test assignment;
C2), call, find out all and step c1 by system standard) in the endless loop determined or class endless loop task priority identical and be ready to be operated the task of system call;
C3), the loop test task of checkmating is adjusted to step c1) in endless loop or the class endless loop task priority determined, and by reducing step c2 one by one) in find out task priority to minimum, whether obtain dispatching according to the endless loop test assignment respectively and determine whether the current task of being lowered priority is endless loop or class endless loop task.
6, as endless loop or class endless loop task detection method as described in the claim 5, it is characterized in that, after system hangs up endless loop or class endless loop task in the described step d), this task stack of modular system Functional Analysis that the call operation system provides, accurately the position appears in orientation problem.
7, as endless loop or class endless loop task detection method as described in the claim 5, it is characterized in that described step c1) in adjust before the endless loop test assignment priority, dwindle described cycle length, time-out time and expired times.
8, as endless loop or class endless loop task detection method as described in the claim 5, it is characterized in that described step c1) in adjust the endless loop test assignment priority adopt dichotomy, constantly dwindle definite scope of endless loop or class endless loop task priority.
9, as endless loop or class endless loop task detection method as described in the claim 5, it is characterized in that described step c3) in, if the endless loop test assignment does not obtain scheduling, the then current task of being lowered priority is not endless loop or class endless loop task.
10, as endless loop or class endless loop task detection method as described in the claim 9, it is characterized in that, recover described and determine it is not the former priority of endless loop or class endless loop task.
CNB2006100203355A 2006-02-22 2006-02-22 Method for testing closed loop or similar closed loop task Expired - Fee Related CN100394399C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2006100203355A CN100394399C (en) 2006-02-22 2006-02-22 Method for testing closed loop or similar closed loop task

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2006100203355A CN100394399C (en) 2006-02-22 2006-02-22 Method for testing closed loop or similar closed loop task

Publications (2)

Publication Number Publication Date
CN1811730A true CN1811730A (en) 2006-08-02
CN100394399C CN100394399C (en) 2008-06-11

Family

ID=36844662

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2006100203355A Expired - Fee Related CN100394399C (en) 2006-02-22 2006-02-22 Method for testing closed loop or similar closed loop task

Country Status (1)

Country Link
CN (1) CN100394399C (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101853191A (en) * 2010-06-23 2010-10-06 迈普通信技术股份有限公司 Method for detecting task endless loop in operating system and operating system
CN102141947A (en) * 2011-03-30 2011-08-03 东方通信股份有限公司 Method and system for processing abnormal task in computer application system adopting embedded operating system
CN102495793A (en) * 2011-11-11 2012-06-13 迈普通信技术股份有限公司 Method for detecting endless loop task
CN102622300A (en) * 2012-04-18 2012-08-01 迈普通信技术股份有限公司 Infinite loop or similar infinite loop detection method in multitask system
CN103164332A (en) * 2011-12-15 2013-06-19 迈普通信技术股份有限公司 Detection and processing method of endless loop task
CN104794016A (en) * 2015-04-23 2015-07-22 惠州Tcl移动通信有限公司 Mobile terminal crash testing and processing method and system

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101610487B (en) * 2009-07-20 2012-05-23 中兴通讯股份有限公司 Message delivering method used for telecommunication network and device
TWI643063B (en) * 2012-03-06 2018-12-01 智邦科技股份有限公司 Detection method

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1162772C (en) * 2001-03-27 2004-08-18 华为技术有限公司 Method for processing endless loop under real-time multitask
CN1235142C (en) * 2002-08-20 2006-01-04 华为技术有限公司 Embedded sorftware task endless loop monitoring method
CN100353333C (en) * 2003-03-20 2007-12-05 华为技术有限公司 Method for detecting dead circulation
JP2006011686A (en) * 2004-06-24 2006-01-12 Fuji Xerox Co Ltd Method for detecting abnormality of multi-task system

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101853191A (en) * 2010-06-23 2010-10-06 迈普通信技术股份有限公司 Method for detecting task endless loop in operating system and operating system
CN101853191B (en) * 2010-06-23 2013-02-20 迈普通信技术股份有限公司 Method for detecting task endless loop in operating system and operating system
CN102141947A (en) * 2011-03-30 2011-08-03 东方通信股份有限公司 Method and system for processing abnormal task in computer application system adopting embedded operating system
CN102141947B (en) * 2011-03-30 2013-04-24 东方通信股份有限公司 Method and system for processing abnormal task in computer application system adopting embedded operating system
CN102495793A (en) * 2011-11-11 2012-06-13 迈普通信技术股份有限公司 Method for detecting endless loop task
CN102495793B (en) * 2011-11-11 2014-11-05 迈普通信技术股份有限公司 Method for detecting endless loop task
CN103164332A (en) * 2011-12-15 2013-06-19 迈普通信技术股份有限公司 Detection and processing method of endless loop task
CN103164332B (en) * 2011-12-15 2015-11-18 迈普通信技术股份有限公司 The detection of endless loop task and disposal route
CN102622300A (en) * 2012-04-18 2012-08-01 迈普通信技术股份有限公司 Infinite loop or similar infinite loop detection method in multitask system
CN102622300B (en) * 2012-04-18 2015-03-25 迈普通信技术股份有限公司 Infinite loop or similar infinite loop detection method in multitask system
CN104794016A (en) * 2015-04-23 2015-07-22 惠州Tcl移动通信有限公司 Mobile terminal crash testing and processing method and system

Also Published As

Publication number Publication date
CN100394399C (en) 2008-06-11

Similar Documents

Publication Publication Date Title
CN100394399C (en) Method for testing closed loop or similar closed loop task
CN100535879C (en) Built-in real-time system interrupt handling device and method thereof
CN106293941B (en) Method for distributing database system resources
CN101853191B (en) Method for detecting task endless loop in operating system and operating system
US8612805B2 (en) Processor system optimization supporting apparatus and supporting method
CN1308746A (en) Method and apparatus for power mode transition in a multi-theread processor
CN101387971A (en) Task regulation method and apparatus for embedded software
CN102622300B (en) Infinite loop or similar infinite loop detection method in multitask system
KR100959548B1 (en) A method of interrupt scheduling
CN103164332B (en) The detection of endless loop task and disposal route
CN105634502A (en) Realization method of key scanning based on state machine
CN101561778B (en) Method for detecting task closed loop of multi-task operating system
CN107861797A (en) A kind of method for early warning and device based on JVM
KR101770736B1 (en) Method for reducing power consumption of system software using query scheduling of application and apparatus for reducing power consumption using said method
CN102033782A (en) Scheduling method for dynamically adjusting priority value of process
CN1162772C (en) Method for processing endless loop under real-time multitask
CN109918181A (en) Mixing critical system task Schedulability Analysis method based on the worst response time
CN1478230A (en) Method and system for withdrawing budget from blocking task
CN103312869A (en) Method and system for mobile terminal screen to be unlocked and standby state conversion
US20080098404A1 (en) Information processing apparatus, control method for information processing apparatus and program
CN1324477C (en) Method for real-time CPU occupation rate detection of operating systems
CN102495793B (en) Method for detecting endless loop task
CN101349975B (en) Method for implementing interrupt bottom semi-section mechanism in embedded operation system
CN100557576C (en) The method and apparatus that operating system failure detects
TW201039126A (en) Method of monitoring system resource and electronic device capable of monitoring system resource

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C56 Change in the name or address of the patentee

Owner name: MAIPU COMMUNICATION TECHNOLOGY CO., LTD.

Free format text: FORMER NAME: MAIPU (SICHUAN) COMMUNICATION TECHNOLOGY CO., LTD.

CP03 Change of name, title or address

Address after: Sichuan city of Chengdu province high tech Zone nine Hing Road No. 16 building, Maipu

Patentee after: Maipu Communication Technologies Co., Ltd.

Address before: Sichuan city of Chengdu province high tech Zone nine Hing Road No. 16 building, Maipu

Patentee before: Maipu (Sichuan) Communication Technology Co., Ltd.

ASS Succession or assignment of patent right

Owner name: BEIJING MAIPU HUAXIN INFORMATION TECHNOLOGY CO., L

Free format text: FORMER OWNER: MAIPU COMMUNICATION TECHNOLOGIES CO., LTD.

Effective date: 20150505

C41 Transfer of patent application or patent right or utility model
COR Change of bibliographic data

Free format text: CORRECT: ADDRESS; FROM: 610041 CHENGDU, SICHUAN PROVINCE TO: 100000 HAIDIAN, BEIJING

TR01 Transfer of patent right

Effective date of registration: 20150505

Address after: 100000, room 58, No. 918 West Fourth Ring Road, Haidian District, Beijing

Patentee after: Beijing Maipu Huaxin Information Technology Co., Ltd.

Address before: 610041 Sichuan city of Chengdu province high tech Zone nine Hing Road No. 16 building, Maipu

Patentee before: Maipu Communication Technologies Co., Ltd.

CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20080611

Termination date: 20160222

CF01 Termination of patent right due to non-payment of annual fee