“Unix Processes & Job Control”
Processes and jobs are essentially one in the same thing in Unix. Processes or jobs are actually commands or programs running on the system. From the shell typing in a command executes that as a running process until it is finished, so far in this class most of the commands have been simple and finish by outputting the results of the command to the screen or to a file if redirected. In these cases the shell just enters a dormant period waiting for the command to finish. As users we do have the option of sending commands to be run in the background, which will return the shell to the user allowing them to continue working on other things. The user also has ability to view jobs running in the background, switch back to the running process, or even forcefully terminate the process.
A process is any form of executable code that is currently running, can be run in the future or ran in the past. It can be compiled or it can be a script which is also something that can be used to automate a series of other processes. Job control can also be performed manually by an operator to change the priority of execution (foreground or background) or to suspend or kill a job if necessary. It can be defining a group of processes that will be run sequentially with the use of the pipe ( | ) and redirecting input and output. All this and more can also be accomplished by using a script to allow one person to setup a series of jobs to be run and even allow it some intelligence as to when. A example of this might be to run a utility, only if the boss is not on line. This might be for any number of reasons including that the boss may run a program that causes conflict with the utility and crashes the system.
When you execute a program on your UNIX system, the system creates a special environment for that program. This environment contains everything needed for the system to run the program as if no other program were running on the system. Whenever you issue a command in UNIX, it creates, or starts, a new process. When you tried out the ls command to list directory contents, you started a process. A process, in simple terms, is an instance of a running program. The operating system tracks processes through a five digit ID number known as the pid or process ID . Each process in the system has a unique pid. Pids eventually repeat because all the possible numbers are used up and the next pid rolls or starts over. At any one time, no two processes with the same pid exist in the system because it is the pid that UNIX uses to track each process.
Job control in computering refers to the control of multiple tasks or jobs on a computer system, ensuring that they each have access to adequate resources to perform correctly, that competition for limited resources does not cause a deadlock where two or more jobs are unable to complete resolving such situations where they do occur, and terminating jobs that, for any reason, are not performing as expected.
When it comes to UNIX/Linux processes and jobs can be interchangeable terms because they both basically refer to the same thing. A process is something that can run, or something that can be executed. A command or a program can be considered a process under this logic. Once a command is executed by the user and runs on the system and eventually displays an output then a process has occurred. Note that this type of process is a foreground process. A background process is when the command or program runs in the background without tying up the shell and output for the user. This ties right in along the concept of job control which has to do with whether jobs run in the foreground or background and where or how results are displayed.
A process in UNIX is when the operator issues a command to the system. There are two types of process that run in a system they are Foreground and Background. The default process for a system is the foreground process, this one gets its input from the keyboard and sends the output to the screen. A background process is the one that runs without being connected to the keyboard or sending an output to the display. The simplist version of a foreground process is running the command $ls ch* .doc, this is the command that displays the contents a file. To start a background process all that would be needed is the addition of the ampersand (&) same command but it would look like this $ls ch* .doc &.
Job control refers to the orchestration of multiple batch jobs.