The Open Source Swiss Army Knife

/code/c/unix_c/
/code/c/unix_c/ + sub-categories
http://www.sirfsup.com/
web directory content
    
      

Not logged in
Chat Register Login
return to:  http:/www.sirfsup.com      /code   /c   /unix_c 
Permalink: setpgid.txt
Title: setpgid
article options : please login   |  raw source view  

  1. Why do you have to call setpgid() when a process is supposed to run in the background?

When you create a process, it by default is created in a process group from which it was created ... When you run a command from the shell, the new process is created in that group ... and this group has a controlling tty ... obviously for backgrounding a process you need to disassociate from the controlling tty .... thus need for changing the process group

You create a separate group for the current process in which it will be the only process ... If setpgid creates groups if they do not exist, it will work like a charm


Leave a Reply
Your Name:     anonymous
Your Email:
Website:  
Comments:

The author will be notified of your reply.
return to top