Unix/linux Programming Practice Tutorials

Source: Internet
Author: User

EXECVP start a new program in the program:

To create a new process with fork:

Forkdemo2 Code:

When testing the fork, refer to the Linux authoritative guide reading notes (3) using patches:

[Email protected] programming]#diff-C forkdemo2.c forkdemo2_new.c > Forkdemo2.Patch[email protected] programming]#Patch< Forkdemo2.PatchPatchingfileForkdemo2.c[[email protected] programming]#ls-Lrttotal7-rwxrwxrwx1Root root4953Sep6  One: toForkdemo2-rwxrwxrwx1Root root4957Sep6  One: -forkdemo2_new-rwxrwxrwx1Root root119Sep6  One: -forkdemo2_new.c-rwxrwxrwx1Root root263Sep6  One: -Forkdemo2.Patch-rwxrwxrwx1Root root119Sep6  One: - forkdemo2.c[[email protected] programming]# 

This FORKDEMO2 output PID number is also very interesting, preferably from the bottom of the bargain.

How to determine whether a parent or child process: The return value of fork () in the parent process is the PID of the child process, which is 0 in the child process.

Unix/linux Programming Practice Tutorials

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.