Search Images Maps Play YouTube News Gmail Drive More »
Sign in
Screen reader users: click this link for accessible mode. Accessible mode has the same essential features but works better with your reader.

Patents

  1. Advanced Patent Search
Publication numberCN102495793 A
Publication typeApplication
Application numberCN 201110356415
Publication date13 Jun 2012
Filing date11 Nov 2011
Priority date11 Nov 2011
Also published asCN102495793B
Publication number201110356415.9, CN 102495793 A, CN 102495793A, CN 201110356415, CN-A-102495793, CN102495793 A, CN102495793A, CN201110356415, CN201110356415.9
Inventors何三波
Applicant迈普通信技术股份有限公司
Export CitationBiBTeX, EndNote, RefMan
External Links: SIPO, Espacenet
Method for detecting endless loop task
CN 102495793 A
Abstract
The invention provides a method for detecting an endless loop task. The method comprises the following steps: an endless loop monitoring task with highest priority and an endless loop detecting task with the lowest priority are generated and enabled to operate periodically; everytime when the endless loop detecting task operates, the present time is recorded; everytime when the endless loop monitoring task operates, whether an endless loop task exists in an operating system is judged according to the operating condition of the endless loop detecting task; and the endless loop task existing in the system is located, and the located endless loop task is processed. The method provided by the invention can detect the endless loop task in the system under the premise of lower CPU resource consumption, and is simple to implement.
Claims(9)  translated from Chinese
1. 一种检测死循环任务的方法,适用于基于优先级对任务进行调度的操作系统,其特征在于:A、生成具有最高优先级的死循环监控任务和具有最低优先级的死循环检测任务,死循环监控任务和死循环检测任务周期性运行;B、死循环检测任务每次运行时记录当前时刻;C、死循环监控任务每次运行时,根据死循环检测任务的运行情况判断操作系统中是否存在死循环任务,在判定系统中存在死循环任务时,对死循环任务进行定位,并对定位到的死循环任务进行处理。 1. A method for detecting an infinite loop task for priority-based task scheduling the operating system, characterized by: A, generated with the highest priority loop monitoring tasks and have the lowest priority loop detection tasks , loop monitoring tasks and periodically run an infinite loop detection tasks; B, loop detection task every record the current time is running; C, loop monitoring tasks each run, according to the operation of the judgment loop detection task operating system whether there is an infinite loop when the task, the task in determining the existence of an infinite loop system, the task of locating an infinite loop, and navigate to the loop processing tasks.
2.根据权利要求1所述的方法,其特征在于,所述C中根据死循环检测任务的运行情况判断操作系统中是否存在死循环为:根据当前时刻和死循环检测任务运行时记录的当前时刻,计算死循环检测任务未得到调度的时间间隔,如果所述时间间隔超过预先设置的阈值,判定操作系统中存在死循环。 2. A method according to claim 1, characterized in that the operating system C is determined whether there is an infinite loop operation according to an infinite loop detection tasks: Run the current time and the loop is detected during recording of the current task time calculation loop detection tasks have not been scheduled intervals, if the time interval exceeds the preset threshold value, determines that there is an endless loop operating system.
3.根据权利要求1或2所述的方法,其特征在于,所述对死循环任务进行定位包括:D、判断是否已设置死循环标志,若没有设置,执行E,否则,跳到H ;E、为每个优先级设置一个任务列表,并为每个任务列表设置一个优先级控制块,在每个任务的任务控制块中设置任务运行字段,其值置为0,向操作系统注册任务切换钩子函数,并设置死循环标志;其中,每个任务列表中包含操作系统中所有具有相应优先级的任务,每个优先级控制块中包含任务运行字段,其值置为0 ;任务切换钩子函数被调用时,对本次被调度的任务的任务控制块的任务运行字段进行加1操作,并对该任务所属的任务列表的优先级控制块中的任务运行字段进行加1操作;F、死循环监控任务出让CPU,进入睡眠状态;G、当死循环监控任务的睡眠周期到期被唤醒时,死循环监控任务再次得到调度,返回C ;H、从最低优先级对应的优先级控制块开始检测,对于优先级控制块中的运行字段非0 的优先级,继续检测该优先级对应的任务列表的任务控制块,将任务控制块的任务运行字段非0的任务确定为死循环任务。 3. The method according to claim 1 or claim 2, characterized in that the positioning of the loop tasks include: D, determines whether loop flag has been set, if not set, execution E, otherwise, skip to H; E, for each priority to set up a task list and task list for each set a priority control block, provided for each task in the task to run the task control block field whose value is set to 0, the operating system registry task switch hook function, and set the loop flag; wherein each task list contains the operating system for all tasks with the corresponding priority, the priority of each task control block contains the Run field, and its value is set to 0; task switch hook When the function is called, for this task to be scheduled task to run the task control block fields are incremented, and the priority task list task control block belongs to the task runs fields plus an operation; F, loop monitoring task assignment CPU, go to sleep; G, when the sleep cycle loop monitoring mission expires wakes up again to get an infinite loop monitoring task scheduling, return C; H, corresponding to the lowest priority priority control block began testing a priority for the operation of the control block fields priority continues to detect non-zero corresponds to the priority task list task control block, the task of running the task control block field tasks identified as non-zero loop task.
4.根据权利要求3所述的方法,其特征在于:所述C中在判定系统中不存在死循环任务时,跳到F。 4. The method according to claim 3, characterized in that: when said C does not exist in an infinite loop in the task judging system, skip to F.
5.根据权利要求3所述的方法,其特征在于,在对死循环任务进行处理之后进一步包括:注销已注册的任务切换钩子函数,销毁所设置的任务列表,并清除死循环标志,返回F。 5. The method according to claim 3, wherein, after processing tasks on an endless loop further includes: cancellation of the registered task switch hook function, destroy the set task list, and clear signs infinite loop, returns F .
6.根据权利要求3所述的方法,其特征在于,所述对定位到的死循环任务进行处理包括:挂起死循环任务。 6. The method according to claim 3, wherein, characterized in that the positioning loop to handle tasks include: hang loop tasks.
7.根据权利要求6所述的方法,其特征在于,在挂起死循环任务之后,进一步包括: 对挂起的死循环任务进行调试,定位死循环出现的代码位置,并记录相关信息。 7. The method according to claim 6, wherein, after the hang loop task, further comprising: an endless loop of pending tasks for debugging, locating dead recurring code location and record relevant information.
8.根据权利要求3所述的方法,其特征在于,所述E中为每个优先级设置一个任务列表包括:通过操作系统接口获取包含操作系统中所有任务的任务控制块列表,将所有任务按照优先级进行划分,得到对应于每个优先级的任务列表。 8. The method according to claim 3, characterized in that the set E in a task list for each priority comprises: obtaining task contains all the tasks in the operating system control blocks list through the operating system interface, all tasks be divided according to the priority, to obtain corresponding to each priority task list.
9.根据权利要求1或2所述的方法,其特征在于, 所述死循环监控任务的睡眠周期比所述死循环检测任务的睡眠周期长。 9. The method according to claim 1 or claim 2, characterized in that the sleep cycle monitoring task loop is longer than the loop detection tasks sleep cycle.
Description  translated from Chinese

