From: Gyoung-Yoon Noh Date: 2004-11-27T03:21:29+09:00 Subject: Re: [ANN] Multiplexer - linear non-blocking I/O Until one thread terminates a system call like IO-related task, other threads will be blocked. Kernel does not know ruby's (userland) threads, so if your application needs concurrency in massive IO tasks, maybe you should implement a kind of thread scheduler by yourself. OK, Kernel#fork will be an another choice. If 'thread' is only sufficient for all, why did Sun adopt NIO in Java2 1.4? Run following server example, and execute 'telnet localhost 31337' on two each shell, no client connection will be blocked. require 'multiplexer' class Test2 < Multiplexer::Handler def initialize super() end def handle begin write_line "ooo" * 10000000 rescue EOFError puts "My client closed its socket." end end end def test multiplexer = Multiplexer::Multiplexer.new 0.5 multiplexer.client_data = [] multiplexer.listen 31337, Test2 puts "Listening on port 31337." multiplexer.run end if $0 == __FILE__ test end IMHO, multiplexinig is a good choice for concurrent programming in ruby, insofar ruby VM does not support native threads. Best regards, -- http://nohmad.sub-port.net