[#2617] irb for 1.5.x — Andrew Hunt <Andy@...>
5 messages
2000/05/03
[#2639] OT: Japanese names — Dave Thomas <Dave@...>
4 messages
2000/05/09
[#2643] Ruby Toplevel — Dave Thomas <Dave@...>
7 messages
2000/05/09
[#2656] Re: Append alias for Array.append? — Aleksi Niemel<aleksi.niemela@...>
Hideto ISHIBASHI:
5 messages
2000/05/09
[#2660] win OLE / eRuby — Andrew Hunt <Andy@...>
8 messages
2000/05/09
[#2663] Re: win OLE / eRuby — Aleksi Niemel<aleksi.niemela@...>
>At Tue, 9 May 2000 09:14:51 -0400,
4 messages
2000/05/09
[#2667] The reference manual is now online — Dave Thomas <Dave@...>
6 messages
2000/05/09
[#2668] Re: The reference manual is now online — schneik@...
4 messages
2000/05/09
[#2702] Re: Append alias for Array.append? — Andrew Hunt <andy@...>
>From: Aleksi Niemel<aleksi.niemela@cinnober.com>
7 messages
2000/05/10
[#2752] RE: Array.pop and documentation [was: Append al ias for Array.append?] — Aleksi Niemel<aleksi.niemela@...>
6 messages
2000/05/11
[#2758] Re: irb install — Andrew Hunt <andy@...>
>|Excellent! Will you consider adding mod_ruby to install_app as
7 messages
2000/05/11
[#2777] Re: irb install
— "NAKAMURA, Hiroshi" <nakahiro@...>
2000/05/12
Hi,
[#2764] More code browsing questions — Albert Wagner <alwagner@...>
I see some class definitions contain "include" and "extend" statements.
6 messages
2000/05/12
[#2843] Re: editors for ruby — "Conrad Schneiker" <schneiker@...>
(Posted on comp.lang.ruby and ruby-talk ML.)
6 messages
2000/05/17
[#2874] RE: simple httpd for local use — Aleksi Niemel<aleksi.niemela@...>
> I personally use it for access to full-text indexed linux
6 messages
2000/05/18
[#2875] Re: simple httpd for local use
— hipster <hipster@...4all.nl>
2000/05/18
On Thu, 18 May 2000 09:10:28 +0200, Aleksi Niemelwrote:
[#2920] SWIG: virtual variable? — Yasushi Shoji <yashi@...>
hello,
4 messages
2000/05/22
[#2928] FYI: What our Python friends are up to. — "Conrad Schneiker" <schneiker@...>
Hi,
8 messages
2000/05/22
[#2964] Thank you — h.fulton@...
Thanks, Matz (and others) for your replies to
4 messages
2000/05/24
[#2973] Re: Socket.getnameinfo — ts <decoux@...>
>>>>> "D" == Dave Thomas <Dave@thomases.com> writes:
10 messages
2000/05/25
[#3016] rbconfig.rb — Dave Thomas <Dave@...>
5 messages
2000/05/28
[#3039] Re: Final for World Series: Python vs Ruby — "Dat Nguyen" <thucdat@...>
1 message
2000/05/30
[#3058] FailureClass? — Aleksi Niemel<aleksi.niemela@...>
Question arising from the FAQ:
7 messages
2000/05/31
[ruby-talk:02927] Re: mutex mechanism?
From:
kjana@... (YANAGAWA Kazuhisa)
Date:
2000-05-22 13:08:49 UTC
List:
ruby-talk #2927
In message <200005212300.TAA27003@toolshed.com> Andy@Toolshed.Com writes: > Can someone please educate me on the preffered method of handling > mutual exclusion in threads? It would seem that Thread.critical isn't > quite sufficient, and their exists a number of library modules that > provide some form of mutex or other synchronization mechanism. > > Which one is the preferred method? That's depends on the situation where synchronization is needed. Thread.critical is the most primitive way of mutual exclusion. You can forbid another thread to run by `Thread.critical = true'. However this method is too primitive to use everywhere. We almost always want to exclude another thread from some critical region of code. It is undesirable that a thread which does not touch critical resources also stopped unnecessarily. Mutex provides more loose and desirable functions to implement critical region. Threads that use shared resources acquire the Mutex attached the resources. Since Mutex can be acquired by just one thread at a time, only the thread got a Mutex can do something with the resources. At here, threads which does not use the resources and not acquire the Mutex can run in parallel. Monitor is an abstract that represents a resource which can be accessed by only one thread at a time. Basically Monitor can be seen as an object which methods are all in critical region attached to one Mutex --- a thread executes a method of Monitor, all other thread call a method of the Monitor is awaited. The thread in Monitor can be wait for some conditions are met on ConditionVariable. When the thread calls ConditionVarible#wait or like, the thread sleeps and release the Monitor for another thread to progress. When a thread calls ConditionVariable#signal or like, the thread awaited on the ConditionVariable acquire the Monitor again and go on. These scheduling and acquire/release are done automatically. So more easy to read/write when complex behavior is needed. Sync resembles to Mutex, both are used to mutual exclusion, but Sync is differ from Mutex because it provides a facility of `reader/writer lock'. In threaded applications we often need maximum parallelism. If the shared resources are frequently read but modified not so often, `reader' threads can be parallelly executed without a significant conflict. Sync is designed for these situations. # Well, long but a not so useful answer. *sigh* -- kjana@os.xaxon.ne.jp May 22, 2000 Of two evils choose the lesser.