1

I have one doubt in linux process

case 1:(here no Firefox is open)

suppose if I open a firefox from command terminal using this command firefox & then process will start in the background.

Now if I exit the Terminal Firefox also exit

case 2:(here one Firefox is already open)

Now if I open a firefox from command terminal using this command firefox & then process will start in the background.

But now if I exit the terminal nothing will to second Firefox (opened by Terminal) why?

In case 1 it will close, what is happening in case 2 ?

2 Answers 2

3

In case 2 happens almost the same thing. The difference is that firefox is a single-instance application and if on startup it finds its copy running does this:

  1. Sends command-line arguments to running instance using IPC
  2. Exits

This is simplified algorithm, since some arguments can lead to other behavior, but most of the time all happens as above.

So background process exists less than a second in the 2nd case, while previously launched firefox instance continue to run independently of terminal.

3
  • In case 2 I observed this First I opened a Firefox after that I opened one terminal and created one new process using this firefox & after that I checked process using ps -ef then it's showing this... [1]+ Done firefox Commented Aug 21, 2012 at 7:19
  • @raj that is because shells check status of background processes before printing command prompt to make it more expected for user. Commented Aug 21, 2012 at 7:25
  • I got the answer thanx Commented Aug 21, 2012 at 7:27
3

In case 1, you start a brand new firefox proc "bound" to the terminal, killing the terminal it subsequentially kill all bound processes

In case 2 even if you start FF invoking the & (in background) FF already have a master proces open and the new window will be opened as "child" of the other so, bound to that not to the terminal. Hence killing the terminal still kill all bound processes, not ff which is not "his" child

2
  • Then what will happen to previous process ID? Commented Aug 21, 2012 at 7:06
  • @raj: Absolutely nothing. Commented Aug 21, 2012 at 7:17

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.