Re: Q for the standards gurus...

Mike Jagdis (mike@roan.co.uk)
Tue, 6 May 1997 17:20:01 +0100 (GMT/BST)


On Sun, 4 May 1997, Alan Cox wrote:

> > Sun boasted improved performance with KAIO in Solaris 2.4, more or
> > less at the same time when they modularized telnetd and ran that
> > in kernel as well.
>
> Yep. A lot of OS's put AIO into user space as a thread operation either doing
> the thread fork on the user or kernel side. In the Linux case we can create
> shared vm theads and destroy them in under 10uS

But we also take up a task slot and pay a price in memory. The page
used for the kernel stack also gets cleared as I remember...

Using a thread per AIO request is the quickest solution but really
limits the number of outstanding asynchronous requests we could
handle at once. I think we can do better.

What I was *thinking* of (note: *thinking* - not *doing* :-) ) was
implementing some form of callback system so that we could specify
an action to be taken (or queued on a particular process to be taken
next time it is scheduled so we have its user space) when, for
instance, a given buffer becomes up to date. That should be lower
overhead than a thread create/destroy. For block devices we just
fire off the read/write block request with an attached callback.
For normal files we can do something like readpage, use bmap to
get block numbers then queue them with callbacks (ok, bmap may
block on I/O but may reasonably be expected to hit buffered data
most of the time?). By dealing in device blocks we also have
the option of doing I/O direct to user space (if we require
the user to give suitably aligned buffers - SCO does) and bypassing
the buffer cache (again readpage is good example code). This
probably makes a lot of sense since things that use AIO are
probably in control of their own caching and read ahead/write
behind and reducing buffer copying is always good.

But anyway, at this stage it's just the overflow from my
subconscious... :-)

Mike

-- 
.----------------------------------------------------------------------.
|  Mike Jagdis                  |  Internet:  mailto:mike@roan.co.uk   |
|  Roan Technology Ltd.         |                                      |
|  54A Peach Street, Wokingham  |  Telephone:  +44 118 989 0403        |
|  RG40 1XG, ENGLAND            |  Fax:        +44 118 989 1195        |
`----------------------------------------------------------------------'