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