Optimal multithread model

Christophe Meessen christophe at meessen.net
Wed Mar 17 12:13:49 CET 2010


Marc Lehmann a écrit :
>
> Well, the event loop has much lower cpu costs overall for the same jobs.
>   
Reading http://state-threads.sourceforge.net/docs/st.html helped to 
convince me.
The event loop combined with coroutines seems indeed the optimal approach.
Though I'm still a bit unsure about one aspect.

My project is a CORBA like application with the difference that the 
encoding is designed for stream oriented processing. It is thus a 
middleware and the task to be performed is in general user defined. And 
such a user defined task could be to compute a few thousand decimals of 
Pi which will monopolize the CPU if not preempted.

Is there a way to have a pure single threaded EDSM model per CPU core 
and still be able to cope with such type of use cases ? For instance, 
could a signal triggered by a timer be used to switch coroutines and 
emulate a preemptive multithreaded system ? I thought about this but it 
seemed like reinventing the wheel, so I gave up and decided to rely on 
kernel developers to do things right.

--
Ch. Meessen



More information about the libev mailing list