In case anybody else comes across this, this code doesn''t work: Thread.new { EM.epoll Thread.current.priority = 1 EM.run {} } print ''yo'' presumably because if you put the EM thread at higher priority, and it is using ''polling,'' then it just polls constantly and the other threads don''t get any attention. Without epoll it works fine. Any thoughts?
Wow, that''s interesting. I can completely repro that. No idea why epoll would block lower priority threads. I don''t buy your explanation because the reactor runs ruby''s thread scheduler the same way with epoll as with select.( At least I thought it does....) On Nov 19, 2007 3:11 PM, Roger Pack <rogerpack2005 at gmail.com> wrote:> In case anybody else comes across this, this code doesn''t work: > > > Thread.new { > > EM.epoll > Thread.current.priority = 1 > EM.run {} > } > print ''yo'' > > presumably because if you put the EM thread at higher priority, and it > is using ''polling,'' then it just polls constantly and the other > threads don''t get any attention. Without epoll it works fine. Any > thoughts? > _______________________________________________ > Eventmachine-talk mailing list > Eventmachine-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/eventmachine-talk >
On Nov 19, 2007 1:59 PM, Francis Cianfrocca <garbagecat10 at gmail.com> wrote:> Wow, that''s interesting. I can completely repro that. No idea why > epoll would block lower priority threads. I don''t buy your explanation > because the reactor runs ruby''s thread scheduler the same way with > epoll as with select.( At least I thought it does....) > >Hmm. It puts me in a bit of a situation, as it turns out that if you have lots of threads going, the EM thread gets almost no CPU time, for some reason. Odd. That means you have to increase its priority, which fixes it--it works well. However, increasing its priority means you (currently) can''t use epoll. Guess I will need to track down where all my file descriptors are going. Any thoughts?
On Nov 19, 2007 11:57 PM, Roger Pack <rogerpack2005 at gmail.com> wrote:> On Nov 19, 2007 1:59 PM, Francis Cianfrocca <garbagecat10 at gmail.com> wrote: > > Wow, that''s interesting. I can completely repro that. No idea why > > epoll would block lower priority threads. I don''t buy your explanation > > because the reactor runs ruby''s thread scheduler the same way with > > epoll as with select.( At least I thought it does....) > > > > > > Hmm. It puts me in a bit of a situation, as it turns out that if you > have lots of threads going, the EM thread gets almost no CPU time, for > some reason. Odd. That means you have to increase its priority, > which fixes it--it works well. However, increasing its priority means > you (currently) can''t use epoll. Guess I will need to track down > where all my file descriptors are going.I''m really surprised that epoll behaves that way. I need to track that down.