-   Linux - Software (
-   -   Background and Foreground (

Datamike 01-20-2006 03:06 PM

Background and Foreground
Hi all,

I wanted to ask, since it has been annoying me greatly; what's the exact difference between running a program on the background or on the foreground? I see these terms a million times in various manuals and docs and it eludes me what they mean precisely.

haertig 01-20-2006 03:12 PM

Say you have a program that take 30 minutes to run (it's doing something MIGHTY intensive!)

You run it in the foreground, you'll sit there waiting at your terminal until it's done before your prompt comes back and you can interact with the OS again.

In the background, your prompt will come back immediately and you can interact [edit] with the OS [/edit] while this CPU-hog program is running "in the background". You cannot easily interact with the backgrounded program, so it should be programmed operate on it's own without user input.

Of course, you could always just open up a new terminal window, but the above explains what will happen if you're limiting yourself to only one terminal session.

Datamike 01-20-2006 04:20 PM

Thanks haertig, very clarifying

To extend my original question, I take it's generally possible to write a program (in whatever language; C/C++, Java, etc.) and by default set it to run in the background or the foreground? At least I think I've seen some programs behave this way, some even have commandline parameters that allows you to run it in either.

All times are GMT -5. The time now is 02:51 PM.