Processes, Jobs, and Threads

The Process

These independent tasks, each able to be scheduled separately from the others, are called processes. When you log into the system, a new process is created for your use. Your login session becomes one of the tasks the system can switch among.

But the process is not just an entity that can be scheduled for CPU attention; it provides the environment in which you work. The process keeps track of which program you are running, what files you have open, your current directory, your identity, your priority, your access rights, and your privileges, to name just a few.

Many parts of OpenVMS itself are also implemented as processes, but these processes are automated and proceed without a human user to direct their actions. Other automated processes can run under the identity of a certain user and enjoy the same access rights to files and other objects as that user would.

Different types of processes are grouped into modes, according to their characteristics. The modes are described in the following subsections.

The Interactive Process

An interactive process is one directly associated with a user. An interactive process is created for you when you log into the system. This process executes your commands to the system, and when you log out, the process is destroyed.

This type of process is referred to as interactive, because you, the user, interact with the system through it. An interactive process is associated with your terminal, whether it is an actual physical terminal or a terminal emulator program used from a different computer.

None of the other types of process described below is normally associated with a user's terminal (except a subprocess, via the ATTACH command).

The Detached Process

A detached process is one that exists totally independently of other processes. It can continue to exist after the process that created it has terminated. OpenVMS itself uses a number of permanent detached processes to perform various system functions.

Some detached processes are used to perform tasks that need to be performed often, but at unpredictable times. They usually hibernate when there is no work to be performed, but awaken in response to certain events, as needed. Other detached processes awaken at regular intervals to check whether there is any work to do.

A user holding the proper privileges may create detached processes, but depending on the type of work to be performed, it may be more appropriate (and easier) to use a batch process for repetitive tasks.

The Batch Process

A batch process is a process that executes a command procedure that you submit to be executed on your behalf. A command procedureis a file containing CLI commands that are executed sequentially, like a program. You request the execution of a batch job by submitting the command file to a batch queue, discussed later. Batch jobs are often used to perform time-consuming or recurring tasks.

Technically, a batch process is quite similar to a detached process, except that batch processes are associated with an entry in a batch queue, and they terminate when the command procedure ends. Batch jobs that need to run at intervals can include a command to resubmit themselves for a later time.

The Subprocess

A subprocess is a child process of an existing process and depends upon its parent process for its existence and resources. It usually performs some service for the parent process—for example, using CLI commands from within a compiled program or executing a command that may take a long time. Using a subprocess to execute a time-consuming command allows you to continue entering and processing commands while the subprocess works on the time-consuming one.

Normally, a subprocess finishes its work and terminates before its parent process does. A subprocess that still exists when the parent process ends is automatically destroyed, whether its work is finished or not.

When you create a subprocess from an interactive process, the subprocess will also be an interactive process. Likewise, a batch process will create a batch-mode subprocess.

The Network Process

A network process is essentially a detached process that performs network functions. For example, if you request access to a file on a remote OpenVMS system, the remote system will create a network process to carry out the request for you. It works with your process to pass data back and forth or to manipulate the remote file as needed.

Please note that some processes may be dedicated entirely to network-related functions but not be in network mode.

The Other Process

There is one final process mode, other, which really only means that the process is not marked as being in any of the previously described modes. These processes are relatively infrequent and can usually be considered equivalent to detached processes.

Examining System Processes

To see a list of processes currently present on your system, use the Digital Command Language (DCL) command SHOW SYSTEM:

