9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Blocking reads on single-threaded Srv-based 9p server?
@ 2007-04-06  3:33 Colin DeVilbiss
  2007-04-06  6:30 ` Kris Maglione
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Colin DeVilbiss @ 2007-04-06  3:33 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

I'm implementing a 9p server using plan9port.

I'd like one of my files to have "blocking read" or "blocking write"
behavior: any such call should block until a write occurs on some
other (non-blocking) file in the same server.

Is there some reason that I shouldn't implement that in a
single-threaded server?  The 9p(3) plan9ports manpage suggests that
only multi-threaded servers should "block" requests by not
respond()ing to them before returning from the associated service
routine, and that only multi-threaded servers would need to implement
flush().

My plan:
    In my Srv's read() (or write()) routine, if a Req comes in for
that file and I decide that it should block, I save it off somewhere
and don't respond() to it.
    In my write() routine, if a "should unblock any waiters" event
occurs, go find all of the associated "saved" Req's and respond() to
them all.
    Implement a flush() routine that "un-saves" the oldreq and
responds with "interrupted" (per the manpage).

Does that sound viable, or is there some machinery inside Srv that I
would run afoul of by doing that?

As a side note, I see that none of the 9p filesystems that are
currently packaged in plan9port are both single-threaded and
Srv-based.  Is there some reason I don't want to do that here?

Thanks.

Colin DeVilbiss


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-04-06 14:01 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-06  3:33 [9fans] Blocking reads on single-threaded Srv-based 9p server? Colin DeVilbiss
2007-04-06  6:30 ` Kris Maglione
2007-04-06 10:43   ` pedro henrique antunes de oliveira
2007-04-06 10:45     ` pedro henrique antunes de oliveira
2007-04-06 10:58     ` erik quanstrom
2007-04-06 13:52 ` Russ Cox
2007-04-06 14:01 ` Skip Tavakkolian

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).