Penguin

Differences between version 2 and previous revision of JobControl.

Other diffs: Previous Major Revision, Previous Author, or view the Annotated Edit History

Newer page: version 2 Last edited on Wednesday, December 6, 2006 7:37:24 pm by PerryLorier Revert
Older page: version 1 Last edited on Wednesday, December 6, 2006 7:35:10 pm by PerryLorier Revert
@@ -8,13 +8,13 @@
 ;Control-Z:Suspend the currently running job 
 ;jobs:List all current jobs. 
  
 !!How this works 
-Internally each command line (job) gets it's own ProcessGroup assigned to it by the shell when it creates the job. While the command is running in the foreground it recieves any signals from the tty layer (such as [SIGTSTP], [SIGINT], [SIGQUIT], [SIGHUP] etc). 
+Internally each command line (job) gets it's own ProcessGroup assigned to it by the shell when it creates the job using [setsid(2)] . While the command is running in the foreground it recieves any signals from the tty layer (such as [SIGTSTP], [SIGINT], [SIGQUIT], [SIGHUP] etc). 
  
 If you press ^Z the ProcessGroup gets sent a [SIGTSTP]. If the process(es) ignore the [SIGTSTP], this is converted by the kernel into a [SIGSTOP]. When a process recieves a [SIGSTOP] it's parent (the shell) will get notified (via a [SIGCHLD]), and will mark that job as being "Stopped". 
  
-When you type "fg" or "bg", then the process is started with a [SIGCONT], and in the case of fg, tcsetpgrp(3) is called to make that ProcessGroup the new foreground ProcessGroup. 
+When you type "fg" or "bg", then the process is started with a [SIGCONT], and in the case of fg, [ tcsetpgrp(3)] is called to make that ProcessGroup the new foreground ProcessGroup. 
  
 When the shell recieves a [SIGHUP] (presumably from the terminal going away), then it will send a [SIGHUP] to each job. If a job is also "Stopped" then the shell will also send it a [SIGCONT]. Depending on your shell, exiting the shell with ^D, "exit", "logout","exit 0" etc may or may not cause jobs to recieve the [SIGHUP]. 
  
 The disown builtin may be used to remove a process group from the shells list of jobs, so when the shell exits it doesn't send that process a [SIGHUP].