9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] a pair nec bugs
Date: Sat, 21 May 2011 08:16:43 -0400	[thread overview]
Message-ID: <5944822d239a5f003889f15fac07fabe@brasstown.quanstro.net> (raw)
In-Reply-To: <ffc26a1aba541310fc0935f30717b668@terzarima.net>

> we've had several attempts at trying to guess in the library's
> guts when the cached value(s) have gone wrong, but they haven't worked
> because there are too many cases and the library function can't detect them precisely
> if at all. also, using the current process as the cache key probably isn't right:
> often it's fine for the file descriptor to be shared by a group;
> on the other hand, if each process has its own file descriptor,
> there's no way to tell when the descriptors have been rearranged.
> nor can the program currently tell the library what it has done.

while it is a bit clunky, i think nsec() can detect whenever it could
have the wrong fd and it can limit itself to 1 open per pid, which
would seem to be the case where it could make a big difference.
(that's the code i posted.)  it seem's oddly like ken's file server's
read ahead algorithm.  start read ahead when the second block
in a row is read.

it may open too many fds, but i believe it doesn't improperly
use fds, thrash when a table gets full, nor go into an infinite
loop under adverse conditions.

> file descriptors are just one form of shared state.

so are note groups.  the difference is we can get the note group
id from user space.  we can't do this with fd groups.  (there's
really no such concept.)

> syslog, times and truerand(!) also would benefit.
> of all of them so far, only times(2) really is per-process.

i suppose there are a couple of more precise ways of
dealing with this shared state.

1.  we already have an open flag OCEXEC.  wouldn't these
problems also be solved by a flag that closed the fd in
the child when the file descriptor table was copied?

2.  wrapping rfork so that rfork detects RFFDG, and
invalidates the child's cached file descriptors.

- erik



  reply	other threads:[~2011-05-21 12:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-20  1:30 erik quanstrom
2011-05-20  5:05 ` [9fans] a pair nsec bugs erik quanstrom
2011-05-20 10:43 ` [9fans] a pair nec bugs ron minnich
2011-05-20 10:52   ` roger peppe
2011-05-20 10:57     ` ron minnich
2011-05-20 12:47   ` erik quanstrom
2011-05-20 19:03     ` ron minnich
2011-05-20 19:16       ` erik quanstrom
2011-05-21  3:27       ` erik quanstrom
2011-05-21  9:59         ` Charles Forsyth
2011-05-21 12:16           ` erik quanstrom [this message]
2011-05-21 21:50           ` erik quanstrom
2011-05-21 22:14             ` Charles Forsyth
2011-05-22  3:06               ` erik quanstrom
2011-05-22 13:30                 ` Charles Forsyth
2011-06-02 19:16                   ` erik quanstrom
2011-06-03  9:52                     ` Charles Forsyth
2011-06-04 18:12                       ` adriano
2011-06-03 13:13 erik quanstrom

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=5944822d239a5f003889f15fac07fabe@brasstown.quanstro.net \
    --to=quanstro@quanstro.net \
    --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).