• Re: The joy of pipes

    From Richard Kettlewell@21:1/5 to Louis Krupp on Sat Nov 16 10:31:57 2024
    Louis Krupp <lkrupp@invalid.pssw.com.invalid> writes:
    On 11/15/2024 12:49 AM, 186282@ud0s4.net wrote:

    On 11/14/24 9:05 PM, Lawrence D'Oliveiro wrote:

    On Thu, 14 Nov 2024 16:09:07 -0800, John Ames wrote:

    (I think it was a topic shift to applications of *nix pipes...?)

    Oh shelly boy, the pipes, the pipes are calling ...

    Pipes are good.

    But, really, they're just temp files the parent
    process can access.

    Pipes *could* be implemented with temporary disk files, at least to an extent, but as far as I can tell, they're not.

    “Temporary files the parent can access” is not a good model for a couple
    of reasons:

    * The semantics are different. Bytes read from a regular file are still
    there to be read again if you rewind the file; bytes read from a pipe
    are gone. Empty/full files behave differently to empty/full pipes.

    * Temporary regular files can already be accessed by other processes by
    name, by file descriptor inheritance, or file descriptor passing.

    --
    https://www.greenend.org.uk/rjk/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Charlie Gibbs@21:1/5 to 186282@ud0s4.net on Sat Nov 16 18:14:06 2024
    On 2024-11-16, 186282@ud0s4.net <186283@ud0s4.net> wrote:

    Whatever M$ does ... well ....... always seems
    to be FUCKED somehow.

    "The day Microsoft makes a product that doesn't suck
    is the day they make vacuum cleaners."

    --
    /~\ Charlie Gibbs | Growth for the sake of
    \ / <cgibbs@kltpzyxm.invalid> | growth is the ideology
    X I'm really at ac.dekanfrus | of the cancer cell.
    / \ if you read it the right way. | -- Edward Abbey

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Charlie Gibbs@21:1/5 to rbowman on Sat Nov 16 18:14:05 2024
    On 2024-11-16, rbowman <bowman@montana.com> wrote:

    On Sat, 16 Nov 2024 00:37:35 -0500, 186282@ud0s4.net wrote:

    IF you are doing multi-threaded/process style pgms then you almost
    HAVE to use them if you want to xmit more than a few bytes between
    parents/children. A few years back I was experimenting with TCP/UDP
    servers and found that it could be very useful to transmit a few
    dozen bytes worth of active data between parents/children.

    SO ... learn yer pipes !

    Our software has two modules: one runs 24/7 collecting data, while the
    other handles the number crunching and user interface. The original
    MS-DOS version ran the collector as a TSR. When I ported it to SCO
    Unix I used named pipes.

    (BTW MS-DOS and Windows implement command-line pipes using work files.)

    Message queues and shared memory are handy for IPC too. I don't think Microsoft ever figured either out. What they call message queues are completely different.

    I originally played around with those methods when doing the Windows
    version, but there were various drawbacks with whatever method I tried.
    The DDEML version could take down the supposedly unkillable NT supervisor.

    But then sockets came along, and life has been good ever since.

    --
    /~\ Charlie Gibbs | Growth for the sake of
    \ / <cgibbs@kltpzyxm.invalid> | growth is the ideology
    X I'm really at ac.dekanfrus | of the cancer cell.
    / \ if you read it the right way. | -- Edward Abbey

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From 186283@ud0s4.net@21:1/5 to Richard Kettlewell on Sat Nov 16 23:59:41 2024
    On 11/16/24 5:31 AM, Richard Kettlewell wrote:
    Louis Krupp <lkrupp@invalid.pssw.com.invalid> writes:
    On 11/15/2024 12:49 AM, 186282@ud0s4.net wrote:

    On 11/14/24 9:05 PM, Lawrence D'Oliveiro wrote:

    On Thu, 14 Nov 2024 16:09:07 -0800, John Ames wrote:

    (I think it was a topic shift to applications of *nix pipes...?)

    Oh shelly boy, the pipes, the pipes are calling ...

    Pipes are good.

    But, really, they're just temp files the parent
    process can access.

    Pipes *could* be implemented with temporary disk files, at least to an
    extent, but as far as I can tell, they're not.

    “Temporary files the parent can access” is not a good model for a couple of reasons:

    * The semantics are different. Bytes read from a regular file are still
    there to be read again if you rewind the file; bytes read from a pipe
    are gone. Empty/full files behave differently to empty/full pipes.

    * Temporary regular files can already be accessed by other processes by
    name, by file descriptor inheritance, or file descriptor passing.


    Didn't say temp disk files were necessarily SUPERIOR, just
    that they CAN do most of the stuff pipes are used for and
    in an easier user/code-friendly fashion. SIZE is almost
    unlimited too.

    Anyway, I'd made some TCP/UDP servers but the parent needed
    to know the status of the children in a little more detail
    than just a tiny return code - might want to terminate the
    child if it'd been idle for awhile, might want to know how
    much bandwidth was being used, might want to pick a good
    time to do some maint routines, might want to know WHO the
    connections were from. Pipes were the (relatively) easy
    'C'-approved method and did the job very well.

    So, for most, use pipes. Python and FPC also do pipes.
    They're INTENDED for inter-process communications after
    all so generally GO that way.

    The Bi-Di server was the most fun ... think a "chat" app
    but with the potential for more than just text - closer
    to 'remote terminal'/SSH. ALMOST slipped into re-creating
    an FTP app until I realized where it was going. Too much
    enthusiasm. Commented-out the remote root system call
    function :-)

    Amazing how LITTLE code is required for such things.
    Even the pre-threaded version (max cap) wasn't huge
    at all (albeit the hardest to 'hold in yer head' as
    to how it worked). Base examples in several langs easily
    found on the net - just build-on as necessary and
    then party on.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From 186283@ud0s4.net@21:1/5 to Charlie Gibbs on Sat Nov 16 23:38:57 2024
    On 11/16/24 1:14 PM, Charlie Gibbs wrote:
    On 2024-11-16, 186282@ud0s4.net <186283@ud0s4.net> wrote:

    Whatever M$ does ... well ....... always seems
    to be FUCKED somehow.

    "The day Microsoft makes a product that doesn't suck
    is the day they make vacuum cleaners."


    LIKE that one !!! :-)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to 186282@ud0s4.net on Sun Nov 17 05:30:09 2024
    On Sat, 16 Nov 2024 23:59:41 -0500, 186282@ud0s4.net wrote:

    On 11/16/24 5:31 AM, Richard Kettlewell wrote:

    “Temporary files the parent can access” is not a good model for a
    couple of reasons:

    * The semantics are different. Bytes read from a regular file are still
    there to be read again if you rewind the file; bytes read from a
    pipe are gone. Empty/full files behave differently to empty/full
    pipes.

    * Temporary regular files can already be accessed by other processes by
    name, by file descriptor inheritance, or file descriptor passing.

    Didn't say temp disk files were necessarily SUPERIOR, just that they
    CAN do most of the stuff pipes are used for and in an easier user/code-friendly fashion.

    Not really, no.

    SIZE is almost unlimited too.

    That is another reason they don’t work.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From 186283@ud0s4.net@21:1/5 to Lawrence D'Oliveiro on Sun Nov 17 01:05:20 2024
    On 11/17/24 12:30 AM, Lawrence D'Oliveiro wrote:
    On Sat, 16 Nov 2024 23:59:41 -0500, 186282@ud0s4.net wrote:

    On 11/16/24 5:31 AM, Richard Kettlewell wrote:

    “Temporary files the parent can access” is not a good model for a
    couple of reasons:

    * The semantics are different. Bytes read from a regular file are still
    there to be read again if you rewind the file; bytes read from a
    pipe are gone. Empty/full files behave differently to empty/full
    pipes.

    * Temporary regular files can already be accessed by other processes by
    name, by file descriptor inheritance, or file descriptor passing.

    Didn't say temp disk files were necessarily SUPERIOR, just that they
    CAN do most of the stuff pipes are used for and in an easier
    user/code-friendly fashion.

    Not really, no.

    SIZE is almost unlimited too.

    That is another reason they don’t work.

    It's a block of info, just by one means over another.
    any sub-process/thread can write to a file as easily
    as a pipe. Just need a good naming scheme.

    But, as said, better to stick to pipes for most needs.

    If you're passing multi-megabyte pages of text/images
    or whatever back to the parent then you're doing
    something wrong. Don't hassle yer parents ! :-)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to 186282@ud0s4.net on Sun Nov 17 07:59:44 2024
    On Sun, 17 Nov 2024 01:05:20 -0500, 186282@ud0s4.net wrote:

    On 11/17/24 12:30 AM, Lawrence D'Oliveiro wrote:
    On Sat, 16 Nov 2024 23:59:41 -0500, 186282@ud0s4.net wrote:

    On 11/16/24 5:31 AM, Richard Kettlewell wrote:

    “Temporary files the parent can access” is not a good model for a
    couple of reasons:

    * The semantics are different. Bytes read from a regular file are
    still there to be read again if you rewind the file; bytes read
    from a pipe are gone. Empty/full files behave differently to
    empty/full pipes.

    * Temporary regular files can already be accessed by other processes
    by name, by file descriptor inheritance, or file descriptor passing.

    Didn't say temp disk files were necessarily SUPERIOR, just that they
    CAN do most of the stuff pipes are used for and in an easier
    user/code-friendly fashion.

    Not really, no.

    SIZE is almost unlimited too.

    That is another reason they don’t work.

    It's a block of info, just by one means over another.

    You’re forgetting the sequencing and synchronization aspects.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Kettlewell@21:1/5 to 186282@ud0s4.net on Sun Nov 17 08:42:12 2024
    "186282@ud0s4.net" <186283@ud0s4.net> writes:
    On 11/16/24 5:31 AM, Richard Kettlewell wrote:
    Louis Krupp <lkrupp@invalid.pssw.com.invalid> writes:

    But, really, they're just temp files the parent process can access.

    Pipes *could* be implemented with temporary disk files, at least to an
    extent, but as far as I can tell, they're not.

    “Temporary files the parent can access” is not a good model for a
    couple of reasons:

    * The semantics are different. Bytes read from a regular file are
    still there to be read again if you rewind the file; bytes read from
    a pipe are gone. Empty/full files behave differently to empty/full
    pipes.

    * Temporary regular files can already be accessed by other processes
    by name, by file descriptor inheritance, or file descriptor passing.

    Didn't say temp disk files were necessarily SUPERIOR,

    Indeed. You said they’re really the same, which they’re not.

    just that they CAN do most of the stuff pipes are used for and in an
    easier user/code-friendly fashion.

    There’s certainly an overlap in the end goals you can meet with them,
    but even within that overlap they’re used in slightly different ways.

    SIZE is almost unlimited too.

    Capacity is one of the ways in which they are very different, already
    alluded to above.

    Anyway, I'd made some TCP/UDP servers but the parent needed
    to know the status of the children in a little more detail
    than just a tiny return code - might want to terminate the
    child if it'd been idle for awhile, might want to know how
    much bandwidth was being used, might want to pick a good
    time to do some maint routines, might want to know WHO the
    connections were from. Pipes were the (relatively) easy
    'C'-approved method and did the job very well.

    I’ve no idea what you think “’C’-approved” means. C is a programming language, not a set of guidelines. Pipes are an OS concept, not
    appearing in the C language standard.

    --
    https://www.greenend.org.uk/rjk/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From 186283@ud0s4.net@21:1/5 to Lawrence D'Oliveiro on Sun Nov 17 03:27:33 2024
    On 11/17/24 2:59 AM, Lawrence D'Oliveiro wrote:
    On Sun, 17 Nov 2024 01:05:20 -0500, 186282@ud0s4.net wrote:

    On 11/17/24 12:30 AM, Lawrence D'Oliveiro wrote:
    On Sat, 16 Nov 2024 23:59:41 -0500, 186282@ud0s4.net wrote:

    On 11/16/24 5:31 AM, Richard Kettlewell wrote:

    “Temporary files the parent can access” is not a good model for a >>>>> couple of reasons:

    * The semantics are different. Bytes read from a regular file are
    still there to be read again if you rewind the file; bytes read
    from a pipe are gone. Empty/full files behave differently to
    empty/full pipes.

    * Temporary regular files can already be accessed by other processes >>>>> by name, by file descriptor inheritance, or file descriptor passing.

    Didn't say temp disk files were necessarily SUPERIOR, just that they
    CAN do most of the stuff pipes are used for and in an easier
    user/code-friendly fashion.

    Not really, no.

    SIZE is almost unlimited too.

    That is another reason they don’t work.

    It's a block of info, just by one means over another.

    You’re forgetting the sequencing and synchronization aspects.


    What ? Can't figure that out ? :-)

    Anyway, again as said, I agree that pipes ARE
    generally much better for these sorts of
    purposes.

    You seem to be making a war here where none
    actually exists.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From 186283@ud0s4.net@21:1/5 to Richard Kettlewell on Sun Nov 17 22:50:41 2024
    On 11/17/24 3:42 AM, Richard Kettlewell wrote:
    "186282@ud0s4.net" <186283@ud0s4.net> writes:
    On 11/16/24 5:31 AM, Richard Kettlewell wrote:
    Louis Krupp <lkrupp@invalid.pssw.com.invalid> writes:

    But, really, they're just temp files the parent process can access.

    Pipes *could* be implemented with temporary disk files, at least to an >>>> extent, but as far as I can tell, they're not.

    “Temporary files the parent can access” is not a good model for a
    couple of reasons:

    * The semantics are different. Bytes read from a regular file are
    still there to be read again if you rewind the file; bytes read from
    a pipe are gone. Empty/full files behave differently to empty/full
    pipes.

    * Temporary regular files can already be accessed by other processes
    by name, by file descriptor inheritance, or file descriptor passing.

    Didn't say temp disk files were necessarily SUPERIOR,

    Indeed. You said they’re really the same, which they’re not.


    Umm ... they're all "blocks of information", however
    stored/accessed. The little details are, well, the
    little details.


    just that they CAN do most of the stuff pipes are used for and in an
    easier user/code-friendly fashion.

    There’s certainly an overlap in the end goals you can meet with them,
    but even within that overlap they’re used in slightly different ways.

    SIZE is almost unlimited too.

    Capacity is one of the ways in which they are very different, already
    alluded to above.

    As I said somewhere, if your child processes are sending
    megabytes back to the parent you're DOING SOMETHING WRONG.
    Using files -vs- pipes you CAN xmit mass quantities of
    data between parent/child and or child/child but that's
    probably not the best way to write your app. Leave the
    parent to do 'parent stuff' mostly.

    But somebody, somewhere, for some reason, MIGHT wanna
    do it differently ... and maybe, in context, it's for
    a good reason. I'm not gonna piss all over them.

    Anyway, I'd made some TCP/UDP servers but the parent needed
    to know the status of the children in a little more detail
    than just a tiny return code - might want to terminate the
    child if it'd been idle for awhile, might want to know how
    much bandwidth was being used, might want to pick a good
    time to do some maint routines, might want to know WHO the
    connections were from. Pipes were the (relatively) easy
    'C'-approved method and did the job very well.

    I’ve no idea what you think “’C’-approved” means. C is a programming
    language, not a set of guidelines. Pipes are an OS concept, not
    appearing in the C language standard.

    The 'C' Way IS a sort of 'philosophy' I think ... an
    approach to programming and data-use. Most every lang
    is that way. The Algol/Pascal/Modula approach is a bit
    different, another 'look and feel' to all the issues.
    Everybody has what they think is "The Best Way" - of
    thinking/doing. Otherwise we shoulda all stuck with ASM.
    No FORTRAN, no COBOL, no LISP, no Algol, no 'C' ....

    The way 'C' does interprocess comms was writ in, by and
    for 'C'. As such if you're doing 'C' you will have the
    best luck and least angst going with the flow.

    You can also send/receive between parent/child and
    such by passing socket info. See :

    https://stackoverflow.com/questions/14427898/how-can-i-pass-a-socket-from-parent-to-child-processes

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to 186282@ud0s4.net on Mon Nov 18 06:06:14 2024
    On Sun, 17 Nov 2024 22:50:41 -0500, 186282@ud0s4.net wrote:

    As I said somewhere, if your child processes are sending megabytes
    back to the parent you're DOING SOMETHING WRONG.

    Says the one who has no clue how to write real-world programs.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From 186283@ud0s4.net@21:1/5 to Lawrence D'Oliveiro on Mon Nov 18 01:51:59 2024
    On 11/18/24 1:06 AM, Lawrence D'Oliveiro wrote:
    On Sun, 17 Nov 2024 22:50:41 -0500, 186282@ud0s4.net wrote:

    As I said somewhere, if your child processes are sending megabytes
    back to the parent you're DOING SOMETHING WRONG.

    Says the one who has no clue how to write real-world programs.

    Am I supposed to say something horrible about
    you now ?

    Nope. Won't. I'm sick of 'The Wars'.

    Clue - I've writ 'real world programs' and
    got paid well for them from the punch-card
    days on. I did it my way, for my reasons,
    my 'vision'.

    And so did you.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Pancho@21:1/5 to 186282@ud0s4.net on Mon Nov 18 09:20:23 2024
    On 11/18/24 06:51, 186282@ud0s4.net wrote:
    On 11/18/24 1:06 AM, Lawrence D'Oliveiro wrote:
    On Sun, 17 Nov 2024 22:50:41 -0500, 186282@ud0s4.net wrote:

    As I said somewhere, if your child processes are sending megabytes
    back to the parent you're DOING SOMETHING WRONG.

    Says the one who has no clue how to write real-world programs.

      Am I supposed to say something horrible about
      you now ?

      Nope. Won't. I'm sick of 'The Wars'.

      Clue - I've writ 'real world programs' and
      got paid well for them from the punch-card
      days on. I did it my way, for my reasons,
      my 'vision'.

      And so did you.

    I mainly did as I was told. In large political organisations following
    your own vision can be problematic. You have to fight for a vision.

    I've no idea why using IPC to send megabytes of data between different processes is wrong. That is what many service-orientated architectures
    do. The moment you have a persistence service it is likely to happen.

    Although to be fair we very rarely used pipes, directly, almost never.
    It was always something like REST or message queues.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Pancho on Mon Nov 18 09:36:16 2024
    On Mon, 18 Nov 2024 09:20:23 +0000, Pancho wrote:

    I've no idea why using IPC to send megabytes of data between different processes is wrong.

    It is something I have done. It’s perfectly commonplace.

    Although to be fair we very rarely used pipes, directly, almost never.

    I have used pipes, I have used Unix sockets, I have used network sockets.

    If you are running a Linux GUI, then almost certainly it is built on D-Bus
    as a high-level IPC mechanism that is used as a core component. That is designed to run over Unix sockets. It is not itself designed for high- bandwidth data transfers; if you want to do that, you can exchange your
    own D-Bus messages to set up custom pipe or Unix socket connections
    between bus peers.

    It was always something like REST or message queues.

    Message queues are an OS-provided primitive, but REST is not -- that is a protocol, not a transport. What transport(s) did you use for that? I would assume network connections.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Pancho@21:1/5 to Lawrence D'Oliveiro on Mon Nov 18 11:05:03 2024
    On 11/18/24 09:36, Lawrence D'Oliveiro wrote:
    On Mon, 18 Nov 2024 09:20:23 +0000, Pancho wrote:

    I've no idea why using IPC to send megabytes of data between different
    processes is wrong.

    It is something I have done. It’s perfectly commonplace.

    Although to be fair we very rarely used pipes, directly, almost never.

    I have used pipes, I have used Unix sockets, I have used network sockets.

    If you are running a Linux GUI, then almost certainly it is built on D-Bus
    as a high-level IPC mechanism that is used as a core component. That is designed to run over Unix sockets. It is not itself designed for high- bandwidth data transfers; if you want to do that, you can exchange your
    own D-Bus messages to set up custom pipe or Unix socket connections
    between bus peers.

    It was always something like REST or message queues.

    Message queues are an OS-provided primitive, but REST is not -- that is a protocol, not a transport. What transport(s) did you use for that? I would assume network connections.

    I don't know if Linux provides message queues as a primitive, or not. I
    meant I used message queue protocols (MQTT,zeroMQ, ActiveMQ).

    I guess I was saying as a software developer I only cared about the
    application layer, I never went down to the level of using pipes
    directly. I would have thought my experience was reasonably normal, for
    the last few decades. The period after software developers needed to
    roll everything themselves.

    I do remember looking at named pipes and deciding it was appropriate for
    some task, but I have no memory of actually implementing it. Which could
    mean it just worked and I never thought about it again, or it could mean
    I didn't do it.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From The Natural Philosopher@21:1/5 to Pancho on Mon Nov 18 13:45:58 2024
    On 18/11/2024 11:05, Pancho wrote:
    I do remember looking at named pipes and deciding it was appropriate for
    some task, but I have no memory of actually implementing it. Which could
    mean it just worked and I never thought about it again, or it could mean
    I didn't do it.

    Similar here.
    I've tended to use ramdisk files ... for interprocess communication. Not
    idiot proof, but can be made fit for purpose.



    --
    No Apple devices were knowingly used in the preparation of this post.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Pancho@21:1/5 to The Natural Philosopher on Mon Nov 18 17:04:35 2024
    On 11/18/24 13:45, The Natural Philosopher wrote:
    On 18/11/2024 11:05, Pancho wrote:
    I do remember looking at named pipes and deciding it was appropriate
    for some task, but I have no memory of actually implementing it. Which
    could mean it just worked and I never thought about it again, or it
    could mean I didn't do it.

    Similar here.
    I've tended to use ramdisk files ... for interprocess communication. Not idiot proof, but can be made fit for purpose.


    I guess simpler than shared memory sections.

    One of my golden rules of programming was - show me some RAM and I will squander it on a cache. :-) Although, my crime was mainly in memory
    databases.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From rbowman@21:1/5 to Pancho on Mon Nov 18 17:54:30 2024
    On Mon, 18 Nov 2024 11:05:03 +0000, Pancho wrote:

    I don't know if Linux provides message queues as a primitive, or not. I
    meant I used message queue protocols (MQTT,zeroMQ, ActiveMQ).


    https://www.softprayog.in/programming/interprocess-communication-using- system-v-message-queues-in-linux

    https://www.softprayog.in/programming/interprocess-communication-using- posix-message-queues-in-linux

    I've only used System V queues. Neither work like ActiveMQ.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From The Natural Philosopher@21:1/5 to Pancho on Mon Nov 18 17:47:34 2024
    On 18/11/2024 17:04, Pancho wrote:
    On 11/18/24 13:45, The Natural Philosopher wrote:
    On 18/11/2024 11:05, Pancho wrote:
    I do remember looking at named pipes and deciding it was appropriate
    for some task, but I have no memory of actually implementing it.
    Which could mean it just worked and I never thought about it again,
    or it could mean I didn't do it.

    Similar here.
    I've tended to use ramdisk files ... for interprocess communication.
    Not idiot proof, but can be made fit for purpose.


    I guess simpler than shared memory sections.

    A ram disk IS effectively a shared memory section.
    But with well known ways to access it - and well known issues about race conditions if two+ processes try to write to it
    In the end the issues are just the same, only the coding and sometimes
    access speed is different.


    One of my golden rules of programming was - show me some RAM and I will squander it on a cache. :-) Although, my crime was mainly in memory databases.

    RAM space has never ever been as problem for me when using low level
    languages.



    --
    Renewable energy: Expensive solutions that don't work to a problem that
    doesn't exist instituted by self legalising protection rackets that
    don't protect, masquerading as public servants who don't serve the public.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From rbowman@21:1/5 to Pancho on Mon Nov 18 17:59:48 2024
    On Mon, 18 Nov 2024 17:04:35 +0000, Pancho wrote:

    I guess simpler than shared memory sections.

    One of my golden rules of programming was - show me some RAM and I will squander it on a cache. Although, my crime was mainly in memory
    databases.

    https://www.softprayog.in/programming/interprocess-communication-using- system-v-shared-memory-in-linux

    Shared memory may be faster.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From 186283@ud0s4.net@21:1/5 to Pancho on Mon Nov 18 22:32:17 2024
    On 11/18/24 4:20 AM, Pancho wrote:
    On 11/18/24 06:51, 186282@ud0s4.net wrote:
    On 11/18/24 1:06 AM, Lawrence D'Oliveiro wrote:
    On Sun, 17 Nov 2024 22:50:41 -0500, 186282@ud0s4.net wrote:

    As I said somewhere, if your child processes are sending megabytes
    back to the parent you're DOING SOMETHING WRONG.

    Says the one who has no clue how to write real-world programs.

       Am I supposed to say something horrible about
       you now ?

       Nope. Won't. I'm sick of 'The Wars'.

       Clue - I've writ 'real world programs' and
       got paid well for them from the punch-card
       days on. I did it my way, for my reasons,
       my 'vision'.

       And so did you.

    I mainly did as I was told. In large political organisations following
    your own vision can be problematic. You have to fight for a vision.


    I very intentionally stayed away from such orgs. A little
    less money, but the happiness factor more than compensated.
    Got to pursue many esoteric projects - some of which WERE
    useful - and the org paid for most of it (except the odd
    Radio Shack parts).


    I've no idea why using IPC to send megabytes of data between different processes is wrong. That is what many service-orientated architectures
    do. The moment you have a persistence service it is likely to happen.

    Really you DON'T want to send megabytes as IPC ... but
    somebody somewhere MAY wanna. So, what's the best way
    for them to do that ? Don't necessarily piss on 'em but
    help 'em out instead.

    Although to be fair we very rarely used pipes, directly, almost never.
    It was always something like REST or message queues.

    Again though, just "blocks of information". MANY ways
    to do that. Each developer has to figure out what's
    best for THEIR particular app.

    I mentioned a server style app I made, but I wanted the
    child processes/threads (tried both ways) to return
    some active stat data to the parent. Not a huge amount
    of info, but useful. Pipes were the best way. The
    parent was allowed to xmit a 'kill' to a child in
    trouble, via the pipe, so it could shut down in an
    orderly fashion.

    Pre-threaded servers seem to have the highest capacity
    and throughput. The parent allocates maybe ten threads
    to start off with and then can add new blocks of ten
    as-needed. It's a little harder to manage than some
    other kinds of servers, and sometimes a bit harder
    to visualize how it's working, but they're good things.
    Once you've got it you're SET.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From 186283@ud0s4.net@21:1/5 to The Natural Philosopher on Mon Nov 18 22:50:41 2024
    On 11/18/24 8:45 AM, The Natural Philosopher wrote:
    On 18/11/2024 11:05, Pancho wrote:
    I do remember looking at named pipes and deciding it was appropriate
    for some task, but I have no memory of actually implementing it. Which
    could mean it just worked and I never thought about it again, or it
    could mean I didn't do it.

    Similar here.
    I've tended to use ramdisk files ... for interprocess communication. Not idiot proof, but can be made fit for purpose.

    As I was saying all along ... yer passing "blocks
    of information" between processes. CAN be done
    in a large number of ways and they'll all WORK.
    Temporary files on a RAMdisk are fine (but slower).
    Pipes are fine, the "normal 'C' way". MQs will
    work. In any case it'll get done.

    Dunno why everybody seems so keen to slag anybody
    who doesn't do it/see it exactly like some high-holy
    manual from 1982 says you're supposed to. That's
    no fun !

    Hmmm ... can you pass IPC data using paper tape ?
    It'd be cool ! :-)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to 186282@ud0s4.net on Tue Nov 19 04:53:46 2024
    On Mon, 18 Nov 2024 22:50:41 -0500, 186282@ud0s4.net wrote:

    yer passing "blocks of information" between processes.

    Pipes actually pass streams of information. And they won’t let you read
    what hasn’t been written yet, or write too much beyond what hasn’t been read yet.

    In other words, they provide automatic synchronization between readers and writers.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Robert Riches@21:1/5 to 186282@ud0s4.net on Tue Nov 19 04:50:15 2024
    On 2024-11-18, 186282@ud0s4.net <186283@ud0s4.net> wrote:
    ...

    As I said somewhere, if your child processes are sending
    megabytes back to the parent you're DOING SOMETHING WRONG.

    Oh?

    Let's take my example of an older Raspberry Pi model 1 with less
    than 1GB of RAM and only 4GB of SD card "disk", and process a
    video stream several GB in total length, from an mplayer process
    that will write only to a file and refuses to write to stdout,
    where the stream needs to be sent over the LAN to a machine with
    enough spinning rust to store the stream.

    Would temporary files work? Not really. A named pipe let
    mplayer write to a named file. Even if having two processes
    shuffling the data wasn't the most efficient, the Pi handled it
    quite well.

    --
    Robert Riches
    spamtrap42@jacob21819.net
    (Yes, that is one of my email addresses.)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Robert Riches on Tue Nov 19 04:58:15 2024
    On 19 Nov 2024 04:50:15 GMT, Robert Riches wrote:

    A named pipe let mplayer write to a named file.

    Another example is playing an audio file to a phone call made through the Asterisk telephony engine. It wants the audio to be in a specific format
    (e.g. GSM), while the original file might be in an entirely different
    format. It’s easy enough to use FFmpeg to convert on the fly in real time. The Asterisk playback command expects a file name, and I found that a
    named pipe would work (bar a warning or two about it not being seekable).
    Net result -- no need to pre-convert the audio or save temporary files anywhere. And the pipe itself provides automatic synchronization between
    the source (FFmpeg) and the sink (Asterisk).

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From The Natural Philosopher@21:1/5 to 186282@ud0s4.net on Tue Nov 19 09:19:35 2024
    On 19/11/2024 03:50, 186282@ud0s4.net wrote:
    Temporary files on a RAMdisk are fine (but slower).
    not if it never gets to disk, but is all in cache

    --
    The New Left are the people they warned you about.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Pancho@21:1/5 to rbowman on Tue Nov 19 09:57:47 2024
    On 11/18/24 17:54, rbowman wrote:
    On Mon, 18 Nov 2024 11:05:03 +0000, Pancho wrote:

    I don't know if Linux provides message queues as a primitive, or not. I
    meant I used message queue protocols (MQTT,zeroMQ, ActiveMQ).


    https://www.softprayog.in/programming/interprocess-communication-using- system-v-message-queues-in-linux

    https://www.softprayog.in/programming/interprocess-communication-using- posix-message-queues-in-linux

    I've only used System V queues. Neither work like ActiveMQ.

    I was never particularly interested in the nitty gritty, when I say I
    used ActiveMQ, I meant I used a wrapper API that used ActiveMQ, I think
    JMS. I generally liked to decouple my software development from specific implementations. It made my skills more transferable, less dependent on
    a specific development stack.

    So, for me all queues tended to be just Enqueue/Dequeue, FIFO, data
    structures. The queue provider was mainly to shield me from the
    complexity of dealing with monitoring and reliability issues involved in handling a remote service.

    I was just curious when this thread started commenting on what pipes
    were and I realised I had never programmed them, and hence gained a
    proper understanding. That has a knock on effect that I don't really
    understand the behaviour of programs which do use pipes. I'm presuming
    bash commands uses pipes.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Richard Kettlewell@21:1/5 to 186282@ud0s4.net on Tue Nov 19 09:56:39 2024
    "186282@ud0s4.net" <186283@ud0s4.net> writes:
    Dunno why everybody seems so keen to slag anybody
    who doesn't do it/see it exactly like some high-holy
    manual from 1982 says you're supposed to. That's
    no fun !

    Without comment:

    | As I said somewhere, if your child processes are sending
    | megabytes back to the parent you're DOING SOMETHING WRONG.

    --
    https://www.greenend.org.uk/rjk/

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Pancho on Tue Nov 19 21:55:14 2024
    On Tue, 19 Nov 2024 09:57:47 +0000, Pancho wrote:

    That has a knock on effect that I don't really
    understand the behaviour of programs which do use pipes. I'm presuming
    bash commands uses pipes.

    As should be apparent by now, pipes are more than a substitute for
    temporary files, they are an IPC/synchronization mechanism.

    Consider this C program <https://gitlab.com/ldo/slow_dbus_server>, and see
    how a pipe is used to send a termination notification from a worker thread
    back to the main thread.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to John Ames on Fri Nov 15 02:05:41 2024
    On Thu, 14 Nov 2024 16:09:07 -0800, John Ames wrote:

    (I think it was a topic shift to applications of *nix pipes...?)

    Oh shelly boy, the pipes, the pipes are calling ...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Eli the Bearded@21:1/5 to commodorejohn@gmail.com on Fri Nov 15 06:41:40 2024
    In comp.os.linux.misc, John Ames <commodorejohn@gmail.com> wrote:
    Eli the Bearded <*@eli.users.panix.com> wrote:
    Okay, I give up.
    1. How does that relate to EBCDIC?
    (I think it was a topic shift to applications of *nix pipes...?)

    Traditional Unix "spell", which merely outputs words not recognized
    without context or even line numbers, is an application of pipes.

    Roughly like this:

    --8<---------------cut here---------------start------------->8---
    cat ~/.spell.words /usr/dict/words 2>/dev/null |
    tr A-Z a-z |
    tr -dc a-z'
    ' |
    grep '[a-z]' |
    SPELLSTEMTOOL |
    sort -u > $TMPFILE_A

    < $INPUT_FILE tr -s ' ^I!$&()_+[]{}:l"'\''\\.,?/-' '
    ' |
    tr A-Z a-z |
    tr -dc a-z'
    ' |
    grep '[a-z]' |
    sort -u > $TMPFILE_B

    comm -13 $TMPFILE_A $TMPFILE_B
    --8<---------------cut here---------------end--------------->8---


    Where SPELLSTEMTOOL is a heuristic that tries to make "try" into "tries"
    and related dictionary fixes to compensate for the words file not having
    all the variants. (These days it is /usr/share/dict/words but also
    these days traditional spell is hard to find. Gnu spell is different.)

    Elijah
    ------
    or maybe the stem tool worked on file B in the other direction

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From 186283@ud0s4.net@21:1/5 to Lawrence D'Oliveiro on Fri Nov 15 02:49:54 2024
    On 11/14/24 9:05 PM, Lawrence D'Oliveiro wrote:
    On Thu, 14 Nov 2024 16:09:07 -0800, John Ames wrote:

    (I think it was a topic shift to applications of *nix pipes...?)

    Oh shelly boy, the pipes, the pipes are calling ...

    Pipes are good.

    But, really, they're just temp files the parent
    process can access.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Louis Krupp@21:1/5 to 186282@ud0s4.net on Fri Nov 15 04:20:00 2024
    This is a multi-part message in MIME format.
    On 11/15/2024 12:49 AM, 186282@ud0s4.net wrote:
    On 11/14/24 9:05 PM, Lawrence D'Oliveiro wrote:
    On Thu, 14 Nov 2024 16:09:07 -0800, John Ames wrote:

    (I think it was a topic shift to applications of *nix pipes...?)

    Oh shelly boy, the pipes, the pipes are calling ...

      Pipes are good.

      But, really, they're just temp files the parent
      process can access.

    Pipes *could* be implemented with temporary disk files, at least to an
    extent, but as far as I can tell, they're not.

    Quoting from this page:

    https://www.geeksforgeeks.org/piping-in-unix-or-linux/#

    In Linux, a pipe is not a regular file but a type of inter-process
    communication (IPC) mechanism that acts as a buffer, which can be
    used to connect the output of one process to the input of another.
    Although pipes are not files, they are implemented using file
    descriptors and share many behaviors with files. They exist only in
    memory and do not have a presence in the file system, unlike regular
    files.

    Louis

    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>
    <div class="moz-cite-prefix">On 11/15/2024 12:49 AM, <a
    class="moz-txt-link-abbreviated moz-txt-link-freetext"
    href="mailto:186282@ud0s4.net" moz-do-not-send="true">186282@ud0s4.net</a>
    wrote:<br>
    </div>
    <blockquote type="cite"
    cite="mid:hzSdnTUBKbG_YKv6nZ2dnZfqnPQAAAAA@earthlink.com">On
    11/14/24 9:05 PM, Lawrence D'Oliveiro wrote: <br>
    <blockquote type="cite">On Thu, 14 Nov 2024 16:09:07 -0800, John
    Ames wrote: <br>
    <br>
    <blockquote type="cite">(I think it was a topic shift to
    applications of *nix pipes...?) <br>
    </blockquote>
    <br>
    Oh shelly boy, the pipes, the pipes are calling ... <br>
    </blockquote>
    <br>
      Pipes are good. <br>
    <br>
      But, really, they're just temp files the parent <br>
      process can access. <br>
    </blockquote>
    <br>
    Pipes *could* be implemented with temporary disk files, at least to
    an extent, but as far as I can tell, they're not. <br>
    <br>
    Quoting from this page:<br>
    <br>
    <a class="moz-txt-link-freetext"
    href="https://www.geeksforgeeks.org/piping-in-unix-or-linux/#"
    moz-do-not-send="true">https://www.geeksforgeeks.org/piping-in-unix-or-linux/#</a><br>
    <blockquote><span>In Linux, a pipe is not a regular file but a type
    of inter-process communication (IPC) mechanism that acts as a
    buffer, which can be used to connect the output of one process
    to the input of another. Although pipes are not files, they are
    implemented using file descriptors and share many behaviors with
    files. They exist only in memory and do not have a presence in
    the file system, unlike regular files.<br>
    </span></blockquote>
    <span>Louis<br>
    </span><br>
    </body>
    </html>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to 186282@ud0s4.net on Sat Nov 16 00:16:19 2024
    On Fri, 15 Nov 2024 02:49:54 -0500, 186282@ud0s4.net wrote:

    But, really, they're just temp files the parent process can access.

    They’re in-kernel memory buffers, with a read end and a write end.
    Actually you can have multiple processes at each end. Readers can
    automatically block waiting for writers, writers can automatically block waiting for readers.

    Try doing that with temporary files.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Robert Riches@21:1/5 to Louis Krupp on Sat Nov 16 04:33:07 2024
    On 2024-11-15, Louis Krupp <lkrupp@invalid.pssw.com.invalid> wrote:
    This is a multi-part message in MIME format. --------------cDOk308Xy6TMkzB8MsXpyDQY
    Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit

    On 11/15/2024 12:49 AM, 186282@ud0s4.net wrote:
    On 11/14/24 9:05 PM, Lawrence D'Oliveiro wrote:
    On Thu, 14 Nov 2024 16:09:07 -0800, John Ames wrote:

    (I think it was a topic shift to applications of *nix pipes...?)

    Oh shelly boy, the pipes, the pipes are calling ...

      Pipes are good.

      But, really, they're just temp files the parent
      process can access.

    Pipes *could* be implemented with temporary disk files, at least to an extent, but as far as I can tell, they're not.

    Quoting from this page:

    https://www.geeksforgeeks.org/piping-in-unix-or-linux/#

    In Linux, a pipe is not a regular file but a type of inter-process
    communication (IPC) mechanism that acts as a buffer, which can be
    used to connect the output of one process to the input of another.
    Although pipes are not files, they are implemented using file
    descriptors and share many behaviors with files. They exist only in
    memory and do not have a presence in the file system, unlike regular
    files.

    Louis

    There are also "named pipes" aka FIFOs. On Devuan Daedalus (and
    probably most other distributions) this command will show
    information about them:

    man 7 pipe

    I have used a named pipe aka FIFO on a Raspberry PI. An mplayer
    process reads from a PVR-USB2 TV receiver and writes to the named
    pipe or FIFO. A netcat process reads from the named pipe or FIFO
    to send the bits to a larger computer with substantial disk
    storage. A 105 minute recording session is several GB in size.
    A cron job, ssh, and some shell scripting launch the stuff.

    (Unfortunately, either the amplified TV antenna in the attic has
    lost its gain, or the PVR-USB2 unit has lost front-end gain, so
    it has not captured a viewable program in a few years.)

    HTH

    --
    Robert Riches
    spamtrap42@jacob21819.net
    (Yes, that is one of my email addresses.)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From 186283@ud0s4.net@21:1/5 to Louis Krupp on Sat Nov 16 00:37:35 2024
    On 11/15/24 6:20 AM, Louis Krupp wrote:
    On 11/15/2024 12:49 AM, 186282@ud0s4.net wrote:
    On 11/14/24 9:05 PM, Lawrence D'Oliveiro wrote:
    On Thu, 14 Nov 2024 16:09:07 -0800, John Ames wrote:

    (I think it was a topic shift to applications of *nix pipes...?)

    Oh shelly boy, the pipes, the pipes are calling ...

      Pipes are good.

      But, really, they're just temp files the parent
      process can access.

    Pipes *could* be implemented with temporary disk files, at least to an extent, but as far as I can tell, they're not.


    Well, they can be on ACTUAL disk space - or on
    a RAMdisk or just a reserved stretch of RAM.

    The last one is quickest - but most taxing on
    run-time resources.


    Quoting from this page:

    https://www.geeksforgeeks.org/piping-in-unix-or-linux/#

       In Linux, a pipe is not a regular file but a type of inter-process
       communication (IPC) mechanism that acts as a buffer, which can be
       used to connect the output of one process to the input of another.
       Although pipes are not files, they are implemented using file
       descriptors and share many behaviors with files. They exist only in
       memory and do not have a presence in the file system, unlike regular
       files.

    There are clearly a lot of ways to implement "pipes".
    'C' does it the 'C' way.

    IF you are doing multi-threaded/process style pgms then you
    almost HAVE to use them if you want to xmit more than
    a few bytes between parents/children. A few years back
    I was experimenting with TCP/UDP servers and found that
    it could be very useful to transmit a few dozen bytes
    worth of active data between parents/children.

    SO ... learn yer pipes !

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lawrence D'Oliveiro@21:1/5 to Robert Riches on Sat Nov 16 06:46:56 2024
    On 16 Nov 2024 04:33:07 GMT, Robert Riches wrote:

    There are also "named pipes" aka FIFOs.

    https://manpages.debian.org/7/pipe.7.en.html https://manpages.debian.org/7/fifo.7.en.html

    Not to be confused with Unix sockets.

    https://manpages.debian.org/7/unix.7.en.html

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From rbowman@21:1/5 to 186282@ud0s4.net on Sat Nov 16 06:16:20 2024
    On Sat, 16 Nov 2024 00:37:35 -0500, 186282@ud0s4.net wrote:

    IF you are doing multi-threaded/process style pgms then you almost
    HAVE to use them if you want to xmit more than a few bytes between
    parents/children. A few years back I was experimenting with TCP/UDP
    servers and found that it could be very useful to transmit a few
    dozen bytes worth of active data between parents/children.

    SO ... learn yer pipes !

    Message queues and shared memory are handy for IPC too. I don't think
    Microsoft ever figured either out. What they call message queues are
    completely different.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From 186283@ud0s4.net@21:1/5 to rbowman on Sat Nov 16 03:03:00 2024
    On 11/16/24 1:16 AM, rbowman wrote:
    On Sat, 16 Nov 2024 00:37:35 -0500, 186282@ud0s4.net wrote:

    IF you are doing multi-threaded/process style pgms then you almost
    HAVE to use them if you want to xmit more than a few bytes between
    parents/children. A few years back I was experimenting with TCP/UDP
    servers and found that it could be very useful to transmit a few
    dozen bytes worth of active data between parents/children.

    SO ... learn yer pipes !

    Message queues and shared memory are handy for IPC too. I don't think Microsoft ever figured either out. What they call message queues are completely different.

    Whatever M$ does ... well ....... always seems
    to be FUCKED somehow.

    Anyway, pipes are VERY useful. Anybody getting into 'C',
    esp multi-threaded/process, needs to get very familiar
    with them. Even in 'C' they're still kinda awkward
    alas. Somebody had The Idea, but nobody seems to have
    made it smooth and consistent across multiple languages
    and systems.

    My old server experiments, each child returned stats
    back to the root parent while it was running. Under
    certain conditions the parent would do things - maybe
    terminate the child or connection or do a timer
    process. Did work up to a fairly compact UDP bi-di
    pre-threaded server. Never found a great use for it,
    but it was fun and maybe someday .......

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)