lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thursday 20 January 2005 07:44, Diego Nehab wrote:
[...]
> Not true. You should use non-blocking I/O and avoid blocking altogether.
> I don't think you can cancel a blocked thread safely. On Windows at
> least I read somewhere that it can be catastrophic...

Point of information: the OS I work on during my real job does everything 
non-blocking. It needs to run hosted on top of other operating systems, 
including Linux and Windows, which do blocking I/O. Implementing non-blocking 
I/O on blocking I/O is a *nightmare*.

The Posix AIO stuff helps a little but only a very little --- it supports 
non-blocking reads and writes only, and is no help at all on things like 
socket connects and DNS lookups. And how does the default glibc 
implementation work? By using a pool of helper threads, each of which blocks 
on a particular request.

Linux is getting support for real AIO, but it's non-standard and not yet 
there. Windows may or may not have AIO support somewhere in its labyrinthine 
maze of APIs.

...incidentally, any OS worth its salt should be able to destroy a thread 
that's blocked on I/O. (We do it in order to cancel asynchronous events.) If 
not, there's something deeply wrong with it.

-- 
+- David Given --McQ-+ "`Aplysia californica' is your taxonomic
|  dg@cowlark.com    | nomenclature.
| (dg@tao-group.com) | A slug, by any other name, is still a slug by
+- www.cowlark.com --+ nature." --- drushel on a.f.c