一种检测死循环任务的方法技术领域[0001] 本发明涉及计算机操作系统技术领域,特别涉及一种检测死循环任务的方法。 Art method for detecting loop task [0001] The present invention relates to the field of computer operating system technology, in particular to a detection loop tasks. 背景技术[0002] 在计算机操作系统中,有关死循环的检测及其处理是非常重要的技术。 [0002] In the computer operating system, related to an infinite loop detection and treatment are very important technology. [0003] 申请号为01112526. 8的发明专利申请中公开了一种实时多任务下死循环的处理方法,其描述了一种在实时多任务操作系统中,任务异常运行出现类死循环或者死循环的一种监控和处理方法。 [0003] Patent Application No. 01112526.8 The invention discloses a method for processing real-time multi-task under an infinite loop, which describes a real-time multitasking operating system, the task appears abnormal operation cycle of death or dead class A method for monitoring and processing cycles. 该专利的基本思想是使用时钟中断服务程序(ISR)和任务切换钩子函数来监控任务的运行时间,若任务的运行时间大于某个阀值,则认为该任务出现了死循环,此方法将大量消耗CPU资源。 The basic idea is to use the patent clock interrupt service routine (ISR) and task switching hook function to monitor the operation time of the task, if the run time of the task is greater than a certain threshold, it is considered that the task appeared loop, this method a lot consume CPU resources. 与此类似的使用系统时钟中断和任务切换挂钩函数来检测死循环的方法都存在相同的缺点。 And the like using the system clock interrupts and task switching function to detect the hook loop the same way there are such shortcomings. 发明内容[0004] 本发明提供了一种在多任务操作系统中检测死循环任务的方法,以克服现有技术检测死循环或类死循环任务时对操作系统CPU资源消耗过多的问题,本发明方法消耗CPU 资源少,并且实现简单。 Operating system CPU resource consumption [0004] The present invention provides a method for detecting an infinite loop tasks in a multitasking operating system to overcome the prior art detection loop or loop type tasks too much problem, the The method of the invention consumes less CPU resources, and simple. [0005](待权利要求的内容确定后,将拷贝至此)[0006] 由上述技术方案可见,本发明首先通过周期性运行的死循环监控任务和死循环检测任务确定操作系统中是否存在死循环任务;当存在死循环任务时,通过划分基于优先级的任务列表,设置任务列表的优先级控制块,并注册任务切换钩子函数对被调度任务的控制块及其优先级控制块中的相应字段进行设置,从而实现对死循环任务进行定位。 [0005] (after the disclosure of claim to be identified, will copy to this) [0006] can be seen from the above technical solutions, the existence of an infinite loop in the operating system of the present invention is first determined by the cycle of death and death cycle monitoring tasks running periodic inspection tasks task; when there is an infinite loop task control block by prioritizing tasks based on priority list, set the task list and task switch hook function registration is scheduled task control block and priority control block in the corresponding field setting, in order to achieve an infinite loop positioning tasks. [0007] 为避免消耗过多CPU资源,本发明没有使用系统时钟中断服务程序检测死循环, 而是在仅通过耗费CPU资源极低的周期性运行的死循环监控任务和死循环检测任务检测到操作系统中存在死循环后,才向操作系统注册任务切换钩子函数对死循环任务进行定位,并且,任务切换钩子函数中的操作非常简单,对CPU资源的消耗极低,因此,本发明提出的技术方案具有消耗CPU资源少、且实现简单的有益效果。 [0007] In order to avoid excessive consumption of CPU resources, the present invention does not use the system clock interrupt service routine detects an infinite loop, but only by a very low consumption of CPU resources to run an infinite loop periodic monitoring tasks and loop detection tasks detected After the existence of an infinite loop in the operating system before the operating system is registered to the task switch hook function loop positioning tasks, and task switching hook function of the operation is very simple, CPU resource consumption is very low, therefore, the present invention provides a Technical solutions have consumed less CPU resources, and implement simple beneficial effects. 附图说明[0008] 图1为本发明一较佳检测死循环任务的方法的流程示意图;[0009] 图2为本发明死循环监控任务的运行流程示意图;[0010] 图3为本发明死循环检测任务的运行流程示意图;[0011] 图4为本发明基于优先级划分任务列表的示意图。 BRIEF DESCRIPTION [0008] Figure 1 of the present invention a preferred method of detecting loop task schematic flow; [0009] Figure 2 of the present invention to run an infinite loop monitoring task flow diagram; [0010] FIG. 3 of the present invention to die Run schematic flow loop detection tasks; [0011] FIG. 4 schematic division of tasks based on priority list of the present invention. 具体实施方式[0012] 为使本发明的目的、技术方案及优点更加清楚明白,以下参照附图并举实施例,对本发明作进一步详细说明。 DETAILED DESCRIPTION [0012] To make the objectives, technical solutions and advantages of the present invention will be more clearly understood, the following with reference to accompanying drawings and embodiments, the present invention is described in further detail. [0013] 本发明利用在非时间片轮转的优先级抢占式操作系统中,只要高优先级任务不阻塞或者不主动出让CPU,那么低优先级任务或者与该高优先级任务具有相同优先级的其它任务就不能得到调度的原理,提出一种检测死循环任务的方法。 [0013] The present invention utilizes non-round-robin priority preemptive operating systems, as long as the high-priority tasks are not blocked or does not take the initiative to sell the CPU, then the low-priority tasks or with the same priority to the high priority tasks Other tasks will not be able to get the principle of scheduling, proposed a method for detecting an infinite loop task. 该方法首先生成具有最高优先级的死循环监控任务和具有最低优先级的死循环检测任务,然后令死循环监控任务和死循环检测任务周期性运行,死循环检测任务每次运行时记录当前时刻,死循环监控任务每次运行时,根据死循环检测任务的运行情况判断操作系统中是否存在死循环任务,在判定系统中存在死循环任务时,对死循环任务进行定位,并对定位到的死循环任务进行处理。 Firstly, with the highest priority is to generate an infinite loop monitoring tasks and have the lowest priority loop detection task, and then make an infinite loop monitoring tasks and periodically run an infinite loop detection tasks, record the current time loop detection tasks each run , loop monitoring tasks each run, depending on the operating conditions infinite loop detection task to determine whether the presence of loop-tasking operating system, the presence of an infinite loop task in judging system, the task of locating an infinite loop, and navigate to the loop task for processing.

