Linux process communication----Anonymous pipeline

Source: Internet
Author: User

The simplest way to communicate with Linux processes is through anonymous pipelines

The creation of anonymous pipelines requires the use of the pipe function, the pipe function parameter is an array

represents the file description word. This array has two file description words, the first one is to use a

the file descriptor for the read data The second is a file descriptor for writing data.

You cannot use a file descriptor for write read operation or read file description

Identifier write operations, which can cause errors.

A few notes about anonymous pipelines:

1. The anonymous pipeline is half-duplex, that is, a process can read only, and a process can write only

To achieve full duplex, two anonymous pipes are required.

2. Communication can only be done in a parent-child or sibling process.

3. Close the Write file descriptor when reading, close the read file descriptor when writing

The code is implemented as follows (parent-child communication):

Linux process communication----Anonymous pipeline

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.