Re: Network Programming Models (was OTCountFreeBytes?)
Re: Network Programming Models (was OTCountFreeBytes?)
- Subject: Re: Network Programming Models (was OTCountFreeBytes?)
- From: Peter Sichel <email@hidden>
- Date: Mon, 4 Feb 2002 16:42:03 -0500
o select results in a programming model just like OT notifiers:
everything has to be a state machine. Having grown up on the Mac I
don't mind this programming model--it actually feels kinda
normal--but I've debugged enough developer code to convince me that
not everyone else feels the same way.
The model is similar, but not as lean. In OT, your notifier
is called at interrupt time as packets arrive. With select, your
thread is awakened when the kernel gets around to scheduling you.
Your code doesn't run in a limited interrupt context.
In theory, notifiers can give you lower latency but
few programs fully exploit this. In practice, most developers
prefer getting regular (pre-emptively scheduled) CPU cycles in
their normal application context.
Just as unix trades off latency for ease of programming,
using a RunLoop based model is a natural extension.
The small overhead incurred is often recovered in other areas.
- Peter
--