Hi, I''m researching how Ruby works with threads. Could someone help with what a "green" thread is and a native thread? Also, what is the relationship between these threads, Rails and the VMs that have been (are being) built? Thanks, Ron --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Mar 30, 5:16 am, Ron <stecklyena...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > I''m researching how Ruby works with threads. Could someone help with > what a "green" thread is and a native thread? Also, what is the > relationship between these threads, Rails and the VMs that have been > (are being) built? >Well this isn''t really a rails question but never mind. Basically, a native thread is one which maps to the host operating system''s idea of a thread, green threads are ones that don''t. With native threads you''ll make use of multiple processor cores, but not with green threads (since as far as the OS is concerned you only have 1 thread). An added ''bonus'' is that some things in ruby will block the entire VM. MRI uses green threads, jruby uses native threads (IIRC) and i think ruby 1.9 has native threads (but in some fairly restricted form due to concerns about extensions backwards compatibility. If you''re writing a rails app none of this really matters since rails is single threaded. Fred --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Fred, Thanks for this and for the help with xml. I guess the thought behind my question was in trying to understand using a pack of mongrels behind lighttpd or nginx. I was reading in <a href="http:// www.loudthinking.com/">DHH''s<a/> blog about the issue of multi-core processors and how Rails scales. I was trying to get at why we needed to set up multiple mongrels to handle loads. I can see now where the question doesn''t pertain to rails because of the fact that rails is single threaded. I''m gathering from the post that the reason we do multiple Mongrels behind nginx/lighttpd is that, because Rails is single threaded, we need multiple processes to handle multiple requests at the same instant? Ron On Mar 30, 2:16 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Mar 30, 5:16 am, Ron <stecklyena...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi, > > > I''m researching how Ruby works with threads. Could someone help with > > what a "green" thread is and a native thread? Also, what is the > > relationship between these threads, Rails and the VMs that have been > > (are being) built? > > Well this isn''t really a rails question but never mind. Basically, a > native thread is one which maps to the host operating system''s idea of > a thread, green threads are ones that don''t. With native threads > you''ll make use of multiple processor cores, but not with green > threads (since as far as the OS is concerned you only have 1 thread). > An added ''bonus'' is that some things in ruby will block the entire VM. > MRI uses green threads, jruby uses native threads (IIRC) and i think > ruby 1.9 has native threads (but in some fairly restricted form due to > concerns about extensions backwards compatibility. > If you''re writing a rails app none of this really matters since rails > is single threaded. > > Fred--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 30 Mar 2008, at 18:20, Ron wrote:> > Hi Fred, > I''m gathering from the post that the reason we do multiple Mongrels > behind nginx/lighttpd is that, because Rails is single threaded, we > need multiple processes to handle multiple requests at the same > instant? >Correct. Fred> Ron > > On Mar 30, 2:16 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: >> On Mar 30, 5:16 am, Ron <stecklyena...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >>> Hi, >> >>> I''m researching how Ruby works with threads. Could someone help >>> with >>> what a "green" thread is and a native thread? Also, what is the >>> relationship between these threads, Rails and the VMs that have been >>> (are being) built? >> >> Well this isn''t really a rails question but never mind. Basically, a >> native thread is one which maps to the host operating system''s idea >> of >> a thread, green threads are ones that don''t. With native threads >> you''ll make use of multiple processor cores, but not with green >> threads (since as far as the OS is concerned you only have 1 thread). >> An added ''bonus'' is that some things in ruby will block the entire >> VM. >> MRI uses green threads, jruby uses native threads (IIRC) and i think >> ruby 1.9 has native threads (but in some fairly restricted form due >> to >> concerns about extensions backwards compatibility. >> If you''re writing a rails app none of this really matters since rails >> is single threaded. >> >> Fred > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---