9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Bakul Shah <bakul@bitblocks.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] rc's shortcomings (new subject line)
Date: Thu, 30 Aug 2012 10:02:41 -0700	[thread overview]
Message-ID: <20120830170241.A8D27B827@mail.bitblocks.com> (raw)
In-Reply-To: Your message of "Thu, 30 Aug 2012 15:35:47 +0530." <CAEoi9W6c2JaxrTDwR76TjuN9DeBXnO6gueOGCaEh+Fksfb9zqQ@mail.gmail.com>

On Thu, 30 Aug 2012 15:35:47 +0530 Dan Cross <crossd@gmail.com>  wrote:
> On Wed, Aug 29, 2012 at 7:27 PM, erik quanstrom <quanstro@quanstro.net> wrote
> :
> >> > rc already has non-linear pipelines.  but they're not very convienient.
> >>
> >> And somewhat limited.  There's no real concept of 'fanout' of output,
> >> for instance (though that's a fairly trivial command, so probably
> >> doesn't count), or multiplexing input from various sources that would
> >> be needed to implement something like a shell-level data flow network.
> >>
> >> Muxing input from multiple sources is hard when the data isn't somehow
> >> self-delimited.
> >>[...]
> >> There may be other ways to achieve the same thing; I remember that the
> >> boundaries of individual writes used to be preserved on read, but I
> >> think that behavior changed somewhere along the way; maybe with the
> >> move away from streams?  Or perhaps I'm misremembering?
> >
> > pipes still preserve write boundaries, as does il.  (even the 0-byte write)
>  but tcp of course by
> > definition does not.  but either way, the protocol would need to be
> > self-framed to be transported on tcp.  and even then, there are protocols
> > that are essentially serial, like tls.
>
> Right.  I think this is the reason for Bakul's question about
> s-expressions or JSON or a similar format; those formats are
> inherently self-delimiting.

Indeed.

>                              The problem with that is that, for
> passing those things around to work without some kind of reverse
> 'tee'-like intermediary, the system has to understand the the things
> that are being transferred are s-expressions or JSON records or
> whatever, not just streams of uninterpreted bytes.  We've steadfastly
> rejected such system-imposing structure on files in Unix-y type
> environments since 1969.

I think that it is time to try something new.  A lot of things
don't fit into into this model of bytepipes connecting
processes. A lot of commands even in this model use line
"objects". But the kind of composability one gets in Scheme,
go, functional languages etc is missing. Even go seems to go
the "one language for all" Lispy model -- its typed channels
are all within a single address space. [Actually I would have
much preferred if they had just focused on adding channels and
parallel processes to a Scheme instead of creating a whole new
language but that is whole 'nother discussion!]

> But conceptually, these IPC mechanisms are sort of similar to channels
> in CSP-style languages.  A natural question then becomes, how do
> CSP-style languages handle the issue?  Channels work around the muxing
> thing by being typed; elements placed onto a channel are indivisible
> objects of that type, so one doesn't need to worry about interference
> from other objects simultaneously placed onto the same channel in
> other threads of execution.  Could we do something similar with pipes?
>  I don't know that anyone wants typed file descriptors; that would
> open a whole new can of worms.

I am suggesting channels of self-typed objects.  The idea of
communicating self-identifying objects between loosely coupled
processes is blindingly obvious to me. And as long as you have
one producer/one consumer pair, there are no problems in
implementing this on any system but the unix model of
"inheriting" file descriptors (or even passing them around to
unrelated processes) and then letting them all blab
indiscriminately on the same channel just doesn't work. So again
Unix gets in the way.

> This sounds wonderful, of course, but in Lisp and Scheme, lists are
> built from cons cells, and even if I have some magic
> 'split-into-halves' function that satisfies the requirements of
> reduce, doing so is still necessarily linear, so I don't gain much.
> Besides, having to pass around the identity all the time is a bummer.

You can use cdr-coding. Or just use arrays like APL/j/k. But a
knowledge of function properties is essential to implement
them efficiently and for one arg version (without the initial
value). In k "/" is the reduce operator so you can say

    +/!3	// !3 == 0 1 2
    0+/!3 	// two arg version of +.

And
    */!0
    +/!0
do the right thing because the language knows identity
elements for + and *.

> But in clojure, the Lisp concept of a list (composed of cons cells) is
> generalized into the concept of a 'seq'.  A seq is just a sequence of
> things; it could be a list, a vector, some other container (say, a
> sequence of key/value pairs derived from some kind of associated
> structure), or a stream of data being read from a file or network
> connection.
>
> What's the *real* problem here?  The issue is that reduce "knows" too
> much about the things it is reducing over.  Doing things sequentially
> is easy, but slow; doing things in parallel requires that reduce know
> a lot about the type of thing it's reducing over (e.g., this magic
> 'split-into-halves' function.  Further, that might not be appropriate
> for *all* sequence types; e.g., files or lists made from cons cells.

Even more common than reduce is map. No reason why you can't
parallelize

	8c *.c

> Your example of running multiple 'grep's in parallel sort of reminded
> me of this, though it occurs to me that this can probably be done with

This is a map not reduce. The "reduce" would be implicitly
(and often wrongly) done by fd inheritance.

I have a toy array-scheme where all functions except array
functions are applied elementwise when given arrays.

	(+ #(1 2 3) #(4 5 6)) => #(5 7 9)
	(* 2 #(4 5 6)) => #(8 10 12)
	(* 2 #(4 #(5 5) 6)) => #(8 #(10 10) 12)

So I think map can be made implicit but reduction has to be
explicit. This is what APLs do.

> a command: a sort of 'parallel apply' thing that can run a command
> multiple times concurrently, each invocation on a range of the
> arguments.  But making it simple and elegant is likely to be tricky.

APL/k have peach for parallel-each ("each" is their way of saying map).



  parent reply	other threads:[~2012-08-30 17:02 UTC|newest]

Thread overview: 133+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-28  8:57 [9fans] rc vs sh Rudolf Sykora
2012-08-28  9:47 ` hiro
2012-08-28  9:52 ` dexen deVries
2012-08-28 10:27   ` Rudolf Sykora
2012-08-28 13:07   ` Lucio De Re
2012-08-28 13:40     ` Rudolf Sykora
2012-08-28 14:10       ` Lucio De Re
2012-08-28 14:13         ` Kurt H Maier
2012-08-28 14:52           ` Lucio De Re
2012-08-28 15:05             ` Kurt H Maier
2012-08-28 15:18               ` Dan Cross
2012-08-28 15:30                 ` Kurt H Maier
2012-08-28 15:45                   ` Dan Cross
2012-08-28 17:43                     ` Kurt H Maier
2012-08-28 18:20                       ` Dan Cross
2012-08-28 18:26                         ` Kurt H Maier
2012-08-28 18:39                           ` Dan Cross
2012-08-28 18:47                             ` Kurt H Maier
2012-08-28 20:42                             ` Jeremy Jackins
2012-08-28 21:20                               ` Dan Cross
2012-08-28 20:40                   ` Uriel
2012-08-28 15:36               ` Lucio De Re
2012-08-28 15:35                 ` Kurt H Maier
2012-08-28 15:41                   ` erik quanstrom
2012-08-28 15:47                     ` Kurt H Maier
2012-08-28 16:04                       ` hiro
2012-08-28 16:05                   ` Lucio De Re
2012-08-28 17:46                     ` Kurt H Maier
2012-08-28 18:19                       ` Lucio De Re
2012-08-28 18:18                         ` Kurt H Maier
2012-08-28 20:44                   ` Uriel
2012-08-31 22:24                     ` Kurt H Maier
2012-08-31 23:00                       ` Uriel
2012-08-31 23:15                         ` hiro
2012-08-31 23:56                           ` Matthew Veety
2012-09-02 15:20                             ` suharik
     [not found]                             ` <CAF9FGtS9xYBNzneNPs2eBkkqVGzn5V0FjdEWDYs_EaUu0waRvQ@mail.gmail.c>
2012-09-02 17:25                               ` erik quanstrom
2012-09-02 20:40                                 ` suharik
2012-09-03  7:31                                 ` Rudolf Sykora
2012-09-03  8:22                                   ` dexen deVries
2012-09-03 10:04                                   ` suharik
2012-09-03 10:57                                     ` hiro
     [not found]                                 ` <CAF9FGtRdcFuuefr4q0zFBrkwaQ5a_-w4J-=xqo-MYp+phjQBaA@mail.gmail.c>
2012-09-03 13:42                                   ` erik quanstrom
     [not found]                                 ` <CAF9FGtTFskxpVd_CxGEKpRwfSihVjyREqWwFCmjiWksCKZoDvg@mail.gmail.c>
2012-09-03 13:46                                   ` erik quanstrom
2012-10-25 13:36                                     ` Ethan Grammatikidis
2012-10-25 13:48                                       ` erik quanstrom
2012-09-03  8:32                         ` Balwinder S Dheeman
2012-08-28 16:06             ` tlaronde
2012-08-28 16:12               ` Aram Hăvărneanu
2012-08-28 16:32                 ` tlaronde
2012-08-28 20:43                 ` tlaronde
2012-08-28 18:13               ` Lucio De Re
2012-08-30  6:14                 ` arnold
2012-08-30  7:41                   ` Lucio De Re
2012-08-30  9:34                     ` tlaronde
2012-08-30 10:26                       ` Lucio De Re
2012-08-30 10:29                         ` tlaronde
2012-08-30 10:50                           ` Lucio De Re
2012-08-30 10:35                         ` Dan Cross
2012-08-28 14:16         ` erik quanstrom
2012-08-28 14:58           ` Lucio De Re
2012-08-28 14:16         ` dexen deVries
2012-08-28 14:23           ` hiro
2012-08-28 14:34             ` hiro
2012-08-29  9:16   ` Balwinder S Dheeman
2012-08-29 15:10     ` Charles Forsyth
2012-08-29 15:22       ` hiro
2012-08-29 15:34         ` Charles Forsyth
2012-10-25 13:45       ` Ethan Grammatikidis
2012-10-25 13:56       ` dexen deVries
2012-08-28 15:09 ` Dan Cross
     [not found] ` <CAEoi9W6K07ZgNS+7-oeQY3dkedW7qZLnOh79m5J7KCw7os5aEQ@mail.gmail.c>
2012-08-28 15:26   ` erik quanstrom
2012-08-28 15:40     ` Lucio De Re
2012-08-28 15:34       ` erik quanstrom
2012-08-28 18:24     ` dexen deVries
2012-08-28 18:44       ` [9fans] rc's shortcomings (new subject line) erik quanstrom
2012-08-28 19:34         ` dexen deVries
2012-08-29  0:06           ` arisawa
2012-08-29  8:12             ` dexen deVries
2012-08-28 19:41         ` Dan Cross
2012-08-28 20:14           ` Bakul Shah
2012-08-29  1:39             ` erik quanstrom
2012-08-29  1:43               ` erik quanstrom
2012-08-29  2:13               ` Bakul Shah
2012-08-29  2:23                 ` erik quanstrom
2012-08-29  2:44                   ` Bakul Shah
2012-08-29  4:28                     ` erik quanstrom
2012-08-28 20:31           ` Aram Hăvărneanu
2012-09-04 17:27           ` 😜
2012-08-28 19:53         ` Bakul Shah
     [not found]         ` <CAEoi9W5bZE+coAaQA-Be4P_JQoB6TR31GS=gYhq=6BhHNXCRKw@mail.gmail.c>
2012-08-28 20:34           ` erik quanstrom
2012-08-28 22:46             ` Bakul Shah
2012-08-29  1:28               ` erik quanstrom
2012-08-29  8:09             ` dexen deVries
2012-08-29  8:38             ` Dan Cross
     [not found]             ` <CAEoi9W5_r=4w5EcdrbKuqD566p=C5KvEEHg72YKzdat18En2-w@mail.gmail.c>
2012-08-29 13:57               ` erik quanstrom
2012-08-29 15:07                 ` Charles Forsyth
2012-08-30 10:05                 ` Dan Cross
2012-08-30 10:43                   ` Charles Forsyth
2012-08-30 13:41                   ` dexen deVries
2012-08-30 13:47                     ` erik quanstrom
2012-08-30 14:26                       ` dexen deVries
2012-08-30 14:29                         ` erik quanstrom
2012-08-30 14:24                     ` Dan Cross
     [not found]                     ` <CAEoi9W6NL-zGryJnMrAX3B77bk1bOEMfkv_R7M4W052LZR4yrg@mail.gmail.c>
2012-08-30 14:26                       ` erik quanstrom
2012-08-30 14:33                         ` Dan Cross
     [not found]                         ` <CAEoi9W45W0pK7MA2FvxsCVCuRcqw-JxOiEn+JQtWMo0rFcSEpg@mail.gmail.c>
2012-08-30 14:41                           ` erik quanstrom
2012-08-30 14:48                             ` dexen deVries
2012-08-30 15:11                               ` sl
2012-08-30 15:13                               ` Lucio De Re
2012-08-30 15:07                                 ` Burton Samograd
2012-08-30 15:13                                 ` Charles Forsyth
2012-08-30 15:14                                   ` Charles Forsyth
2012-08-30 17:02                   ` Bakul Shah [this message]
2012-08-30 17:18                     ` erik quanstrom
2012-08-30 20:06                       ` Charles Forsyth
     [not found]                   ` <CAOw7k5jQxJCs64ZjrXp1mU0zTUTG6p7VXYX5ykwQ8OmFATLirg@mail.gmail.c>
2012-08-30 20:10                     ` erik quanstrom
     [not found]                 ` <CAEoi9W6c2JaxrTDwR76TjuN9DeBXnO6gueOGCaEh+Fksfb9zqQ@mail.gmail.c>
2012-08-30 13:33                   ` erik quanstrom
2012-08-30 14:21                     ` Dan Cross
2012-08-30 14:25                       ` Dan Cross
2012-08-30 14:45                     ` Charles Forsyth
2012-08-30 14:55                       ` Charles Forsyth
     [not found]                   ` <CAEoi9W5AagpdK4aZCYs5tSMESU3yoMe9bmgX3GcphTcYuMq9kQ@mail.gmail.c>
2012-08-30 14:34                     ` erik quanstrom
2012-08-30 14:44                     ` erik quanstrom
     [not found]                   ` <CAOw7k5i-JO=bOS8h+S0zdWghCWhSN36uFebMYnzvs=fdNQgA+g@mail.gmail.c>
2012-08-31  1:33                     ` erik quanstrom
2012-10-25 14:56 ` [9fans] rc vs sh Ethan Burns
2012-10-25 15:08   ` hiro
2012-10-25 17:02     ` Gorka Guardiola
2012-10-25 17:18       ` Matthew Veety
2012-10-25 17:26         ` John Floren
2012-10-25 19:03           ` hiro
2012-10-25 19:08     ` Skip Tavakkolian
2012-08-30 15:24 [9fans] rc's shortcomings (new subject line) Lucio De Re

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=20120830170241.A8D27B827@mail.bitblocks.com \
    --to=bakul@bitblocks.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).