LINUX study note 12-inter-process communication 1 pipeline
Source: Internet
Author: User
1. overview: a) why communication between processes: data transmission, resource sharing, notification events, process control, and B) basic Source: 1. UNIX process communication: 2. inter-process communication based on systemv: a) systemv: a branch of the UNIX operating system interface 3. posix inter-process communication... 1. overview:
A) why inter-process communication: data transmission, resource sharing, notification events, and process control;
B) basic Source:
1. UNIX process communication:
2. Inter-process communication based on system v:
A) system v: a branch of the UNIX operating system interface
3. Posix inter-process communication:
A) Posix: Port operating system interfaces
C) classification: pipelines; signals; message queues; shared memory; semaphores; sockets
2. pipeline communication:
A) features:
1. one-way, first-in-first-out
2. write: at the end of the MPs queue
3. read: in the pipeline's header
B) Category:
1. unknown pipeline: used for communication between parent and child processes
2. famous pipe: used for communication between any two processes
C) unknown pipeline:
1. create a pipe: Int pipe (int filedis [2]);
A) Filedis [0]: used to read the media transcoding queue, file descriptor, and generate the media transcoding queue after the media transcoding queue is created.
B) Filedis [1]: used for writing pipelines
C) return value: success is 0, failure is-1
D) # include
2. close the pipeline: close (filedis [0]); close (filedis [1]);
3. note:
A) pipe () must be called before fork (). Otherwise, the sub-process will not inherit the file descriptor.
B) after creating a sub-process, you must disable unused ports.
C) in order to be able to read and write normally, the read process needs to wait for a while so that the write process can write data for a while.
4. write pipeline: write (filedis [1], "string", sizeof (s ));
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