Relationship between sigchld and wait/waipid Functions

Source: Internet
Author: User
  1. Sigchild is only a signal value sent to the parent process when the child process exits. This is a way to asynchronously notify the parent process. the parent process can capture and ignore this signal. The default action is to ignore this signal.
  2. Generally, when a sigchild signal occurs, the main process calls waitpid or wait in the signal processing function of sigchild to reclaim the end state of the sub-process. But you need to understand:Waitpid or wait does not rely on the arrival of the sigchld signal to determine whether the sub-process is terminated. (It may be determined by checking the sub-process status through round-robin. It can be determined only by checking the specific code implementation ), that is, the wait/waitpid does not depend on the sigchild signal.In the sigchild signal processing function, wait/waitpid is often called to reclaim the sub-process status to avoid unnecessary round patrols of wait/waitpid. It is a method to save resources, but this is not necessary.

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.