Summary of MPs queue rules

Source: Internet
Author: User

In the process communication mode, there is an unknown pipeline. Pay attention to the following rules for read/write operations on pipelines:

1. When reading:

(1) There is a write end, at least one process, and a write end exists.

Data available: Read can be used to read data in pipe, and the actual number of bytes read is returned.

No data: blocking, waiting for other processes to write data to the pipeline.

(2) No write end. All processes and writes are disabled.

Data available: Read can be used to read data in pipe, and the actual number of bytes read is returned.

No data: No write end means that all write descriptors are disabled and no data is written to the pipeline. 0 is returned immediately.

2. When writing:

(1) There is a read end, at least one process, and the read end exists.

Available space: You can use write to write content to the pipeline and return the actual number of bytes written.

Insufficient space: the number of writes and the number of blocked waits that have not been written are not written until other processes read data in the pipeline. You can write a program to test the size of an unknown pipeline. (64 K)

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M01/49/4A/wKiom1QSlX7iicNlAAHRGrsppJk086.jpg "Title =" Column895-1.jpg "alt =" wkiom1qslx7iicnlaahrgrsppjk086.jpg "/>

(2) No read end. All processes and writes are disabled.

When there is no read end, if you want to write the pipeline, you will get the sigpipe signal from the kernel. Pipe rupture.

When the read end of the MPs queue does not exist, the kernel cannot write data to the MPs queue. The following procedures can be verified:

650) This. width = 650; "src =" http://s3.51cto.com/wyfs02/M00/49/4C/wKioL1QSlaHTYgnsAAJU7VklsVE933.jpg "Title =" Column895-2.jpg "alt =" wkiol1qslahtygnsaaju7vklsve933.jpg "/>


This article from the "embedded learning world" blog, please be sure to keep this source http://farsight.blog.51cto.com/1821374/1551582

Summary of MPs queue rules

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.