Skip navigation.
Home
The QNX Community Portal

View topic - Prcoess Monitor for monitoring threads of process

Prcoess Monitor for monitoring threads of process

For discussion of realtime and/or embedded programming.

Prcoess Monitor for monitoring threads of process

Postby wednesday » Thu Aug 30, 2012 12:34 pm

I have a requirement to develop a Process monitor module
that starts, stops and continually monitors certain processes (and
their threads) on an embedded QNX system.
The idea is that is that if a thread is detected to have exited or
hung/consumed CPU or deadloacked, this monitor would kill and restart the parent process and all
its threads.

However ,most threads are created to run in a blocking type
scenario, and there is no guarentee that the events they block on
would occur often enough to determine if the thread was in trouble or
merely legitimately blocked for a long time.
Any ideas on how to go about this requirement.
wednesday
Active Member
 
Posts: 48
Joined: Tue Apr 28, 2009 7:10 am

Re: Prcoess Monitor for monitoring threads of process

Postby maschoen » Thu Aug 30, 2012 4:15 pm

You should look at HAM (High Availablity Monitor). It will detect what you are describing if set up right.
maschoen
QNX Master
 
Posts: 2640
Joined: Wed Jun 25, 2003 5:18 pm

Re: Prcoess Monitor for monitoring threads of process

Postby wednesday » Fri Aug 31, 2012 12:25 pm

Hi,
Is it possible to detect even hung processes /cpu consuming processes via HAM?
I thought that HAM only finds out the death of a process..
wednesday
Active Member
 
Posts: 48
Joined: Tue Apr 28, 2009 7:10 am

Re: Prcoess Monitor for monitoring threads of process

Postby slougheed » Fri Aug 31, 2012 5:12 pm

HAM can be configured to require a heartbeat so detecting a hung process is relatively straightforward. As for high CPU utilization, I'm not sure of how to implement it but, QNX's documentation says:

"Also, by studying the source code, it is possible to add the capability of detecting other conditions into the HAM (e.g. low memory, high CPU utilization, low disk space, etc.) to suit your HA application."

http://www.qnx.com/developers/docs/6.4. ... mover.html
slougheed
Active Member
 
Posts: 11
Joined: Tue Nov 22, 2005 9:36 pm

Re: Prcoess Monitor for monitoring threads of process

Postby wednesday » Mon Sep 03, 2012 5:58 am

Hi.I have a low end system with 500 Mhz CPU and 256MB RAM.
There can be around 50 apps running on this system excluding drivers and other system utilities.
I need monitor all these 50 apps.Will it be a good idea to regsiter each of these 50 processes with HAM
without affecting performance of sytsem?
Apart from HAM, is there anything i can do in code for monitoring them?
wednesday
Active Member
 
Posts: 48
Joined: Tue Apr 28, 2009 7:10 am

Re: Prcoess Monitor for monitoring threads of process

Postby maschoen » Mon Sep 03, 2012 3:05 pm

wednesday wrote:Hi.I have a low end system with 500 Mhz CPU and 256MB RAM.
There can be around 50 apps running on this system excluding drivers and other system utilities.
I need monitor all these 50 apps.Will it be a good idea to regsiter each of these 50 processes with HAM
without affecting performance of sytsem?
Apart from HAM, is there anything i can do in code for monitoring them?


Every process affects the performance of a system. The question you wish to have answered is whether it will affect the system so negatively that it will not work? The answer to this is simple. If you have sufficient resources left in the system such as cpu, memory then it will work. If you don't have sufficient resources left, it will not work. You could get an idea you could look at the percentage of cpu being used by Idle and how much free memory is in the system. To know for sure you will have to test.

The alternative to using HAM is to write your own monitor. Will this use less resources than HAM? Possible but unlikely.
maschoen
QNX Master
 
Posts: 2640
Joined: Wed Jun 25, 2003 5:18 pm

Re: Prcoess Monitor for monitoring threads of process

Postby Thunderblade » Wed Sep 05, 2012 9:35 am

HAM only requires very few resources. Detecting process death is an event-based thing so it doesn't consume CPU. Sending the heartbeats does consume very little CPU.

If a process consumes too much CPU, others will not be able to send their heartbeats and you can react. How - there is no easy answer. You would need to log CPU usage on a regular basis to find out who is using "too much" CPU - and you have to define how much that is. Probably using Adaptive Partitioning is a better approach for this type of problem.
Thunderblade
Senior Member
 
Posts: 487
Joined: Thu Apr 07, 2005 11:52 am


Return to Realtime and Embedded

Who is online

Users browsing this forum: Bing [Bot] and 3 guests

cron