Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 ?

share|improve this question

2 Answers 2

up vote 3 down vote accepted

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.

share|improve this answer
    
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 –  max Aug 21 '12 at 7:19
    
@raj that is because shells check status of background processes before printing command prompt to make it more expected for user. –  xaizek Aug 21 '12 at 7:25
    
I got the answer thanx –  max Aug 21 '12 at 7:27

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

share|improve this answer
    
Then what will happen to previous process ID? –  max Aug 21 '12 at 7:06
    
@raj: Absolutely nothing. –  Ignacio Vazquez-Abrams Aug 21 '12 at 7:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.