Home Switchboard Unix Administration Red Hat TCP/IP Networks Neoliberalism Toxic Managers
May the source be with you, but remember the KISS principle ;-)
Skepticism and critical thinking is not panacea, but can help to understand the world better

Process Scheduling

News Recommended Links Recommended Books crontab cron SMF
at nice/renice priocntl uptime command Truss Etc

Solaris offers typical UNIX commands for process scheduling. Solaris 10 adds SMF facility for starting stopping processes that gives you capability to take extra advantage of resolving existing dependencies during starting or stopping of a particular process.

As in most Unixes crontab and at commands are used in Solaris for automatic execution of executables and scripts  at a scheduled time. In addition you can use the nice  and the renice  commands to alter the priority of running processes.

The crontab  Command

The crontab  files are stored in the /var/spool/cron/crontab  directory. Each crontab  command represents a scheduled task, which is known as a cron  job. Root and any user who has permissions to schedule events has his or her own crontab  file.

The structure of crontab did not changes from the times it was introduced. It contains six fields:

  1. Minute Minute of the hour (0-59)
  2. Hour Hour of the day (0-23)
  3. Day  Day of the month (1-31)
  4. Month  Month of the year (1-12)
  5. Weekday  Day of the week(0-6; 0=Sunday)
  6. Command The command to execute
By default, the /var/spool/cron/crontabs  directory contains the crontab  files for system accounts. The default crontab  files are adm  for accounting, lp  for printing, root  for administrative tasks, and sys  for performance collection

The cron daemon can be controlled using  /etc/default/cron  file. For example to log the activities of the cron  command, ensure the presence of the following entry:


This entry logs the activity of cron  in the /var/cron/log  file. To disable logging, modify this entry as follows:


You need to restart the cron to reread the file.

You can control users' access to the crontab  command by using the /etc/cron.d/cron.allow  and the /etc.cron.d/cron.deny  files.

In Solaris by default the cron.deny  file prohibits crontab  use by the following system users:

To create a crontab  file, use the -e  option of the crontab  command followed by the file name, for example:

# crontab -e joeuser

The -e  option is also used to edit an existing crontab  file.

The -l  option lists a crontab  file. The following example displays the lp crontab  file used for printing.

# crontab -l lp 

The -r  option is used to delete the crontab  file. 

Note: If you have accidentally typed the crontab  command without any arguments, exit with Ctrl+C. Exiting with Ctrl+D removes all entries in your crontab  file.

The at  command

The at  command schedules a single system event only once, unlike the crontab  command, which can schedule multiple system events repetitively at specified periods. The at  command enables users to create, display, and remove their own at  jobs.

To schedule at  jobs, type at followed by the time. After you type this, a prompt <at>  is displayed. Specify the command or script that has to execute at the specified time. The time is mentioned in minutes, hours, days, and months.

The following example shows how to remove the files from the home directory of user Jency at 9.55 p.m. on August 2.

$ at 9:55PM
at> rm /export/home/jency
at> rm /albert
at> mkdir / albert1
at> <EOT>
commands will be executed using /sbin/sh
job 996807300.a at Thu Aug  2 21:55:00 2001

NOTE: Type Ctrl+C to exit the at  prompt.

Each at  job is given a job ID and has a suffix of .a, which identifies it is an at  job. When more than one job is scheduled for execution, it is queued as per the time schedule. To display this queue, use the atq  command.

# atq
 Rank     Execution Date     Owner     Job         Queue   Job Name
  1st   Aug  2, 2001 21:55   root    996807300.a     a     stdin
  2nd   Aug 15, 2001 12:00   root    997894800.a     a     stdin


To display an at  job you should know its job ID. The at -l  command, without any arguments, displays the status information for all the at  jobs created by the user who executes the at -l  command.
$ at -l
user = root     996807300.a     Thu Aug  2 21:55:00 2001
user = root     997894800.a     Wed Aug 15 12:00:00 2001

The at -r  command followed by the job ID removes the at  job with the specified job ID.

# at -r <job id>

nice  and renice  commands

You can use the nice  command to alter the access priority of processes. The nice  number for a process can range from 0 to +40 with 0 indicating the highest priority and 40 indicating the lowest priority. To change the priority order of a process by using the nice  command, change the process's nice  number. For example, to increase the priority of a process by 10 units, decrease the nice  number by 10. The higher the value of nice, the lower is its execution priority.

Both the standard version and the /usr/bin/nice  version of the nice  command in Solaris use the following syntax:

/usr/bin/nice -[+ | -n] command_name

In the /usr/bin  version of the nice  command, the value to add or subtract from the nice  number is preceded by a hyphen. For example, to decrease the nice  number from 30 to 24, use the following syntax. Note that if no number is specified, the nice  number is increased by 10 by default, which decreases the priority value by 10 units.

/usr/bin/nice --6 command_name

Similarly, to increase the nice  number from 24 to 30, use the following syntax:

/usr/bin/nice -6 command_name

You can also change the priority of a process while the process is running. Solaris provides the renice  command, which you use to change the priority of an executing process. The renice  command takes the PID of the process as the operand. The command uses the following syntax:

