[Stackless] Problems with Queues in Microthread Lib.

jamwt at mail.coursepeek.com jamwt at mail.coursepeek.com
Fri Mar 16 20:20:42 CET 2001


Actually I was playing around with the idea of an HTTP 
_Server_, where one of the microthreads would be waiting
on blocking I/O while the rest wait on their queues.
When the listen()er accept()s, it would put the fd on 
this shared queue and the first microthread to schedule
up would take it off and process the request.  Kinda
like a 'Pre-forking Server,' but 'Pre-Microthreading'
this time...

Your explaination clarifies a lot for me--however, as
you mentioned, you would expect the blocking I/O to
be broken by an OS thread instead of one of the Microthreads
that have been run().

Also, even given the OS thread case, wouldn't the solution
below be sub-optimal in a server environment?   
Instead of the process forfeiting all CPU cycles until I/O
interrupts, wouldn't it just sit there and burn on that
while loop?

> 
>     while 1:
>         try: uthread.run()
>         except AllUthreadsAreBlocked:
>             if not otherOSthreadIsBehavingCorrectly:
>                 break
>             # else just keep doing uthread.run(), waiting for
>             # some magical event from elsewhere
> 

I could be completely lost here--I am quite new to some of
this stuff...

James Turner
_______________________________________________
Stackless mailing list
Stackless at starship.python.net
http://starship.python.net/mailman/listinfo/stackless



More information about the Stackless mailing list