Re: debate on 700 threads vs asynchronous code

Dan Kegel
2003-01-24T23:52:18Z

Mark Hahn wrote:
>>>>>does epoll provide a thunk (callback and state variable) as well as the
>>>>>IO completion status?
>>>>
>>>>No. It provides an event record containing a user-defined state pointer
>>>>plus the IO readiness status change (different from IO completion status).
>>>>But that's what you need; you can do the call yourself.
>>>
>>>well, that means another syscall, which makes a footprint claim kind of moot,
>>>no?
>>
>>What syscall? You call sys_epoll once for every thousand events or so,
>>then you call your handler, which does a write or whatever. No
>>extra syscall.
>
> before a client can be sent the next chunk, the IO status of the last
> chunk must be tested. with the simple blocking, thread-per-client approach,
> this happens automaticaly (write returns the number of bytes written).
>
> with epoll, don't you have to do a syscall to query the status of
> the just-completed IO?

Nope. Just go ahead and write. (Same as with poll(), except that
with epoll, you only get notified once.) Any errors are reported
immediately by write(), so there's no more status to get.
- Dan

--
Dan Kegel