The invention provides an efficient thread life monitoring method, which comprises the following steps: S1: when the system is initialized, a monitor thread with the highest priority is started first; the monitor thread contains thread register_num, thread name, thread ID, thread priority, thread timeout. After the start of the highest priority monitoring thread in S2: 1, all application threads except the highest priority monitoring thread need to register relevant information with the highest priority monitoring thread; and fix Times report the safe feedtime, monitoring thread monitor thread according to the relevant information when the thread registration, regular monitoring of each thread life state, once found abnormal alarm to the system and list the thread of the problem, the actual use of the process can achieve good monitoring abnormal effect.
【技术实现步骤摘要】
一种高效率线程生命监测方式[
]本专利技术涉及线程生命监测方式
,尤其涉及一种具有较高反馈速率的高效率线程生命监测方式。[
技术介绍
]目前有不同类型的Linux用户空间的调试工具。如下:基本调试,获得关键变量-print语句;获取有关文件系统支持,可用内存,CPU,运行程序的内核状态等信息-查询/proc文件系统;最初的问题诊断,系统调用或库调用的相关问题,了解程序流程-strace/ltrace;应用程序内存空间的问题-valgrind;检查应用程序运行时的行为,分析应用程序崩溃-gdb;以上方法均建立在完善的Linux系统或者第三方工具上,但对于嵌入式Linux系统而言,不单内核会裁剪,busybox也会进行裁剪,有些debug工具无法直接定位到崩溃点,怎样才能通过增加高优先级注册线程机制,定时侦测线程生命来及时监测问题发生线程并定位,是本领域的技术人员经常考虑的问题。[
技术实现思路
]为克服现有技术所存在的问题,本专利技术提供一种具有较高反馈速率的高效率线程生命监测方式。本专利技术解决技术问题的方案是提供一种高效率线程生命监测方式,包括以下步骤,S1:系统初始化时首先启动一个最高优先级别的监测线程(monitorthread);该监测线程(monitorthread)包含有threadregister_num、threadname、threadID、threadpriority、threadtimeout、threadfeedtime、threadexception_info;S2:步骤S1中最高优先级别监测线程(monitorthread)启 ...
【技术保护点】
1.一种高效率线程生命监测方式,其特征在于:包括以下步骤,S1:系统初始化时首先启动一个最高优先级别的监测线程(monitor thread);该监测线程(monitor thread)包含有thread register_num、thread name、thread ID、thread priority、thread timeout、thread feedtime、thread exception_info;S2:步骤S1中最高优先级别监测线程(monitor thread)启动完成后,控制除最高优先级别监测线程(monitor thread)之外的所有应用线程都需要向最高优先级别监测线程(monitor thread)注册相关信息;并定时报告安全的feedtime;S3:监控线程(monitor thread)根据线程注册时的相关信息,定时监测每一个线程的生命状态;S4:当步骤S3中,监控线程(monitor thread)发现异常情况发生之后,随即向系统报警并列出出现问题的线程;S5:监测完成。
【技术特征摘要】
1.一种高效率线程生命监测方式,其特征在于:包括以下步骤,S1:系统初始化时首先启动一个最高优先级别的监测线程(monitorthread);该监测线程(monitorthread)包含有threadregister_num、threadname、threadID、threadpriority、threadtimeout、threadfeedtime、threadexception_info;S2:步骤S1中最高优先级别监测线程(monitorthread)启动完成后,控制除最高优先级别监测线程(monitorthread)之外的所有应用线程都需要向最高优先级别监测线程(...
【专利技术属性】
技术研发人员:段雄波,郭俊峰,
申请(专利权)人:深圳市亿联智能有限公司,
类型:发明
国别省市:广东,44
还没有人留言评论。发表了对其他浏览者有用的留言会获得科技券。