[0014] 本发明适用于所有基于优先级对任务进行调度的操作系统,特别适用于vxWorks 实时多任务操作系统。 [0014] The present invention is applicable to all priority-based task scheduling the operating system, especially for real-time multitasking operating system vxWorks.

[0015] 下面通过一个较佳实施例对本发明进行详细说明。 [0015] By following a preferred embodiment of the present invention will be described in detail.

[0016] 图1为本发明一较佳检测死循环任务的方法的流程示意图。 [0016] Figure 1 of the present invention a preferred detection method loop task flow diagram. 参见图1,该方法包括: Referring to Figure 1, the method comprising:

[0017] 步骤101 :生成具有最高优先级的死循环监控任务和具有最低优先级的死循环检测任务,死循环监控任务和死循环检测任务周期性运行。 [0017] Step 101: Generate the highest priority of the loop monitoring tasks and have the lowest priority task loop detection, loop monitoring tasks and periodically run an infinite loop detection tasks.

[0018] 假设操作系统中任务的优先级为0〜100,优先级0为最低优先级,优先级100为最高优先级,则可以将死循环监控任务的优先级设置为100,将死循环检测任务的优先级设置为0。 [0018] assume that the operating system task priority 0 to 100, priority 0 is the lowest priority, the priority of 100 is the highest priority, you can set the priority task of monitoring loop 100, the loop detection priority task is 0.

