I'm implementing a multitasking library with non-preemptive
lightweight tasks (threads) using setjmp/longjmp and I'm trying to
support IO calls that won't block other tasks. There are two ways I
can do this, one, by providing worker threads, the other by using the
OS's asynchronous IO mechanism. The two OS's I'm really interested in
implementing the library effeciently for are Windows XP (OVERLAPPED)
and FreeBSD 4.8 (aiocb).
Now for my question: would it be better, given these OS's to implement
it using the worker IO thread mechanism, or use the asynchronous IO
mechanism? If the asynchronous IO mechanism for the OS is implemented
via worker threads, it would be better to implement my own IO worker
threads and use direct blocked IO, correct?
The majority of the IO will be for an object-oriented database system
where direct non-cached IO will be desireable - data being transferred
via random pages (4096 bytes) for the database file, and sequential
blocks (512 bytes), in sequence, for the logfile.