chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] thread scheduling: how about an idle-thread-hook?


From: Peter Keller
Subject: Re: [Chicken-users] thread scheduling: how about an idle-thread-hook?
Date: Fri, 9 Aug 2002 13:04:41 -0500
User-agent: Mutt/1.2i

On Fri, Aug 09, 2002 at 11:02:44AM -0400, Perry E. Metzger wrote:
> 
> address@hidden writes:
> > Has anyone else thought about thread scheduling and I/O multiplexing
> > in chicken? Any suggestions, or approaches that have worked well for
> > others?
> 
> I'd very much like to work without threads for my application and
> stick to a low level select(2)/poll(2)/kqueue(2) style mechanism. I
> intend to build a small event driven programming library on top of the
> underlying socket, POSIX and select/poll mechanisms and work that
> way.
> 
> That is not to say that I oppose having other mechanisms for people
> who want threads -- just that some of us do not want to be forced to
> use them to multiplex I/O. One thing that very much turned me off of
> Scsh was a strongly expressed prejudice against event driven
> programming.

I'm going to have to agree with Perry here too, threaded programming
has its place, but event driven programming off of a select is a widely
practiced method(so are things like non-blocking connects, etc). Also,
threads are very hard to debug and I don't know about the debugging
capabilities of chicken yet(what kind of a debugger does it have? gdb? Not
a good answer... ;) )

Unfortunately, event driven programs break down during lengthy network
protocol exchanges with multiple entities. The code writing you have to do
to make starvation less of a problem (suppose one daemon talking to 400
clients at the same time multiplexing between them) makes you wish you
had threads. However, threads break down almost immediately in usually
having terrible debuggers, poor signal handling, bad reproducability of
transient bugs, and you can't retrofit threads into an existing single
threaded application without serious time sinks.

Don't get me wrong, threading is ok and needed for a lot of things,
but it isn't a magic bullet.

-pete



reply via email to

[Prev in Thread] Current Thread [Next in Thread]