AIX/HP-UX Interoperability Guide (continued)
[Last Chapter: 5. Devices]


6. Managing Processes

6.1 AIX

The ps Command

AIX supports both the AT&T and the BSD form of the ps command. To use the BSD form, simply leave off the minus sign for the command options, for example:

# ps alx

The AT&T version of the above command is:

# ps -elf

Priorities and Nice Values

Both of the above commands provide, among other things, the priority and nice values for each process. The nice value is part of the calculation for the priority value, whose range is 0 to 127. The lower the priority value, the more frequently the process is scheduled. Higher numbers mean lower priority.

The nice command follows the BSD value range of -20 to 20, again with the larger number representing the lower priority. Though the AIX man page does not say so, the nice command syntax takes two forms: nice -value and nice -n value. The latter is easier when you have to use negative values. Otherwise, to set the nice value to -10, you have to type:

# nice --10 CommandName

The renice command, unlike in HP-UX, does not take a -n option. The syntax of renice is:

# renice Priority -p PID

Signals

Like HP-UX, AIX really has two kill commands: /bin/kill and the kill built-in KornShell command. The signals for each differ. For example:

# /bin/kill -l
NULL HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM URG STOP TSTP CONT CHLD TTIN TTOU IO XCPU XFSZ MSG WINCH PWR USR1 USR2 PROF DANGER VTALRM MIGRATE PRE GRANT RETRACT SOUND SAK
# kill -l
 1) HUP   14) ALRM     27) MSG       40) bad trap  53) bad trap
 2) INT   15) TERM     28) WINCH     41) bad trap  54) bad trap
 3) QUIT  16) URG      29) PWR       42) bad trap  55) bad trap
 4) ILL   17) STOP     30) USR1      43) bad trap  56) bad trap
 5) TRAP  18) TSTP     31) USR2      44) bad trap  57) bad trap
 6) LOST  19) CONT     32) PROF      45) bad trap  58) bad trap
 7) EMT   20) CHLD     33) DANGER    46) bad trap  59) bad trap
 8) FPE   21) TTIN     34) VTALRM    47) bad trap  60) GRANT
 9) KILL  22) TTOU     35) MIGRATE   48) bad trap  61) RETRACT
10) BUS   23) IO       36) PRE       49) bad trap  62) SOUND
11) SEGV  24) XCPU     37) bad trap  50) bad trap  63) SAK
12) SYS   25) XFSZ     38) bad trap  51) bad trap
13) PIPE  26) bad trap 39) bad trap  52) bad trap

AIX also has a killall command that any user can run to kill all of his or her processes except the sending process. The syntax is:

# killall -Signal

System Resource Controller

AIX has a unique way of managing processes: the System Resource Controller (SRC). The SRC takes the form of a daemon, srcmstr, which is started by init via /etc/inittab. srcmstr manages requests to start, stop, or refresh a daemon or a group of daemons. Instead of typing the name of a daemon to start it, or instead of using the kill command to stop a daemon, you use an SRC command that does it for you. In this way you don't have to remember, for example, whether to use an ampersand when starting a daemon, or what signal to use when killing one. SRC also allows you to stop and start groups of related daemons with one command.

AIX has a hierarchical organization of system processes, and this organization is configured into the ODM in the form of the SRCsubsys and SRCsubsvr object classes. Daemons at the lowest levels are subservers. On a newly loaded system the only subservers are those of the inetd subsystem: ftp, telnet, login, finger, etc. To view these subservers, use the odmget command:

# odmget SRCsubvr
SRCsubsvr:
        sub_type = "ftp"
        subsysname = "inetd"
        sub_code = 21

SRCsubsvr:
        sub_type = "telnet"
        subsysname = "inetd"
        sub_code = 23

SRCsubsvr:
        sub_type = "finger"
        subsysname = "inetd"
        sub_code = 79

SRCsubsvr:
        sub_type = "tftp"
        subsysname = "inetd"
        sub_code = 69
...

