9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Russ Cox" <rsc@swtch.com>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] locking
Date: Wed, 18 Apr 2007 12:35:42 -0400	[thread overview]
Message-ID: <20070418163542.D1D3B1E8C3A@holo.morphisms.net> (raw)
In-Reply-To: <93f386afe6d3798ebd79035d9675a65d@quintile.net>

> I want to run this multithreaded, but the requests
> and replies are not atomic on the same file descriptor.
> Thus I need to have each thread request on its own file
> descriptor, or, have a Qlock in the requesting program
> to interlock requests and replies.

does the synethetic file protocol have request ids so that
it can allow multiple outstanding requests
and can send replies out-of-order?

if so, then you need only multiplex the requests onto
the synthetic file.  see libmux in the p9p distribution
for a simple encapsulation of the relevant logic.

if not, then you really need one fd per active request.
you could use a cache of already-opened fds; 
that would only grow to the number of active requests,
not the number of threads.

russ



  reply	other threads:[~2007-04-18 16:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-18 12:24 Steve Simon
2007-04-18 16:35 ` Russ Cox [this message]
2007-04-18 23:10   ` Steve Simon

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=20070418163542.D1D3B1E8C3A@holo.morphisms.net \
    --to=rsc@swtch.com \
    --cc=9fans@cse.psu.edu \
    /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).