From: khaines@... Date: 2007-01-29T01:21:41+09:00 Subject: Re: Benefits of Multi-Threading? On Sun, 28 Jan 2007, NanoStuff wrote: > I'm slowly going through the pickaxe, and i've hit the multi-threading > chapter. Despite all the juicy information, I can't seem to gather what > the actual benefits of multi-threading on a single processor are. > > Is performance improved despite the limitations of one processor, or is > there a completely performance unrelated purpose to multi-threading that > I missed entirely? Sometimes it is convenience. For instance, if there's an action that you want to have repeated every 5 minutes, you might create a thread just runs in a loop, sleeping for 300 seconds, then performing the action. Threads can also be a useful strategy when accepting outside events. For instance, with a web server one might want to spawn a thread for each connection. The only time you will realize a performance boost from Ruby threads, though, is when there is some time consuming, but non-blocking delay in one thread that allows other threads to use that time in order to get something done. In my experience, they are less about performance than they are about implementation convenience. Kirk Haines