[0019] 为保证死循环监控任务和死循环检测任务不占用大量的CPU,本发明中,死循环监控任务和死循环检测任务都周期性地运行,即:以固定的周期,每睡眠一段时间运行一次。 [0019] In order to ensure loop monitoring tasks and loop detection tasks do not take up a lot of CPU, the present invention, an infinite loop monitoring tasks and loop detection tasks are run periodically, namely: a fixed period, each sleep period run once. 其中,死循环监控任务每睡眠较长周期运行一次,如图2所示;死循环检测任务每睡眠较短周期运行一次,如图3所示。 Among them, the loop monitoring tasks to run once every sleep longer period, as shown in Figure 2; loop detection task to run once every sleep cycle is shorter, as shown in Figure 3. 这里,可以根据实际情况设置睡眠周期。 Here, you can set the sleep cycle according to the actual situation.

[0020] 步骤102 :死循环监控任务根据死循环检测任务的运行情况判断操作系统中是否存在死循环,如果存在死循环,执行步骤103,否则,跳到步骤107。 [0020] Step 102: loop monitoring tasks judged according to the task of running an infinite loop when the operating system to detect whether there is an infinite loop, if there is an infinite loop, step 103, otherwise, skip to step 107.

[0021] 死循环检测任务每次运行时记录本次运行的当前时刻,死循环监控任务每次运行时,根据当前时刻和死循环检测任务运行时记录的当前时刻,计算出死循环检测任务有多长时间没有运行了,即死循环检测任务未得到调度的时间间隔。 [0021] The record of the current time is running loop detection tasks each run, loop monitoring tasks each run, according to the current time and the time recorded loop detection tasks running current calculated loop detection tasks have How long is not running, and that loop detection tasks have not been scheduled intervals. 由于死循环检测任务在操作系统中的优先级最低,如果操作系统中不存在死循环任务,那么,死循环检测任务将有可能在其他任务处理完成的情况下得到调度,即:可以在合理长的时间间隔内得到一次调度, 反之,如果死循环检测任务未得到调度的时间间隔比较长,超过了预先设置的阀值,则表明操作系统中有任务出现了死循环或者类死循环。 Due to an infinite loop detection lowest priority task in the operating system, if the operating system does not exist in an infinite loop task, then, loop detection task will likely be scheduled in the case of other task processing is completed, namely: can reasonably long get within a time interval scheduling, conversely, if the loop detection tasks have not been scheduled intervals longer, than the pre-set threshold, then the operating system has the task appears infinite loop or loop type.