The next level is that of subsystem. In the above command, we have the inetd subsystem listed in each of the subserver stanzas. To see a list of all subsystems, use the odmget SRCsubsys command:

# odmget SRCsubsys
SRCsubsys:
        subsysname = "lpd"
        synonym = ""
        cmdargs = " "
        path = "/usr/lpd/lpd"
        uid = 0
        auditid = 0
        standin = "/dev/console"
        standout = "/dev/console"
        standerr = "/dev/console"
        action = 1
        multi = 0
        contact = 3
        svrkey = 0
        svrmtype = 0
        priority = 20
        signorm = 0
        sigforce = 0
        display = 1
        waittime = 20
        grpname = "spooler"
SRCsubsys:
        subsysname = "inetd"
        synonym = ""
        cmdargs = ""
        path = "/etc/inetd"
        uid = 0
        auditid = 0
        standin = "/dev/console"
        standout = "/dev/console"
        standerr = "/dev/console"
        action = 2
        multi = 0
        contact = 3
        svrkey = 0
        svrmtype = 0
        priority = 20
        signorm = 0
        sigforce = 0
        display = 1
        waittime = 20
        grpname = "tcpip"
...

Related subsystems form a subsystem group, the highest level of the SRC. Subsystem groups can be ascertained from the above command by means of the grpname descriptor. Thus the above output shows the lpd subsystem being part of the spooler subsystem group, and inetd a subsystem of the tcpip subsystem group. An easier way to view all the subsystems and subsystem groups is to use the lssrc -a command:

# lssrc -a
Subsystem         Group            PID     Status
 syslogd          ras              3363    active
 sendmail         mail             4646    active
 portmap          portmap          4908    active
 inetd            tcpip            5167    active
 snmpd            tcpip            5428    active
 keyserv          keyserv          6206    active
 biod             nfs              6465    active
 nfsd             nfs              8010    active
 rpc.mountd       nfs              10067   active
 rpc.statd        nfs              10325   active
 rpc.lockd        nfs              10583   active
 qdaemon          spooler          5981    active
 writesrv         spooler          1631    active
 infod            infod            13684   active
 lpd              spooler          12151   active
 iptrace          tcpip                    inoperative
 gated            tcpip                    inoperative
 named            tcpip                    inoperative
 routed           tcpip                    inoperative
 rwhod            tcpip                    inoperative
 timed            tcpip                    inoperative
 llbd             ncs                      inoperative
 nrglbd           ncs                      inoperative
 ypserv           yp                       inoperative
 ypbind           yp                       inoperative
 ypupdated        yp                       inoperative
 yppasswdd        yp                       inoperative

The most commonly used SRC commands are startsrc, stopsrc, and refresh, each of which takes the following options:
-s Apply this command to a subsystem, using the subsystem name provided in the lssrclssrc -a command
-g Apply this command to a subsystem group, using the subsystem group name provided in the lssrclssrc -a command

The names of these commands imply their purpose: to start a subserver, subsystem, or subsystem group, use the startsrc command. For example, to start the rpc.mountd subsystem (which is actually the rpc.mountd daemon) type:

# startsrc -s rpc.mountd

To start the nfs subsystem group:

# startsrc -g nfs

This command starts all the subsystems (daemons) that comprise the nfs subsystem group: nfsd, biod, rpc.mountd, rpc.lockd, and rpc.statd.

To stop a subsystem or subsystem group, use the stopsrc command in exactly the same way. To stop and restart daemons, or to have daemons reread a configuration file such as /etc/inetd.conf, use the refresh command. For example:

# refresh -s inetd

Cron

AIX supports an AT&T-style crontab file with each one-line entry containing the following:

AIX also supports a convenient option to the crontab command: the -e option. This option will load the contents of your crontab file into an editing session. The editor used is determined by the value of the EDITOR variable. Once you save and exit from the editing session, your changes become your new crontab file and take effect immediately.

Officially, the crontab spool directories are found in /var/spool/cron, although there is a link from /usr/spool to /var/spool in AIX for compatibility with previous versions of the operating system.