start figure

 $ SHOW SYSTEM OpenVMS V7.3  on node PHOEBE  27-OCT-2002 13:15:17.22 Uptime  5 01:52:10   Pid    Process Name    State  Pri      I/O       CPU      Page flts  Pages 00000081 SWAPPER         HIB     16        0   0 00:00:26.08        0      0     (2) 00000084 LANACP          HIBO    13       --  swapped  out  --           482     (2) 00000086 IPCACP          HIB     10        7   0 00:00:00.23      159     92     (2) 00000087 ERRFMT          HIB      8     4278   0 00:00:19.68     2443    112     (2) 00000089 OPCOM           HIB      8    15579   0 00:01:19.92    54144    117     (2) 0000008A AUDIT_SERVER    HIB     10     5711   0 00:01:11.87    68318    175     (2) 0000008B JOB_CONTROL     HIB     10     9227   0 00:00:32.84    57855    139     (2) 0000008C QUEUE_MANAGER   HIB     10    13013   0 00:03:29.95   100718    365     (2) 0000008D SECURITY_SERVER HIB     10      590   0 00:00:53.93   180636    144     (2) 0000008E TP_SERVER       HIB     10    30010   0 00:05:18.78    64589    159     (2) 0000008F NETACP          HIB     10    18555   0 00:01:07.38    11114     87     (2) 00000090 EVL             HIB      6       59   0 00:00:00.62    13001     73  N  (2) 00000091 REMACP          HIB      8       67   0 00:00:00.27      244     62     (2) 00000092 MIKE            LEF      5     3774   0 00:00:34.81    25784    311     (1) 00000093 MULTINET_SERVER LEF      5    93461   0 00:02:45.87     1069   1095     (3) 00000094 NAMED_SERVER    HIB      6    67687   0 00:02:43.62    69791    964     (3) 00000095 SMTP_SYMBIONT   HIB      5     8159   0 00:01:08.35    48831     82     (3) 00000097 WWW server 80   HIB      6   105114   0 00:08:03.21    20325   1153  N  (3) 00000098 WEBSERVER_1     LEF      6       39   0 00:00:00.49     8620     55  S  (5) 00001EB8 MIKE_RTA1:      CUR      4     4003   0 00:00:19.79    14998    600     (1) 000003C1 SERVER_0005     LEF      6    63112   0 00:12:52.38   273834     62  N  (3) 000003C2 SERVER_0004     LEF      6    25314   0 00:05:19.08   138728     58  N  (3) 00001F2D BATCH_223       COM      2    52914   0 00:13:04.27   202133    388  B  (4) 

end figure

Figure 3-1: System Processes

Each line in the display describes one process. This display includes most of the process types described previously.

There are two interactive processes for user MIKE (1): the normal system detached processes (2); some detached processes performing TCP/IP network functions (3); a batch process (4); and a subprocess (5). An "S" at the right edge of the display denotes a subprocess, an "N" denotes a network mode process, and a "B" denotes a batch process.

The Job

In OpenVMS terminology, the term job refers to a collection of processes consisting of a parent process, all of its subprocesses, all of their subprocesses, and so on.

In the previous example, the process WEBSERVER_1 is a subprocess of WWW server 80. Taken together, they are called a job. The letter "S" at the right of the display indicates a subprocess.

To prevent a single job from consuming an excessive number of system resources, certain resources are shared among all processes in a job. The total amount of a particular resource used by all processes in the job cannot exceed a certain limit. Resource quotas and limits are discussed in Chapter 4, "User Accounts". This concept bears repeating: Some system resources are shared among processes in a job, a concept that can guide the development of complex applications, portions of which may have high demand for system resources. This implies that the root cause of a resource-limit problem can sometimes lie outside the process experiencing the problem.

The Thread

A thread refers to a schedulable entity within a process that is able to execute independently. Just as a process is a separate schedulable task under the operating system, a thread is a separate schedulable task within a process.

Multiple threads allow different parts of the same program to execute simultaneously on different processors, potentially improving the performance of an application. Threads may also be used to divide a complex program into simpler conceptual units.

Threads are generally of interest only to programmers writing complex applications and are not covered in detail in this book.

Summary

This section has introduced the various types of processes you will encounter on an OpenVMS system. Creating batch processes and subprocesses is discussed in Chapter 7, "The User Environment."



Getting Started with OpenVMS(c) A Guide for New Users
Getting Started with OpenVMS: A Guide for New Users (HP Technologies)
ISBN: 1555582796
EAN: 2147483647
Year: 2005
Pages: 215

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net