1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Discuss in my forum

Process

Introduction to Computer Activity

By

In order to understand what a process is, in the context of computer technology, we need to start with the basic design and functionality of a computer. A computer is essentially a machine that has the capability to load a program (software) that makes the machine behave as specified in that program. It can actually load several programs at the same time and execute them simultaneously. If you consider a computer analogous to a brain, a process would correspond to a train of thought, and multiple processes would correspond to a "mind". Some people define "mind" as "what the brain does." Analogous to that, "processes" would be what a computer does. For example, learning the rules of how to play chess would be analogous to loading a chess program into the computer memory. Executing that program and playing an actual chess game then constitutes a process. The key components of a computer are processors, short term memory devices or RAM, which stands for "Random Access Memory", and long term memory devices (usually disks).

Multi-Processing

One big difference between a computer and a brain is that the computer is much better at executing multiple programs simultaneously. If a computer has multiple processors, each processor can execute a different program. Or the computer can use "time-slicing" to switch one processor between different programs, which may also be called "tasks" or "jobs". While some people may good at multi-tasking a few different activities, computers can easily execute hundreds of different tasks at the same time, without getting confused or schizophrenic. Different processes can interact by accessing the same files or by accessing the same memory locations. Special care needs to be taken when running multiple processes that interact with each other, as the order in which actions are taken by the different processes is not always predictable.

Foreground Processes - Background Processes

One way to run multiple processes at the same time is put them in the "background" as you start them from a command line (shell window). When you start a process (task) in the background, the shell doesn't wait for that process to finish before returning to interactive mode and accepting additional commands. Besides the memory limitations of your system, there are no limits on the number of background commands you can enter. In order to run a command as a background process you type a space and an ampersand after the command. For example:

$ command1 &

After hitting return, the shell will execute this command and immediately return the shell prompt (typically a '%' for the C Shell, and a '$' for the Bourn and Bash shells), which indicates it is ready for the next command. Background jobs are generally run at lower priority than foreground jobs. You can track all your processes with the ps or top commands.

Unlike background jobs, foreground processes may present an interactive graphical user interface, and you have to wait for a foreground process to finish before you can start another process from the same shell. To start a foreground process, enter a command at the prompt followed by a return. For example:

$ cat file1

The next prompt only appear after the command1 finishes.

Processes versus Threads

Modern programming languages allow the software developers to specify parallel execution of code. This is frequently done in order to take advantage of computer architectures with multiple processors (CPUs) or cores. Sometimes processors are called "cores" if they are associated with other processors in an particular architecture that optimizes their performance. In that case a CPU is said to contain multiple cores.

In general there is no fixed relationship between a (Linux) process and a processor. The operating system assigns a process to a random processor and may switch the processor for that process at any time. Threads are a mechanism for a programmer to specify separate processes from within a program. The operating system will try to associate each thread/process with a separate processor. If there are more threads/processes than processors/cores, some processors/cores may execute multiple threads/processes by switching between them.

  1. About.com
  2. Technology
  3. Linux
  4. Linux Documentation
  5. Computer Process

©2014 About.com. All rights reserved.