C/C ++ on Liunx platform Article 3: process control

Source: Internet
Author: User

Take the rest of these two days and release the basic C linux API and standard library content ~~, As a record, it is also for your reference. Please submit comments more.

The Create process API is defined in unistd. h.
Function prototype:
Pid_t fork (void );
The child process returns 0, and the parent process returns the child process pid.
If the parent process does not process the exit status of the child process, the child process becomes Z process.
Avoid Z process:
1. Use pid_t waitpid (pid_t, int *, int); to block and wait for the sub-process to exit.
2. The parent process uses singal for asynchronous processing. When the child process ends, SIGCHLD signal is sent to the parent process. The parent process receives SIGCHLD and then calls waitpid ().
For the definition and operation of signals, see signal. h.

<To be continue...>

 

From leonzhang

Related Article

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.