Martin Wilck wrote:
I don't think we want to use threads at all. This has major overhead and compatibility problems. IMO normal file I/O should always be done synchronously; it may impact performance a bit when reading from floppy, but this is better than slowing down all async operations with the need to manage threads and locks.
OK, let's forget about this in the first place. I thought that clone() calls actually have pretty low overhead, but I may be mistaken (and too Linux-centric). And I did not think through all necessary synchonization needs.
You may want to consider using Posix aio to implement overlapped I/O, regardless of whether it's a disk file, a network connection, or whatever. glibc has a fallback implementation of aio, and vendors are starting to provide optimized, high-quality implementations. SGI and Red Hat are working hard on it.
For more info, see http://www.kegel.com/c10k.html#aio
And then there are completion ports... more on that later. - Dan