help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple concurrent coprocesses


From: Chet Ramey
Subject: Re: Multiple concurrent coprocesses
Date: Tue, 30 Mar 2021 11:14:30 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.8.1

On 3/22/21 11:14 PM, Zachary Santer wrote:
 > Something more than the trivial cases I've thrown at it. I'm interested in
 > whether or not the code has deadlock problems in the presence of pipelines.

I don't know if anonymous pipes themselves always wait to fill a buffer before sending their contents on. Am I getting your meaning, though? I don't see how this would be more of a problem with multiple coprocesses than it is with one.

It's just more bookkeeping, and I'd want to make sure that bash takes
care of closing coproc file descriptors where necessary. I think it does,
but more real-world test cases are always nice.

Say you have a pipe file descriptor that's (inadvertently) shared by
more processes than intended. If that file descriptor is open for read,
the kernel won't send a SIGPIPE to a writer that anticipates getting
one. Similarly, if a stray file descriptor open for write exists, a
reader won't get the expected EOF. These situations can result in
deadlock.

The pipeline code passes around bitmaps of file descriptors to close to
handle this.

As I said, I think the multiple coprocs code takes care of these cases,
but it's good to be sure.

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]