Process Control (14)---process group

Source: Internet
Author: User

in a Linux system, each process belongs to a process group, and each process group has a process group ID (pgid), and the value of the process group ID equals the process ID of the leader process. The first program that is typically executed under the shell becomes a leader process, and all subsequent processes that are related to this process are part of this process group (unless the child process uses the Setpgid function to change its own process group ID). =======================================================The Linux system provides the GETPGRP function and the Getpgid function to read the process group IDs of the processes, providing the Setpgid function to set the process group ID of the process. function Prototypes:function Parameters:
    • The GETPGRP function has no arguments and can only be used to read the process group ID that the calling process belongs to
    • The Getpgid function is used to read the process group ID of the process ID PID, which, when pid=0, is equivalent to the GETPGRP function
    • The Setpgid function is used to set the process ID of the process to PID for the process group ID of Pgid. If pid=0, it is equivalent to setting the process group ID of the calling process itself, or, if pgid=0, the same set process group ID and PID. Note that a process can only set a new process group ID for the process itself or its child processes, and that the new process group and the original process group must belong to the same session
return Value:
    • GETPGRP: Always called successfully, returns the process group ID of the calling process
    • Getpgid: Call failed to return the process group ID of the PID successfully returned-1
    • Setpgid: return 0 on successful call, return 1 if call fails

Process Control (14)---process group

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.