Alle boeken

Professioneel

Apps Over Coach Inloggen Begin met lezen

Computer Science · Begrippenlijst

Wat is Pipe?

Definition 14.7 University Computer Science — Year 2 · Hoofdstuk 14 — Files, Pipes and Signals

A pipe is a kernel buffer with two ends, created by pipe(fd): bytes written to the write end fd[1] are read, in the same order, from the read end fd[0]. A read on an empty pipe waits; a write to a full pipe waits; on Linux a pipe holds 65 536 bytes, and a write of at most 4096 bytes is never mixed with another writer’s. A read returns 0, end of file, when the pipe is empty and no write end is open anywhere.

A pipe before and after the wiring. Right after the fork, both processes hold both ends. Each then keeps one: the writer’s descriptor 1 and the reader’s descriptor 0 become the ends, and every other copy is closed, so that the reader sees end of file when the writer is done.
A pipe before and after the wiring. Right after the fork, both processes hold both ends. Each then keeps one: the writer’s descriptor 1 and the reader’s descriptor 0 become the ends, and every other copy is closed, so that the reader sees end of file when the writer is done.
Lees in het hoofdstuk →