From: Bulat Ziganshin Date: 2002-10-03T16:51:46+09:00 Subject: Re: Please help, question regarding threads Hello Andrew, Thursday, October 03, 2002, 11:25:07 AM, you wrote: AC> I am worried about scalability, does using class variables for storing the AC> data prevent a copy from being produced (loaded) once in each thread? That AC> is if the data is stored in class variables within their respective AC> objects, is there only one copy in memory that is shared among the various AC> threads that are running? yes. ruby threads are very simple and light. it is close to just switching "program counter" between several locations and no more. data can be made local to the thread only by calling method or creating closure (standard ruby ways to make local data) and class data is common for all threads: class A def A.set(x) @@x = x end def A.get @@x end end A.set(1) p A.get Thread.new { A.set(2) }.join p A.get -- Best regards, Bulat mailto:bulatz@integ.ru