Previous Page
Next Page

Managing Processes

A process is distinct from a job or command, which can be composed of many processes working together to perform a specific task. Each process has a process ID associated with it and is referred to as a pid. You can monitor processes that are currently executing by using one of the commands listed in Table 18.

Table 18. Commands to Display Processes

Command

Description

ps

Executed from the command line to display information about active processes.

pgrep

Executed from the command line to find processes by a specific name or attribute.

prstat

Executed from the command line to display information about active processes on the system.

psrinfo

Displays one line for each configured processor, displaying whether it is online, noninterruptible, offline, or powered off, as well as when that status last changed.

pargs

Used from the command line to examine the arguments and environment variables of a process (or number of processes). pargs can also be used to examine core files.

sdtprocess

A GUI used to display and control processes on a system. This utility requires a terminal capable of displaying graphics.

SMC

The Solaris Management Console Processes Tool to view, suspend, resume, and delete processes.


A process has certain attributes that directly affect execution. These are listed in Table 19.

Table 19. Process Attributes

Attribute

Description

PID

The process identification (a unique number that defines the process within the kernel).

PPID

The parent PID (the creator of the process).

UID

The user ID number of the user who owns the process.

EUID

The effective user ID of the process.

GID

The group ID of the user who owns the process.

EGID

The effective group ID that owns the process.

Priority

The priority at which the process runs.


Using the kill Command

The kill command sends a terminate signal (signal 15) to the process, and the process is terminated. Signal 15, which is the default when no options are used with the kill command, is a gentle kill that allows a process to perform cleanup work before terminating. Signal 9, on the other hand, is called a sure, unconditional kill because it cannot be caught or ignored by a process. If the process is still around after a kill -9, it is either hung up in the Unix kernel, waiting for an event such as disk I/O to complete, or you are not the owner of the process.

Another way to kill a process is to use the pkill command. A signal name or number may be specified as the first command-line option to pkill. For example, to kill the process named psef, issue the following command:

pkill -9 psef

A way to divide processes on a busy system is to schedule jobs so that they run at different times. A large job, for example, could be scheduled to run at 2 a.m., when the system would normally be idle. Solaris supports three methods of batch processing: the crontab command, at command, and SMC Job Scheduler tool. The crontab command schedules multiple system events at regular intervals, and the at command schedules a single system event for execution at a later time.

The cron daemon handles the automatic scheduling of crontab commands. Its function is to check the /var/spool/cron/crontab directory every 15 minutes for the presence of crontab files. It checks for new crontab files or changes to existing ones, reads the execution times listed within the files, and submits the commands for execution at the proper times.

Table 20 describes the fields in the crontab file for scheduling jobs to run on a regular basis.

Table 20. The crontab File

Field

Description

Values

1

Minute

059. An * in this field means every minute.

2

Hour

023. An * in this field means every hour.

3

Day of month

131. An * in this field means every day of the month.

4

Month

112. An * in this field means every month.

5

Day of week

06 (0 = Sunday). An * in this field means every day of the week.

6

Command

Enter the command to be run.


Control who can access the crontab by configuring /etc/cron.d/cron.deny and /etc/cron.d/cron.allow. These access control files work together in the following manner:

  • If cron.allow exists, only the users listed in this file can create, edit, display, and remove crontab files.

  • If cron.allow doesn't exist, all users may submit crontab files, except for users listed in cron.deny.

  • If neither cron.allow nor cron.deny exists, superuser privileges are required to run crontab.

The Solaris Management Console (SMC) includes a graphical tool to create and schedule cron jobs on your system. You can use the Job Scheduler Tool to

  • View and modify job properties.

  • Delete a job.

  • Add a scheduled job.

  • Enable or disable job logging.

The Job Scheduler tool is really just a GUI for managing crontab enTRies.

Projects and Tasks

Projects and tasks are used to identify what is called a workload. For projects, this means some related work, such as payroll development. For tasks, it means a group of processes that represent a component of a workload, such as calculation of pay.

The concept behind projects is to be able to identify the separate workloads that are running on the system, and then to administer and report on them individually. Projects are useful when using a chargeback method to "bill" each project for resource usage. This allows the extended accounting software to identify how much resource a particular project has used.

A user or group can belong to one or more projects and also can be assigned a default project, very similar to the standard Solaris group membership mechanism. Project administration is carried out using the file /etc/project.

Table 21 lists a number of commands that are used to administer projects and tasks.

Table 21. Project and Task Administration Commands

Command

Description

projects

Prints the project membership of a user.

newtask

Executes the user's default shell or specified command, placing the command in a new task that is owned by the specified project.

projadd

Adds a new project entry to the /etc/project file.

projmod

Modifies a project's information held in the /etc/project file.

projdel

Deletes a project entry from the /etc/project file.

id

Used with the -p option, prints the current project ID in addition to the user and group IDs.



Previous Page
Next Page