chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] How to avoid busy waiting when using tcp-accept and


From: felix
Subject: Re: [Chicken-users] How to avoid busy waiting when using tcp-accept and threads?
Date: Tue, 25 Feb 2003 19:24:44 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020529

Joerg F. Wittenberger wrote:

To me it looks as if there is a glitch in the scheduler code.  While
you code sits busy wainting, the scheduler would do the same, if there
where only blocked threads.

Yes, but the scheduler will *loop* waiting for threads to become
available (for example, because of timeout).

(But I don't claim the scheduler to be error-free, of course)


Maybe I'm missing something.  Do I?  Otherwise I'd suggest that
select(2) should be called with a non-zero timeout value, if there is
no thread to ready to run.  The timeout value should be exactly until
the next real time event (threads-sleep!) is due, which then should be
delivered.

There is no exact time-slice, I'm afraid. The interrupt checks inserted
into the code may not be distributed evenly among the compiled code.
We can perhaps use an approximate value, though.

Or we can make this user-configurable.


Did anybody get any multithreaded server code already running with
tcp.scm?  I'd appreciate an example.


Well, the http server (and the "server" script) are multithreaded.


cheers,
felix






reply via email to

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