Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- Date: Tue, 29 Jul 2008 01:02:50 +0900
- From: Curt Sampson <cjs@example.com>
- Subject: Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- References: <87fxpzx9mt.fsf@uwakimon.sk.tsukuba.ac.jp> <20080727120405.752622d9.attila@kinali.ch> <20080727223043.GK4228@pragmatic.cynic.net> <d8fcc0800807280002v3f14071dk3b2c9e47ac3269c8@mail.gmail.com> <20080728080316.GA16586@lucky.cynic.net> <d8fcc0800807280309j3d410857w9b9e5fdd3462316a@mail.gmail.com> <20080728114336.GA18114@lucky.cynic.net> <d8fcc0800807280554m1db06f1aq3a58205b1f9861ea@mail.gmail.com> <20080728144249.GA26262@lucky.cynic.net> <d8fcc0800807280805g11e1165cg7252a6b9c9017771@mail.gmail.com>
- User-agent: Mutt/1.5.17 (2007-11-01)
On 2008-07-28 08:05 -0700 (Mon), Josh Glover wrote: > It does indirectly, unless I am misunderstanding you altogether (which > is entirely possible). I would hazard that a lot of your locking > problems originated from attempts to parallellise algorithms, right? Nope. This was back in '99 and 2000: we were running everything except our database servers on single-core, single-CPU systems at the time, so no parallelism was available. Our multi-threaded stuff was entirely due to blocking IO: we needed different threads for each dynamic HTTP request, due to blocking on IO to the web server, the DBMS, and a few other things, we had separate threads for a control console built into each server that let us inspect things and change configuration parameters on the fly, and so on. The locking issues came in with shared data such as DBMS connections (that one was a real ouchie), shared large data structures (or even smaller ones such as sessions), and so on. > There are certainly other uses for threads and the necessity of > locking that they breed, but I guess that parallellisation is one of > the major use cases. Maybe if you do everything in an event-driven framework. :-) Java, early on, was never very amenable to that. > Fork/join gives you that for free, and handles the locking with no > explicit code on your part. Fork/join handles no locking at all. If two separate threads spawned by that access the same data structure at the same time, and you haven't taken care of all of the locking, you're in big trouble. > I guess this is how GHC's "par" works, right? Nope. `par` offers no locking; you need to use explicitly shared data structures and locks. The reason par works so well in Haskell is the style of the language: since you're writing mostly pure code ("pure", by the way, is a term of art here) you don't modify existing data structures, you copy what you need new versions of. Note that this does not preclude data sharing, in fact it encourages it in that the new versions will re-use existing data wherever they can. > What other languages have something analogous to "par"? In the sense of, "spark a separate thread for doing this," lots. In the sense of threads being that lighweight, not all that many implementations, I'd imagine. (A GHC thread uses only a few hundred bytes of memory, and it's fine to spark several thousand of them.) In the sense of making it that easy to use, i.e., changing fib n = fib (n-1) + fib (n-2) to fib n = r `par` (l `pseq` l+r) where l = fib (n-1) r = fib (n-2) I don't know of anything off-hand. > For that matter, what languages are supported by GHC? Just Haskell, or > other languages in that family? Just Haskell. Though, come to think of it, you probably could tack on a new front end that compiles something else to its "primitive" Haskell-like code and then use the rest of GHC to compile that. Oh, BTW, while we're talking about parallelism, I should mention that GHC now has parallel GC implemented (as in, GC that still stops everything else, but uses multiple cores to do the collection faster than a single core could do it alone) and it will be released with GHC 6.10 this fall. It apparently gives GC about a 20% speedup on a two-core machine, and 45% on a four-core. cjs -- Curt Sampson <cjs@example.com> +81 90 7737 2974 Mobile sites and software consulting: http://www.starling-software.com
- Follow-Ups:
- Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- From: Josh Glover
- References:
- Re: work times & accommodation @tokyo, WAS: Re: [tlug] Embedded linux dev wanting to find work in Tokyo.. Seeking advice.
- From: Stephen J. Turnbull
- [tlug] STM (was: Re: work times & accommodation @tokyo)
- From: Attila Kinali
- Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- From: Curt Sampson
- Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- From: Josh Glover
- Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- From: Curt Sampson
- Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- From: Josh Glover
- Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- From: Curt Sampson
- Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- From: Josh Glover
- Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- From: Curt Sampson
- Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- From: Josh Glover
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- Next by Date: [tlug] [SOLVED] Skype 2.x video calling in Linux
- Previous by thread: Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- Next by thread: Re: [tlug] STM (was: Re: work times & accommodation @tokyo)
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links