Process relationship job control (orphan Process Group)

Source: Internet
Author: User

1. Job Control

Job control is a feature that BSD added in 1980. A job is just a collection of several processes. Job control requires support in the following three forms:

1). shell that supports job control (C shell is supported, and Bourne shell is not supported, but Korn shell is based on the situation ).

2) The Terminal Driver in the kernel must support job control.

3) The kernel must support some job control signals.

Three special characters can signal the Terminal Driver:

1). Interrupt characters (delete or Ctrl + C) generate Sigint.

2). Exit character (CTRL +/) to generate sigquit.

3). The Hanging character (CTRL + Z) generates sigtstp.

Only foreground jobs can be input by terminals. If the background job tries to read the control terminal, the signal sigttin is generated. This signal usually stops this background job temporarily, while shell sends a notification to the user about this situation, and then the user can use shell commands to convert the job to the foreground job for execution. Terminal I/O and terminal signals are always connected to the actual terminal from the foreground process group. For sigttou signals, the output of background process group processes is optional when they are released. As follows:

# Cat temp.txt & executed in the background

[1] 1986

# Output of background jobs after the hello World prompt

Enter

[1] + done cat temp.txt &

# Stty tostop disable background job output to control terminal

# Cat temp.txt & executed in the background

[1] 1989

# Output of background jobs after the hello World prompt

# Press enter to find that the job has been stopped

[1] + stopped (sigttou) Cat temp.txt &

# FG % 1 resume a stopped job on the foreground

Cat temp.txt shell tells us which job is in the foreground

Hello World: This is the output of the job.

 

2. Orphan Process Group

A parent process that has been terminated is called an orphan process, which is adopted by the INIT process.

Orphan Process Group Definition: the parent process of each member in the group is either a member of the group or a member of the session to which the Group belongs.

A process group is not an orphan process group. The group has a process whose parent process belongs to another group of the same session.

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.