Understanding HP-UX Kernel Resource Limits

Kernel Tunables and Their Role

HP-UX uses a set of kernel tunables to manage resources like process table size, shared memory, and file descriptors. Misconfigured values in /stand/system or default settings after patch updates can silently throttle system throughput.

kmtune -l | grep maxdsiz
kmtune -l | grep max_thread_proc

Semaphore and Shared Memory Leaks

Applications like Oracle, SAP, or proprietary manufacturing software often leave behind orphaned semaphores or shared memory segments. Over time, this leads to a locked state where new processes cannot allocate memory or semaphores.

ipcs -m
ipcs -s
ipcrm -m ID
ipcrm -s ID

Common Root Causes of HP-UX System Hangs

1. Kernel Resource Exhaustion

System hangs often stem from hitting limits on nproc, maxuprc, or max_thread_proc. When reached, new user or system threads fail to spawn, stalling services and login shells.

2. Disk I/O Wait Bottlenecks

Older HP-UX systems using LVM or VxVM suffer from excessive disk queuing. Misconfigured I/O scheduler policies or hardware-level firmware mismatches can cause prolonged wait states.

sar -d 1 5
iostat -x 5

3. Swap Misconfiguration

Unlike Linux, HP-UX requires primary swap space to be device-based and properly ordered. Improper swap priorities or exhausted swap devices can cause kernel deadlocks.

swapinfo -tam
lvlnboot -v
swapon -s

4. Runaway Kernel Threads or Processes

Daemon processes or drivers (e.g., fcparrayd, perfagent) sometimes leak kernel memory or hold locks indefinitely. These often show up in top or glance but cannot be killed via userland tools.

Diagnosis Techniques

Use GlancePlus or Top

GlancePlus gives deep kernel insights in real-time. Sort by system CPU, process state (Z, D, R), and memory leaks.

/opt/perf/bin/glance
top -H -n 1

Analyze Crash Dumps (if available)

HP-UX generates crash dumps to /var/adm/crash during panics. Use crashutil to inspect kernel state post-failure:

/usr/sbin/crashutil -f /var/adm/crash/crash.X
/opt/ignite/livemedia/uxcrash

Check System Logs

Look in /var/adm/syslog/syslog.log or /var/adm/messages for hardware faults, EMC SAN errors, or kernel panic triggers.

Identify IPC Exhaustion

Check counts of allocated semaphores and shared memory versus semmni and shmmni:

kmtune -l | egrep "semmni|shmmni"
ipcs -a

Remediation Steps

  1. Analyze logs and GlancePlus metrics to isolate blocked threads or disk contention.
  2. Free unused IPC resources with ipcrm or automate using cron.
  3. Adjust kernel parameters using kmtune and rebuild the kernel via mk_kernel.
  4. Patch system firmware and HP-UX drivers if disk or FC interface issues persist.
  5. Schedule periodic system restarts for known memory leaks on legacy hardware.

Best Practices for Long-Term Stability

  • Review and document all kernel tunables quarterly.
  • Implement automated IPC cleanup scripts for stale semaphores and memory blocks.
  • Apply HP-UX QPK and OE patches regularly.
  • Use glance and sar for performance baselining and anomaly detection.
  • Migrate critical apps off aging PA-RISC or Itanium hardware to supported platforms.

Conclusion

Diagnosing HP-UX system hangs and performance stalls requires a methodical understanding of the kernel architecture, IPC mechanics, and device-level interactions. By analyzing shared memory usage, semaphores, and kernel tunables—combined with proactive logging and baselining—senior engineers can significantly reduce downtime risks in aging but mission-critical HP-UX environments.

FAQs

1. Can HP-UX dynamically update kernel parameters?

Only a few parameters (e.g., dbc_max_pct) are dynamically tunable; most require a kernel rebuild and reboot.

2. How to check if semaphores are leaking?

Use ipcs -s and look for keys associated with exited PIDs. A growing count of unattached semaphores indicates leakage.

3. Why does HP-UX require device-based primary swap?

HP-UX boot sequence mandates a fixed swap device as early swap space before LVM initialization completes.

4. What tools help monitor HP-UX memory usage?

glance, vmstat, and swapinfo are essential for visualizing kernel and user memory trends in real time.

5. Are there supported migration paths off HP-UX?

HP offers transition tools to Linux on x86, and Oracle/SAP provide HP-UX compatibility support on new platforms via containerization or emulation.