[HPADM] Summary: HP-UX equivalent for : a) cpulimit b) kill -STOP / -CONT

Thanks very much Viktor, AbdulRasheed, Bill, Jeff & Baranyai,
their replies are appended further below.

I read that "processor affinity" command could possibly meet my
need on my PARISC servers too: by restricting the CPU hungry
weblogic process to one processor, the averaged overall CPU
utilization would be lower & thus stop the CA Unicentre alerts;
possibly allowing a possibly genuine process to complete (albeit
taking a longer). "renice" helps optimize CPU usage but can't
stop the alerts (these wild processes can come out of the blue
once/twice a week, unpredictable) & I can't silence Unicentre
'cos when high load occur, I'll need to be notified automatically.
"kill -25/-26 pid" has been reported to cause processes to
crash when there's inter-process synchronization while PRM
costs $.

Of the 2 processor affinity commands prset & mpsched, the
latter is probably more suited to my 2 processor PARISC:

Find out the number of processors in the server :
# /opt/ignite/bin/print_manifest | grep -i processor
(2 processors means there’s processor 0 & 1)

Bind/restrict high CPU pid XXX to say processor 1 :
# mpsched –c 1 –p XXX
(or use "prset"?)


As long as there isn't any other process for the cpu
to be executed, the reniced process runs in the queue, keeping the CPU
busy. After all, this is the main goal of the system: to be kept 100% busy.
You pay 100% price for the hardware, so keep it 100% busy, that's the
best you can do with it.


Have you ever heard PRM?
This is what you want.


25 SIGTSTP Pause the process
26 SIGCONT Continue Run a stopped process
kill -25 9735 #pause
kill -26 9735 #continue


I think the following 2 replies may have been misled by my
Linux question :

1) kill –SIGSTOP, kill –SIGCONT

2) STOP & CONT are there, signal 24 & 26 (from "kill -l")


Special thanks to Bill for elaborating & sharing scripts :

25 SIGTSTP Terminal stop Pause the process; can be trapped
26 SIGCONT Continue Run a stopped process

The signals are universal to Unix systems (kill -25 and kill -26), but the
symbolic names may slightly different.

The two HP-UX tools to handle resource management are WLM and
PRM which are Worlk Load Manager and Process Resource Manager.

WLM is more suited to distributing work between machines and
virtual partitions while PRM will allocate resources (disk
I/O, RAM and CPU) to processes or groups of processes.



Renice will change the priority that a process gets a timeslice.
For truly CPU-bound processes, each similar-priority process
is run for a timeslice period. The nice/renice value changes
the rate at which a timeslice is assigned to a given process.
So renice +15 will give less timeslices per unit of wall clock

Now when the higher priority CPU-bound process terminates, all
timeslices are distributed among the existing processes
according to their priority. So all CPU-intensive processes
that are left will get their timeslices according to the
current priorities.

This assumes 100% CPU and no I/O. A single I/O from a process
will move the process to the next timeslice so the I/O
completion can be handled. If the process then stays CPU-
bound, priorities will be as expected. But if the process
does more than 5-10 I/Os per second, the process will
receive a lot more timeslices than renice would imply.

Here’s a 100% CPU, no I/O script that you can use for testing:

while :

You can add counters to this loop to measure the rate of
execution and demonstrate how each loop is performing. I
use kill -16 and -17 (SIGUSR1 and SIGUSR2) for this purpose.
Here’s a simple script that demos how to query a counter and
then how to reset the counter while it runs continuously:


set -u

echo "\nDemo trapped signals 16 and 17"
echo "signal 16 reports counter, 17 resets counter\n"

# User signals 16 and 17
trap 'echo at line $LINENO, count=$CNT' 16
trap 'echo zero CNT;let CNT=0' 17

echo "\nCurrent traps are:"
echo "my PID=$$"

while :
let CNT=CNT+1
sleep 1

Because this has a sleep in it, there is no CPU usage. Take
out the sleep and change the loop to count once for another
loop that runs continuously for a million times.


On Tue, Apr 6, 2010 at 6:37 PM, sunhux G <sunhux@xxxxxxxxx> wrote:


I'm looking for something equivalent for HP-UX for the following :

Sometimes a process hogs the CPU that it triggers alert
& slows down other processes but I can't kill this process.

In Linux, there's something call "kill -STOP & kill -CONT pid".
Alternatively, I thought of using a script to average it out :
kill -STOP pid # pause execution of the process so it doesnt chew CPU
sleep 1
kill -CONT pid # resume it
sleep 1
kill -STOP pid
sleep 1

What's the -STOP & -CONT equivalent in HP-UX?