9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: roger peppe <rogpeppe@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] 9p2010
Date: Thu, 23 Apr 2009 18:22:21 +0100	[thread overview]
Message-ID: <df49a7370904231022g1ce3d3f9sf172b095898b9592@mail.gmail.com> (raw)
In-Reply-To: <e6be4507c9b383e1b20cb8d26f3d03ad@quanstro.net>

2009/4/23 erik quanstrom <quanstro@quanstro.net>:
> it occurred to me yesterday morning that the problem with
> a bundle of 9p requests is that 9p then no longer maps directly
> to system calls.
>
> with 9p2000, if you want to do a Tread, it's pretty clear that
> one needs to read(2); traditiona syscalls map directly to 9p.

true, but it is a one-to-many mapping - for instance, a single call to
open may generate an arbitrary number of 9p messages.

> not so when bundles/sequences are introduced.  how does a
> user program generate an arbitrary bundle?  can programs
> use bundles at all without being rewritten?

this is an interesting question.

as a starting point, i'd envisaged simply changing the existing
system calls to do sequences.

in inferno, where it's easy to add system calls, it would be
straightforward, i think, to add some additional system-level primitives,
(e.g. readfile) that took advantage of sequencing.
but that is cheating really - ideally you'd want a user-level
interface to this functionality.

the difficulty with creating the interface is that a 9p call
must be separated into two parts - the sending of the
parameters and the retrieving of the results.

for a low level 9p interface, i'd imagined something like
the following interface (in pseudo limbo):

Sequence: adt {
	queue: fn(seq: self ref Sequence, m: Tmsg, tag: any);
	wait: fn(seq: self ref Sequence): (any, Tmsg, Rmsg);
	cont: fn(seq: self ref Sequence);
	flush: fn(seq: self ref Sequence);
}

queue adds a new message to the sequence (with an arbitrary
tag to attach to the result of the call). wait waits for the next
reply to come in and returns the tag, the originating tmsg and the
reply. cont continues executing a sequence after it has
been aborted due to error (this will resend tmsgs). flush aborts
the sequence.

so this is ok when dealing with 9p or the dev interface directly, but
won't work so well
with higher level calls. it would be nice for a user-level program to
be able to string together an arbitrary sequence of system calls
into a sequence, but i'm not sure what a decent interface would look like.
(something like the above Sequence adt, but with a system call description
instead of Tmsg and a system call result instead of Rmsg, perhaps,
although it's not clear what a "system call description" would look like,
or how easy it would be to split system calls)

the control flow is not straightforward (or perhaps it is - it's the kind
of thing that might just have a nice elegant solution lurking there somewhere).

something to think about.



  reply	other threads:[~2009-04-23 17:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-23 16:26 erik quanstrom
2009-04-23 17:22 ` roger peppe [this message]
2009-04-23 17:28   ` erik quanstrom
2009-04-23 17:38     ` David Leimbach
2009-04-23 17:31   ` Fco. J. Ballesteros
2009-04-23 17:53     ` roger peppe
2009-04-26 21:29       ` Roman V. Shaposhnik
2009-04-27  7:32         ` roger peppe
2009-04-23 17:55   ` Eric Van Hensbergen
2009-04-23 18:35     ` Steve Simon
2009-04-23 17:54 ` Gary Wright

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=df49a7370904231022g1ce3d3f9sf172b095898b9592@mail.gmail.com \
    --to=rogpeppe@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).