[0022] 步骤103 :判断是否已设置死循环标志,若没有设置,执行步骤104 ;若已经设置, 跳到步骤109。 [0022] Step 103: determine whether the loop flag is set, if not set, step 104; If you have already set up, skip to step 109.

[0023] 步骤104 :为每个优先级设置一个任务列表,并为每个任务列表设置一个优先级控制块,在每个任务的任务控制块中设置任务运行字段,其值置为0 ;其中,每个任务列表中包含操作系统中所有具有相应优先级的任务,每个优先级控制块中包含任务个数字段和任务运行字段,任务个数字段填充相应优先级的任务的总个数,任务运行字段置为0。 [0023] Step 104: Set up a priority list for each task control block, set the task to run field in each task in the task control block, and its value is set to 0 for each priority to set up a task list, and; which Each task list contains the operating system for all tasks with corresponding priorities, each priority task control block contains a number of fields and field task runs, the task number of fields filled with the appropriate priority task of the total number, task to run field set to zero.

[0024] 本步骤中,可以通过操作系统接口获取包含操作系统中所有任务的任务控制块列表,并将所有任务按照优先级进行划分,从而得到多个基于优先级的任务列表,如图4所 [0024] In this step, you can get through the operating system interface list of the task control block contains the operating system for all tasks and all tasks in accordance with priorities to be divided, resulting in more than one list based on priority tasks, as four

