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

Discuss in my forum

Multitasking: Background Process and Foreground Process

By

As a multitasking operating system, Linux allows you run multiple processes in the background while you continue to work in the foreground. Let me explain how this works.

Background Process

Unlike with a foreground process, the shell does not have to wait for a background process to end before it can run more processes. Within the limit of the amount of memory available, you can enter many background commands one after another. To run a command as a background process, type the command and add a space and an ampersand to the end of the command. For example:

$ command1 &

Immediately after entering the above command, the shell will execute the command. While that is running in the background, the shell prompt (% for the C Shell, and $ for the Bourne Shell and the Korn Shell) will return. At this point, you can enter another command for either foreground or background process. Background jobs are run at a lower priority to the foreground jobs.

You will see a message on the screen when a background process is finished running.

Foreground Process

A foreground process is different from a background process in two ways:

1. Some foreground processes show the user an interface, through which the user can interact with the program.
2. The user must wait for one foreground process to complete before running another one.

To start a foreground process, enter a command at the prompt, e.g.,

$ command1

The next prompt will not appear until command1 finishes running.

--------------------
To learn more Linux words and jargon, visit the Linux Glossary.

Related Video
Add a Background Image to a Webpage
iMovie New Project
  1. About.com
  2. Technology
  3. Linux

©2014 About.com. All rights reserved.