A what is a process
1 in a Linux system, when any event is triggered, the system defines it as a process and gives the process an ID, called a PID, and gives this PID a set of valid permissions based on the relationship between the user and the associated attribute that triggers the process.
2 We said that the system should only know binary files, then when we want to let the system work, of course, we need to start a binary file, the binary file is the program
3 programs: Usually for binary programs placed in the storage medium (such as hard disk, CD-ROM, floppy disk, tape, etc.), in the form of physical files
Process: After the program is triggered, the performer's permissions and attributes, the program code and the required data will be loaded into memory, the operating system and give this memory unit an identifier PID, it can be said that the process is a running program
4 after two bash is executed consecutively, the second bash's parent process is the previous bash, because each process has a PID, and the parent process of the process can be judged by ppid
5 a process called Fork-and-exec in Linux process invocation: Processes produce an identical process through the parent process to replicate fork, and then the replicated subprocess executes the actual process in exec mode, eventually becoming a child process.
The 6 system first replicates a fork process in the same way as the parent process. The only difference between this process and the parent process is that the PID is different, but the staging process will have one more ppid parameter, and then the staging process begins to load the actual program to execute in EXEC mode, eventually becoming a child process.
Two work management
1 in the conduct of work management, virtually every job is currently a child of Bash, which is related to each other. That is, we cannot manage Tty2 bash from the tty1 environment in a job-managed manner
2 Suppose I have only one terminal, so the environment in which you can get a prompt to operate is called the foreground, and other jobs can let you put in the background to suspend or run. It is important to note that the job that goes into the background must not be able to interact with the user when it wants to run.
3 in summary, the restrictions on job management are:
1 processes triggered by these jobs must come from the child process of your shell
2 Front Desk: You can control and execute the command of this environment called the foreground work
3 Background: You can run your own work, you cannot use CTRL + C to terminate it, you can use BG/FG to invoke the work
4 the "execute" process in the background cannot wait for input from the terminal
4 direct the command into the background of the "execute" and, this & represents "the work into the background, not afraid of being interrupted by CTRL + C
5 Throw the current job into the background "suspend", ctrl+z
6 in the general mode of VI, press CTRL+Z these two buttons, the screen will appear above [1], indicating that this is the first job, and that + represents the most recent one was thrown into the background of the work, and currently in the background under the default will be taken to use the work. And stopped says the job is suspended.
7 in fact, work in the background + Representative is recently put in the background of the work number,-on behalf of the last second was placed in the background of the work number, and more than the last three work, there will be no-/-symbol exists
8 The backstage work to the front desk to handle FG,FG%jobnumber,jobnumber is the work number
9 let work in the background of the state into Operation BG,BG%jobnumber,jobnumber is the work number
10 manage the work in the background kill
Kill-signal%jobnumber
-1, re-read the configuration file of the parameter again
-2, representing the same operation as the keyboard input CTRL + C
-9, immediately force delete a job
-15, terminate a job with a normal program, and forcibly delete the work
The number that is followed by the kill will be PID by default, and if you want to manage bash's work control, you'll need to add a% number.
12 Offline management issues
1 we refer to in the work management "backstage" refers to in the terminal mode can avoid CTRL + C interruption of a situation, not put in the background of the system
2 We can use the Nohup command to implement the real system in the background to run
Nohup command and parameter--> at the front desk of the terminal
Nohup commands and Parameters &--> work in the background of the system
3 Nohup does not support bash's built-in commands, so your command must be external.
4 You can use the Nohup command if we want to get the work done in the background to continue after you log off