7J\ ο[0025] 其中,任务控制块中的任务运行字段可以由任务控制块中的用户保留字段扩充得到。 7J \ ο [0025] Among them, the task control block of the task to run field can be retained by the task control block users get expanded field. [0026] 步骤105 :向操作系统注册任务切换钩子函数。 [0026] Step 105: the operating system task switch hook function registered. [0027] 在操作系统中,每发生一次任务切换,就会调用一次已注册的任务切换钩子函数。 [0027] In the operating system, each time a task switch occurs, it will call a registered task switch hook function. 本发明中,任务切换钩子函数通过优先级索引优先级控制块,当任务切换钩子函数被调用时,其执行以下操作:对本次被调度的任务的任务控制块中的运行字段进行加1操作,并对该任务所属的任务列表的优先级控制块中的任务运行字段进行加1操作。 The present invention, task switching hooks by priority index priority control block, when a task switch hook function is called, it performs the following actions: for this scheduled task to run the task control block fields are incremented and the priority task list task control block belongs to the task to run the fields are incremented. [0028] 步骤106 :设置死循环标志。 [0028] Step 106: Set the loop flag. [0029] 这里,死循环标志实际上用于对死循环监控任务所执行的步骤104和步骤105进行标记,设置了死循环标志,表明死循环监控任务已执行步骤104和步骤105,其作用在于节约CPU资源。 [0029] Here, the cycle of death mark is actually used to step 104 and step loop monitoring tasks performed by the 105 mark, set the loop flag, indicating that loop monitoring task has to step 104 and step 105, its role is saving CPU resources. [0030] 上述步骤104〜106的执行顺序可以任意调换。 Execution order [0030] The above steps can be any exchange 104~106. [0031] 步骤107 :死循环监控任务出让CPU,进入睡眠状态,操作系统中的其他任务得到调度。 [0031] Step 107: loop monitoring mission to sell CPU, enter the sleep state, the operating system of the other tasks are scheduled. [0032] 由于在非时间片轮转的优先级抢占式操作系统中,只要高优先任务不阻塞或者不主动出让CPU,那么低优先级任务或者与该高优先级任务具有相同优先级的其它任务就不能得到调度,而本发明死循环监控任务只有在操作系统中存在死循环任务时,才会向提供注册任务切换钩子函数,因此,如果已注册任务切换钩子函数,那么,死循环监控任务出让CPU之后,操作系统中只有优先级高于死循环任务优先级的任务和死循环任务才能得到调度,对于得到调度的任务,任务切换钩子函数将对其任务控制块中的运行字段进行加1操作,并对其对应的优先级控制块中的任务运行字段进行加1操作,如此,根据任务控制块运行字段的取值和优先级控制块任务运行字段的取值,死循环任务将得以定位。 [0032] Since the non-time round-robin priority preemptive operating systems, as long as the high-priority tasks are not blocked or does not take the initiative to sell the CPU, then the low-priority tasks with the same priority or other tasks and the high priority task When can not be scheduled, and loop monitoring tasks of the present invention, only the presence of an infinite loop task in the operating system, will be to provide registration task switch hook function, so if you have registered a task switch hook function, then sell the CPU loop monitoring tasks After that, the operating system takes precedence over the loop only task priority tasks and to get an infinite loop task scheduling, task to be scheduled, task switching hook function will be added to a task control block in the operation of its operational field, and add a corresponding action on its priority task control block to run field, so, according to the value of the value of the field to run the task control block and priority task control block to run field, the task will be able to locate an infinite loop. 如果没有注册任务切换钩子函数,表明当前操作系统中并不存在死循环任务,死循环监控任务出让CPU 的目的仅在于令其他优先级的任务能够得以调度,而并非用于对死循环任务进行定位。 If the task switch hook function is not registered, indicating that the current operating system does not exist in an infinite loop task, purpose CPU loop monitoring task is to sell only to make other priority tasks can be scheduled and not used for loop positioning tasks . [0033] 步骤108 :当死循环监控任务的睡眠周期到期被唤醒时,死循环监控任务再次得到调度,返回步骤102。 [0033] Step 108: When the sleep cycle loop monitoring mission expires wakes up, loop monitoring tasks to be scheduled again, returns to step 102. [0034] 步骤109 :确定死循环任务,具体而言:从最低优先级对应的优先级控制块开始检测,若优先级控制块中的运行字段非0,表明相应优先级的任务出现了死循环,然后检测该优先级对应的任务列表的任务控制块,若检测到某个任务的任务控制块的任务运行字段非0,表明该任务出现了死循环。 [0034] Step 109: Determine loop tasks, specifically: start from the lowest priority to detect corresponding priority control block, if the priority of the operation of the control block field is non-zero, indicates that the corresponding priority task appeared loop then detects the priority list of tasks corresponding task control block, the task run field if detected a task task control block is non-zero, indicating that the task appeared in an endless loop. [0035] 步骤110 :对死循环任务进行处理。 [0035] Step 110: The loop task for processing. [0036] 检测出死循环任务后,可以挂起死循环任务或类死循环任务,并使用操作系统工具对出现死循环的任务进行调试和记录,并且,可以利用操作系统提供的标准接口函数分析该任务堆栈,精确定位死循环出现的代码位置,并使用用户接口记录相关信息。 [0036] After the detection of the loop task, you can hang loop task or type loop tasks and tasks using operating system tools for debugging infinite loop and recording, and analysis using standard operating system interface functions provided The task stack, pinpoint recurring dead code location and record relevant information with the user interface. [0037] 步骤111 :释放资源,具体包括:注销已经注册的任务切换钩子函数,销毁所设置的任务列表,并清除死循环标志,返回步骤107。 [0037] Step 111: the release of resources, including: cancellation of the registered task switch hook function, destroy the set task list, and clear signs infinite loop, returns to step 107. [0038] 至此,结束本较佳方法流程。 [0038] Thus, the end of the preferred method of the process. [0039] 由上述实施例可见,本发明首先通过周期性运行的死循环监控任务和死循环检测任务确定操作系统中是否存在死循环任务;当存在死循环任务时,通过划分基于优先级的任务列表,设置任务列表的优先级控制块,并注册任务切换钩子函数对被调度任务的控制块及其优先级控制块中的相应字段进行设置,从而实现对死循环任务进行定位。 [0039] can be seen from the above embodiments, the present invention is to first determine whether there is an infinite loop-tasking operating system via loop monitoring tasks and loop detection tasks periodically run; when there is an infinite loop task, by dividing tasks based on priority priority control block list, set the task list, and register control task switch hook function blocks and their priority task control block is scheduled to set the appropriate fields, in order to achieve an infinite loop positioning tasks.

