When you learn UNP, you learn to quit the shell after adding the character "&" after the command, and the commands you run can continue to run. Puzzled reason, and to the Internet search the following, understand.
The following are the fragments of the search:
& placed after the start parameter indicates that this process is set up as a background process
By default, the process is the foreground process, then the shell is occupied, we can not do other operations, for those who do not interact with the process, many times, we would like to start it in the background, you can start the parameters of the time to add a ' & ' to achieve this.
Such as:
Tianfang > Run &
[1]11319
Tianfang >/GAME.E 1 &
When the process switches to the background, we call it the job. When you switch to the background, the related job information is output, with the preceding output as [1]11319: [1] means that the Jobid is 1,11319 to indicate that the process ID is 11319. Switches to the background process, still can be viewed with the PS command.
switch between front and back station
The BG (background) and FG (foreground) commands can be used to toggle the state between the former background.
Daemon Process
If a process is always started in the background and cannot be exited by the shell exit effect, it is an orthodox practice to create it as a daemon. The daemon is worth the long running background process of the system, similar to Windows services. Daemon information through the ps–a can not see, need to use the –x parameters, when using this command, often attach-j parameters to view job control information, where Tpgid a column of 1 is the daemon process.
tianfang> PS XJ
PPID PID pgid SID TTY tpgid STAT UID time COMMAND
953 1190 1190 1190? -1 Ss 1000 0:00/bin/sh/usr/bin/startkde
1 1490 1482 1482? -1 Sl 1000 0:00/usr/bin/vboxclient–seamless
1 1491 1477 1477? -1 Sl 1000 0:00/usr/bin/vboxclient–display
The most critical step in creating a daemon is to call the SETSID function to create a new session and become a sessionleader. The result of a successful call to this function is to create a new session in which the current process becomes sessionleader, and the ID of the current process is the ID of the session. Creates a new process group, the current process becomes the leader of the process group, and the ID of the current process is the process group ID If the current process has a control terminal, it loses the control terminal and becomes a process with no control terminal. More please refer to: http://www.cnblogs.com/TianFang/archive/2013/01/23/2872645.html