6.2 HP-UX

ps, nice, and renice

The HP-UX ps command is strictly AT&T-style. Therefore a complete listing of every process is:

# ps -elf

Priorities range from 0 (highest priority) to 256 (lowest priority), and are classified by the following:

HP-UX uses the AT&T version of nice values, which run from 0 to 39 with a default of 20. 39 is the lowest priority, 0 the highest. The HP-UX version of renice has the following syntax:

# renice -n priority_change PID

The new system nice value is equal to 20 + priority_change, and is limited to the range from 0 through 39. If priority_change is a negative value, priority is increased provided the user has appropriate privileges.

Signals

HP-UX signals look like the following. For the HP-UX kill command:

# /bin/kill -l
NULL HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM USR1 USR2 CHLD PWR VTALRM PROF POLL WINCH STOP TSTP CONT TTIN TTOU URG LOST DIL

For the ksh built-in command:

# kill -l
 1) HUP                               16) USR1
 2) INT                               17) USR2
 3) QUIT                              18) CHLD
 4) ILL                               19) PWR
 5) TRAP                              20) VTALRM
 6) IOT                               21) PROF
 7) EMT                               22) POLL
 8) FPE                               23) WINCH
 9) KILL                              24) STOP
10) BUS                               25) TSTP
11) SEGV                              26) CONT
12) SYS                               27) TTIN
13) PIPE                              28) TTOU
14) ALRM                              29) URG
15) TERM                              30) LOST

The HP-UX killall command is a procedure used by /etc/shutdown to kill all active processes not directly related to the shutdown procedure. It is not used in the same way as in AIX. killall is chiefly used to terminate all processes with open files so that the mounted file systems are no longer busy and can be unmounted.

The top Command

The top command displays and updates information about the top processes on the system. It summarizes the general state of the system (load average), quantifies the amount of memory in use and free, and reports on individual processes active on the system. Whereas ps gives a single "snapshot" of the system, top samples the system and updates its display at intervals, the default being five seconds. On multiprocessing systems, top reports on the state of each processor.

This command is not available in AIX.

Cron

crontab files are found in /usr/spool/cron/crontab and should not be edited directly. Unlike in AIX, there is no -e option to crontab. Therefore to change your cron table you should do the following:

# crontab -l > cron.new
# vi cron.new
# crontab cron.new
# rm cron.new

Of course, you can use any text editor besides vi if you want.

The one-line entries in crontab files are the same for AIX.

6.3 Summary

AIX supports both the BSD and AT&T versions of the ps command; HP-UX does not. AIX also supports the nice and renice commands, though the nice values differ from those in HP-UX. AIX nice values are from -20 to 20, whereas HP-UX's are from 0 to 39. Both operating systems have two versions of the kill command: /bin/ksh and the ksh built-in, each of which have slightly different signal values. Both systems have similar cron tables, but AIX has a nifty -e option to the crontab command. HP-UX supports the top command, but AIX does not.

The biggest difference to be found with regard to process management between AIX and HP-UX is AIX's System Resource Controller, a daemon that can start, stop, or refresh a daemon or a group of daemons by means of a special set of commands. This mechanism allows for logical startup of several daemons at once as well as for orderly shutdown of daemons. Therefore, in the various "rc" files of AIX, you will see startsrc commands rather than commands to start individual daemons.

Interoperability Notes

Process management between the two systems, with the exception of the System Resource Controller, is similar. To kill a process you can use the most common signals, such as SIGHUP, SIGABRT, SIGKILL, and SIGTERM, which have the same values. Also, since the KornShell is the default shell on both systems, the shell built-in kill and the bgnice option to the ksh set command work the same way.


[Next Chapter: 7. Backups]


Provide feedback to: alan_roberts@hp.com

[Table of Contents] [Outline] [Index] (Updated 09 MAR 97)
Copyright 1996 Hewlett-Packard Company. All rights reserved.