| Lesson 3 | What is a process? |
| Objective | Define a UNIX process |
|
Unix Process: A process is an executing/running instance of a program. Processes are also frequently referred to as tasks.
Difference between a process and a 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 programyou 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.
- Do these number assignments only last as long as the process is running?
- Once a process is done running, does it no longer exist?
- In other words, can there only be a process during the actual time that it is running?
- Is there a way or any need to access what that pid number is for each process as it is running?
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.
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.
The next lesson describes how to start a new interactive shell.