How do I limit the system unit time that a process can use?

demcmahan
demcmahan used Ask the Experts™
on
I have some processes that often hang and I had this thought that maybe they could be killed after they used a fixed amount of cpu resources.  It's easy for me to see that these specific processes have hung by using AIX's "topas" utility.

When I do "ps -ef" I can easily spot the hung processes by looking at the values in the 'C' and 'TIME' columns.

I tried the "chuser" command with the "cpu=" and "cpu_hard=" parameters, but that did not work.

I have two questions:
1.  Can what I want to do be done?
2.  The man page for "chuser" says that "cpu" and "cpu_hard" sets the "largest amount of system unit time (in seconds) that a user's process can use".  How do I monitor "system unit time"?

Don
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2013
Top Expert 2013
Commented:
Hi,

the most viable solution for your issue is WLM.

The AIX WorkLoad Manager is used to limit resource consumption of selected processes, based on a resource class model.

Enter "smitty wlm".

Start with adding a new class, then configure the class with "Change/Show ..".

Start WLM, and finally "Assign processes to a class" (running processes) or add "Class assignment rules" (future process selection).

Here is more:

http://www.redbooks.ibm.com/abstracts/sg245977.html

The Redbook is for AIX 5L, but it's still valid because not much has changed since then.

You can view the CPU consumption with "ps -e -o tcpu", but you must have WLM enabled (even without any configuration) to see it.
bbaoIT Consultant

Commented:
another approach is to simply separate the specific applications into a VM running on the computer. you may control the system resources including CPU usage consumed by the VM (applications).

Author

Commented:
Thanks for your reply, but unfortunately, we have no VMs on this machine and setting one up is not an option.
bbaoIT Consultant

Commented:
as since W2K3, Windows started supporting QoS for better traffic prioritisation and shaping to specific applications. this may allow you to optimise application performance from a network perspective.

How QoS Works
http://technet.microsoft.com/en-us/library/cc728211%28v=ws.10%29.aspx

be aware that this approach is based on IP address, protocol and port, not related to CPU and memory usage.
Top Expert 2015

Commented:
POSIX Facility to kill a process after consumiong some CPU time is ulimit

OIf you want to adjust scheduler guaranteeing some resources to critical processes you have to fo to "smitty wlm"

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial