From: Charles Oliver Nutter Date: 2008-07-01T09:55:46+09:00 Subject: Re: Threads and Ruby ara.t.howard wrote: > > On Jun 30, 2008, at 3:14 AM, Charles Oliver Nutter wrote: > >> I hope you mean "for this situation". Processes are definitely not the >> solution to all problems. > > well, given that the difference between processes and threads is an > incredibly small one for any modern os, and given that threads are *at > least* 100 harder to write deterministic code for (as your bug reports > regarding exception handling and ruby illustrate) i'd hazard a guess > that processes are *almost* always the correct solution when robust code > is desired. in otherwords i'd take the position that one should always > use processes unless the reason becomes clear to use threads and, of > course ,there are indeed reasons. this is mostly a comment on the > limitations of programmers and not on platforms or languages, > nevertheless the incredible ease of IPC with ruby makes it even more > true imho. The fact that Ruby's threading has many breakages and pitfalls does not mean threading in general is the wrong way to fix things. Java threading works extremely well, with the only real requirement that you must either synchronize or avoid access to shared resources. Power...responsibility...etc. You can't damn threading because the standard implementation of Ruby doesn't do it well. Perhaps you're right that when you only have access to green threads that processes are the right way to go, since green threads don't really gain you anything other than simulated asynchrony. But native threads done right are as good as separate processes, with the bonus that you can share fast in-memory access to resources if you're willing to accept the synchronization cost and complexity. - Charlie