Thread: Re: [HACKERS] Safe/Fast I/O ...

Re: [HACKERS] Safe/Fast I/O ...

From
Andrew Martin
Date:
> > As David Gould mentioned, we need to do pre-fetching of data pages
> > somehow.
> >
> > When doing a sequential scan on a table, the OS is doing a one-page
> > prefetch, which is probably enough.  The problem is index scans of the
> > table.  Those are not sequential in the main heap table (unless it is
> > clustered on the index), so a prefetch would help here a lot.
> >
> > That is where we need async i/o.  I am looking in BSDI, and I don't see
> > any way to do async i/o.  The only way I can think of doing it is via
> > threads.
>
> I found it.  It is an fcntl option.  From man fcntl:
>
>      O_ASYNC      Enable the SIGIO signal to be sent to the process group when
>                   I/O is possible, e.g., upon availability of data to be read.
>
> Who else supports this?
>

under Irix:

man fcntl:

     F_SETFL   Set file status flags to the third argument, arg, taken as an
               object of type int.  Only the following flags can be set [see
               fcntl(5)]:  FAPPEND, FSYNC, FNDELAY, FNONBLK, FDIRECT, and
               FASYNC.  Since arg is used as a bit vector to set the flags,
               values for all the flags must be specified in arg.  (Typically,
               arg may be constructed by obtaining existing values by F_GETFL
               and then changing the particular flags.)  FAPPEND is equivalent
               to O_APPEND; FSYNC is equivalent to O_SYNC; FNDELAY is
               equivalent to O_NDELAY; FNONBLK is equivalent to O_NONBLOCK;
               and FDIRECT is equivalent to O_DIRECT.  FASYNC is equivalent to
               calling ioctl with the FIOASYNC command (except that with ioctl
               all flags need not be specified).  This enables the SIGIO
               facilities and is currently supported only on sockets.

....but then I can find no details of FIOASYNC on the ioctl page or pages
referenced therein.


Andrew


----------------------------------------------------------------------------
Dr. Andrew C.R. Martin                             University College London
EMAIL: (Work) martin@biochem.ucl.ac.uk    (Home) andrew@stagleys.demon.co.uk
URL:   http://www.biochem.ucl.ac.uk/~martin
Tel:   (Work) +44(0)171 419 3890                    (Home) +44(0)1372 275775

Re: [HACKERS] Safe/Fast I/O ...

From
Bruce Momjian
Date:
>
> > > As David Gould mentioned, we need to do pre-fetching of data pages
> > > somehow.
> > >
> > > When doing a sequential scan on a table, the OS is doing a one-page
> > > prefetch, which is probably enough.  The problem is index scans of the
> > > table.  Those are not sequential in the main heap table (unless it is
> > > clustered on the index), so a prefetch would help here a lot.
> > >
> > > That is where we need async i/o.  I am looking in BSDI, and I don't see
> > > any way to do async i/o.  The only way I can think of doing it is via
> > > threads.
> >
> > I found it.  It is an fcntl option.  From man fcntl:
> >
> >      O_ASYNC      Enable the SIGIO signal to be sent to the process group when
> >                   I/O is possible, e.g., upon availability of data to be read.
> >
> > Who else supports this?
> >
>
> under Irix:
>
> man fcntl:
>
>      F_SETFL   Set file status flags to the third argument, arg, taken as an
>                object of type int.  Only the following flags can be set [see
>                fcntl(5)]:  FAPPEND, FSYNC, FNDELAY, FNONBLK, FDIRECT, and
>                FASYNC.  Since arg is used as a bit vector to set the flags,
>                values for all the flags must be specified in arg.  (Typically,
>                arg may be constructed by obtaining existing values by F_GETFL
>                and then changing the particular flags.)  FAPPEND is equivalent
>                to O_APPEND; FSYNC is equivalent to O_SYNC; FNDELAY is
>                equivalent to O_NDELAY; FNONBLK is equivalent to O_NONBLOCK;
>                and FDIRECT is equivalent to O_DIRECT.  FASYNC is equivalent to
>                calling ioctl with the FIOASYNC command (except that with ioctl
>                all flags need not be specified).  This enables the SIGIO
>                facilities and is currently supported only on sockets.
>
> ....but then I can find no details of FIOASYNC on the ioctl page or pages
> referenced therein.

I have found BSDI does not support async i/o.  You need a separate
process to do the i/o.  The O_ASYNC flag only works on tty files.

--
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)