System Administration Guide

Processes and System Performance

Terms related to processes are described in Table 62-1.

Table 62-1 Process Terminology

Term 

Description 

Process  

An instance of program in execution.  

Lightweight process (LWP)  

Is a virtual CPU or execution resource. LWPs are scheduled by the kernel to use available CPU resources based on their scheduling class and priority. LWPs include a kernel thread, which contains information that has to be in memory all the time and an LWP, which contains information that is swappable. 

Application thread  

A series of instructions with a separate stack that can execute independently in a user's address space. They can be multiplexed on top of LWPs. 

A process can consist of multiple LWPs and multiple application threads. The kernel schedules a kernel-thread structure, which is the scheduling entity in the SunOS 5.x environment. Various process structures are described in Table 62-2.

Table 62-2 Process Structures

Structure 

Description 

proc

Contains information that pertains to the whole process and has to be in main memory all the time. 

kthread

Contains information that pertains to one LWP and has to be in main memory all the time. 

user

Contains the per process information that is swappable. 

klwp

Contains the per LWP process information that is swappable. 

Figure 62-1 illustrates the relationship of these structures.

Figure 62-1 Process Structures

Graphic

Most process resources are accessible to all the threads in the process. Almost all process virtual memory is shared. A change in shared data by one thread is available to the other threads in the process.

Commands for Managing Processes

Table 62-3 describes commands for managing processes.

Table 62-3 Commands for Managing Processes

Use This Command ... 

To ... 

ps

Check the status of active processes on a system, as well as display detailed information about the processes 

dispadmin

List default scheduling policies 

priocntl

Assign processes to a priority class and manage process priorities 

nice

Change the priority of a timesharing process 

See Chapter 63, Managing Processes (Tasks) for more information about commands for managing processes.

In addition, process tools are available in /usr/proc/bin that display highly detailed information about the processes listed in /proc, also known as the process file system (PROCFS). Images of active processes are stored here by their process ID number.

The process tools are similar to some options of the ps command, except that the output provided by the tools is more detailed. In general, the process tools:

The new /usr/proc/bin utilities are summarized in Table 62-4.

Table 62-4 Process Tools

Tools That Control Processes 

What the Tools Do 

 

/usr/proc/bin/pstop pid

Stops the process 

/usr/proc/bin/prun pid

Restarts the process 

/usr/proc/bin/ptime pid

Times the process using microstate accounting 

/usr/proc/bin/pwait [-v] pid

Waits for specified processes to terminate 

 

Tools That Display Process Details 

What the Tools Display 

 

/usr/proc/bin/pcred pid

Credentials 

/usr/proc/bin/pfiles pid

fstat and fcntl information for open files

/usr/proc/bin/pflags pid

/proc tracing flags, pending and held signals, and other status information for each lwp

/usr/proc/bin/pldd pid

Dynamic libraries linked into each process 

/usr/proc/bin/pmap pid

Address space map 

/usr/proc/bin/psig pid

Signal actions 

/usr/proc/bin/pstack pid

Hex+symbolic stack trace for each lwp

/usr/proc/bin/ptree pid

Process trees containing specified pids 

/usr/proc/bin/pwdx pid

Current working directory 

In these commands, pid is a process identification number. You can obtain this number by using the ps -ef command.

Chapter 63, Managing Processes (Tasks), describes how to use the process tool commands to perform selected system administration tasks, such as displaying details about processes, and starting and stopping them. A more detailed description of the process tools can be found in proc(1).

If a process becomes trapped in an endless loop, or if it takes too long to execute, you may want to stop (kill) the process. See Chapter 63, Managing Processes (Tasks), for more information about stopping processes using the kill command.

Process Scheduling Classes and Priority Levels

A process is allocated CPU time according to its scheduling class and its priority level. By default, the Solaris operating system has four process scheduling classes: real-time, system, timesharing and interactive.

The scheduling priority determines the order in which processes will be run.

Real-time processes have fixed priorities. If a real-time process is ready to run, no system process or timesharing process can run.

System processes have fixed priorities that are established by the kernel when they are started. The processes in the system class are controlled by the kernel, and cannot be changed.

Timesharing and interactive processes are controlled by the scheduler, which dynamically assigns their priorities. You can manipulate the priorities of the processes within this class.