From: Michael Neumann Date: 2004-12-04T01:12:13+09:00 Subject: Re: [nuby] about ruby multithreading James Edward Gray II wrote: > On Dec 3, 2004, at 9:47 AM, Lionel Thiry wrote: > >> Hello! >> I need help: >> Is Ruby multithreading cooperative or preemptive? > > > Preemptive. > >> I mean: am I forced to abuse of Thread.pass in (every heavy) threads >> or may I just assume the ruby interpreter will commute threads itself? > > > Yes, ruby will handle thread scheduling. > >> Another question: >> Is Ruby multithreading blocked by system calls? >> >> Like for example when calling system("command line"). > > > Hmm, good question. I assume yes, but let's let someone who knows > better than me answer this one... ;) Yes: Thread.new { loop do sleep 1 p "." end } system("sleep 10000") And for IO operations, this is true, too. Ruby does not block on read/write as it internally uses select. Regards, Michael