renice [-n priority_change] PID

The -n  option in the preceding syntax defines the number of units by which to increase or decrease the priority of the running process. By default, all the processes running on the system are assigned a nice  value equal to 20. Note that after altering the priority of the running process, the new nice  value is 20 +/- the priority change. This value can range from 0 through 39. PID is the process ID for which the priority has to be changed.

For example, to decrease the priority of the process for PID 324 by 5 during runtime, use the following command:

renice -n 5 -p 324

In the preceding command, the new nice  value for the process will be 15.

You also can use the renice  command to change the priority of processes belonging to a particular user. For example, to increase the execution priority of processes belonging to the user David by 8 units, use the following command:

renice -n -8 -u David

The priocntl  command

The Solaris provides the priocntl  command, which you use to change the scheduling behavior of a process. The command displays or sets the priority of the processes. You can also use the priocntl  command to display the current configuration information of the process scheduler.

Table below lists the options of the priocntl  command:

The priocntl -l  command displays a list of the currently loaded scheduling classes. A sample output of the command follows.

# priocntl -l
SYS (System Class)
TS (Time Sharing)
        Configured TS User Priority Range: -60 through 60
IA (Interactive)
        Configured IA User Priority Range: -60 through 60
The priocntl -l  command displays the scheduling parameters of a process. A sample output of the command follows.
# priocntl -d -i pid 1
     1            0                0
The priocntl -l  command creates a process. For example, the following command starts the find  command with a priority of 10.
# priocntl -e -c TS -p 10 find / -name core -print
In the preceding command, the -e  option executes the command. The -c  option specifies the class in which the command executes.


Solaris offers the truss utility that you use to track processes running on a system. The truss utility is similar to the trace utility of Solaris 4.x. The truss utility reports the following information about processes:

You use the truss utility to debug problems with processes. Although truss is not a debugging utility, it helps you identify problems a process encounters.

You can use the truss utility to track any executable command or a currently running process by using the PID value of the process. The truss utility tracks the child processes until the process exits. The truss utility uses the following syntax to track processes that are running on the system:

truss -aef -p PID

where PID is the process ID of a currently running process.

To use truss with an executable command, use the following syntax:

truss -aef <command>

Table below lists the commonly used options of the truss  command and their descriptions. For a complete list of options, refer to the man pages for the truss  command.

The truss Command Options and Their Descriptions
Option Description
-a Displays the arguments to each exec()  system call.
-c Displays a summary of all the system calls made by a process.
-e Displays the environment of a running process.
-f Follows all child processes created by the fork  and vfork  system calls.
-o Saves the output of the command to a specified file.
-p Attaches the truss  command to a currently running process.

By default, the truss utility dumps the output to the stderr  file. You can save the output of the truss utility by using the -o  option with the truss  command. For example, to save the output of the truss  command to the trussoutput.out  file use the following command:

truss -aef -o /tmp/trussoutput.out -p PID


Most processes in the system are created by fork system calls. The fork system call makes a copy (child process) of the calling process (parent process) in a new address space in the virtual memory. The child process continues to execute on the CPU until it completes. On completion, the child process returns the resources to the system.

A process during its lifetime can exist in any of the following states: Init, Run, Sleep, and Zombie.

Processes running on a system affect the performance of the system because processes consume system resources, such as CPU time and memory. Therefore, it is important that you manage the processes running on the system. Managing the processes running on the system involves monitoring processes, determining processor usage, changing process priorities, and terminating processes


The Last but not Least Technology is dominated by two types of people: those who understand what they do not manage and those who manage what they do not understand ~Archibald Putt. Ph.D

Copyright 1996-2018 by Dr. Nikolai Bezroukov. was initially created as a service to the (now defunct) UN Sustainable Development Networking Programme (SDNP) in the author free time and without any remuneration. This document is an industrial compilation designed and created exclusively for educational use and is distributed under the Softpanorama Content License. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

FAIR USE NOTICE This site contains copyrighted material the use of which has not always been specifically authorized by the copyright owner. We are making such material available to advance understanding of computer science, IT technology, economic, scientific, and social issues. We believe this constitutes a 'fair use' of any such copyrighted material as provided by section 107 of the US Copyright Law according to which such material can be distributed without profit exclusively for research and educational purposes.

This is a Spartan WHYFF (We Help You For Free) site written by people for whom English is not a native language. Grammar and spelling errors should be expected. The site contain some broken links as it develops like a living tree...

You can use PayPal to make a contribution, supporting development of this site and speed up access. In case is down you can use the at


The statements, views and opinions presented on this web page are those of the author (or referenced source) and are not endorsed by, nor do they necessarily reflect, the opinions of the author present and former employers, SDNP or any other organization the author may be associated with. We do not warrant the correctness of the information provided or its fitness for any purpose.

The site uses AdSense so you need to be aware of Google privacy policy. You you do not want to be tracked by Google please disable Javascript for this site. This site is perfectly usable without Javascript.

Last modified: September 12, 2017