[0040] 为避免消耗过多CPU资源,本发明没有使用系统时钟中断服务程序检测死循环, 而是在仅通过耗费CPU资源极低的周期性运行的死循环监控任务和死循环检测任务检测到操作系统中存在死循环后,才向操作系统注册任务切换钩子函数对死循环任务进行定位,并且,任务切换钩子函数中的操作非常简单,对CPU资源的消耗极低,因此,本发明提出的技术方案具有消耗CPU资源少、且实现简单的有益效果。 [0040] In order to avoid excessive consumption of CPU resources, the present invention does not use the system clock interrupt service routine detects an infinite loop, but only by a very low consumption of CPU resources to run an infinite loop periodic monitoring tasks and loop detection tasks detected After the existence of an infinite loop in the operating system before the operating system is registered to the task switch hook function loop positioning tasks, and task switching hook function of the operation is very simple, CPU resource consumption is very low, therefore, the present invention provides a Technical solutions have consumed less CPU resources, and implement simple beneficial effects.

[0041] 以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本发明保护的范围之内。 [0041] The above description is only preferred embodiments of the present invention, it is not intended to limit the present invention, within the spirit and principles of the present invention, made any modifications, equivalent substitutions and improvements should be included within the scope of protection of the present invention.

Patent Citations
Cited PatentFiling datePublication dateApplicantTitle
CN1811730A *22 Feb 20062 Aug 2006迈普(四川)通信技术有限公司Method for testing closed loop or similar closed loop task
CN101853191A *23 Jun 20106 Oct 2010迈普通信技术股份有限公司Method for detecting task endless loop in operating system and operating system
US5450586 *30 Apr 199212 Sep 1995Hewlett-Packard CompanySystem for analyzing and debugging embedded software through dynamic and interactive use of code markers
Classifications
International ClassificationG06F11/36
Legal Events
DateCodeEventDescription
13 Jun 2012C06Publication
11 Jul 2012C10Entry into substantive examination
5 Nov 2014C14Grant of patent or utility model