Shell Processes   «Prev  Next»
Lesson 3 What is a process?
Objective Define a UNIX process

Define Unix Process

Unix Process: A process is an executing or running instance of a program and processes are also frequently referred to as tasks.

Difference between Process and Program

The definition of a process depends on the difference between a process and a program.
A program is a static entity, a file that resides on the disk. An example is the

/bin/ls program 

you use to list files in the current directory. When you run a program, you create a process. In other words, a process is a running. If five users run the ls command, they create five processes. A process is an active entity in the memory and CPU of your machine.
UNIX assigns a unique number to each process called a PID number.

  1. Do these number assignments only last as long as the process is running?
  2. Once a process is done running, does it no longer exist?
  3. In other words, can there only be a process during the actual time that it is running?
  4. Is there a way or any need to access what that pid number is for each process as it is running?
When the process completes, the PID number is reclaimed and can be used again when another process is started.
When you login to your shell account, UNIX starts a shell process for you.

This shell process

Should this word say program or process?
You said process in the last sentence, so I am confused.

You use the ps command to see a list of the processes you are currently running on the system. You should see your shell listed in the output.
Question: Why is the shell itself a process?
When you run a shell script, UNIX will create a new shell process with a new PID number.
The following image shows a sample ps command and its output. In this example, the user is running only the Bourne shell (the /bin/sh program), which is displayed as sh.

Use the ps command to display the unix processes

The next lesson describes how to start a new interactive shell.