help-bash
[Top][All Lists]
Advanced

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

Re: bash -x doesn't always show "exec"


From: Chet Ramey
Subject: Re: bash -x doesn't always show "exec"
Date: Mon, 29 Mar 2021 15:49:40 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.8.1

On 3/24/21 4:44 PM, John Hanks wrote:
I think I've more or less satisfied my curiosity here. My (still shaky)
understanding of this is that there is no guaranteed order of execution in
a pipeline, processes are kicked off concurrently and order is somewhat
non-deterministic.

Mostly. The pipeline elements are created in left-to-right order, but their
execution order is up to the scheduler.

When job control is enabled, there is some synchronization (implemented on
most Linux systems, at least) to ensure that  all the pipeline elements are
placed into the same valid process group. This means that the first
pipeline element doesn't run until all pipeline elements are created and
successfully call setpgid(). This usually means that the second and
subsequent elements block on read().

--
``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]