9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Charles Forsyth <charles.forsyth@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] pipe: bug or feature?
Date: Sun,  2 Apr 2017 18:20:05 +0100	[thread overview]
Message-ID: <CAOw7k5j-Pwdmo729XQkfox8-odZ7RgsP8gtxj3kWuXCFi6hupw@mail.gmail.com> (raw)
In-Reply-To: <57E90700-85A0-47F4-9156-DE732859A74C@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 739 bytes --]

On 28 March 2017 at 01:05, arisawa <karisawa@gmail.com> wrote:

> the program reads a file and writes it to one end of pipe and then reads
> it from another end of pipe.
> the buffer for writing pipe is named buf0, and for reading pipe is named
> buf.
>

The general problem with this is that a pipe is a full-duplex communication
channel, not a storage device.
The implementation has buffering, but it's not guaranteed to hold a file of
any particular size.
Obviously in practice you're fine if the file is "small enough", but how
small is that?
Having the same process write and read the pipe won't work in general.
The buffer will fill up and the writer will block, which is just right ...
if it's not also the reader.

[-- Attachment #2: Type: text/html, Size: 1247 bytes --]

  parent reply	other threads:[~2017-04-02 17:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-28  0:05 arisawa
2017-04-02  2:55 ` Skip Tavakkolian
2017-04-02  7:34 ` Skip Tavakkolian
2017-04-02  8:01   ` arisawa
2017-04-02 12:33   ` Antons Suspans
2017-04-02 16:44     ` Skip Tavakkolian
2017-04-02 17:20 ` Charles Forsyth [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-03-27 10:17 arisawa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOw7k5j-Pwdmo729XQkfox8-odZ7RgsP8gtxj3kWuXCFi6hupw@mail.gmail.com \
    --to=charles.forsyth@gmail.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).