The future of concurrent programming

Robert Fraser fraserofthenight at gmail.com
Tue May 29 19:33:09 PDT 2007


Heh; it's not too bad once you get used to it. The most important thing to keep in mind is taht all the concurrent programming features people hate (locks, etc.) are usually unnecessary and possibly even bad for performance. I read somewhere that something like 60% of locks (in Java, specifically, but this probably applies to most imperative languages), are actually bad for performance, since it takes longer to acquire all those locks than to allocate immutable objects and use AtomicReferences, etc (memory's cheaper than processing power these days). Of course, that's not possible in all cases, but when it is it's a great boon.

Even if you can't just pass stuff around/use immutables for something, needing to use more than a few locks/muticies generally indicative of tight coupling between modules.

Often, the fewer locks/muticies you use, the better your performance and peace of mind. I haven't tried any multi-threaded coding in D, but with a whole set of atomic variables and transaction support in Tango, it should end up being pretty painless.

Daniel Keep Wrote:

> 
> 
> freeagle wrote:
> > Why do people think there is a need for another language/paradigm to
> > solve concurrent problem? OSes deal with parallelism for decades,
> > without special purpose languages. Just plain C, C++. Just check Task
> > manager in windows and you'll notice there's about 100+ threads running.
> > If microsoft can manage it with current languages, why we cant?
> > 
> > freeagle
> 
> We can; it's just hard as hell and thoroughly unenjoyable.  Like I said
> before: I can and have written multithreaded code, but it's so utterly
> painful that I avoid it wherever possible.
> 
> It's like trying to wash a car with a toothbrush and one of those giant
> novelty foam hands.  Yeah, you could do it, but wouldn't it be really
> nice if someone would go and invent the sponge and wash-cloth?
> 
> 	-- Daniel
> 
> -- 
> int getRandomNumber()
> {
>     return 4; // chosen by fair dice roll.
>               // guaranteed to be random.
> }
> 
> http://xkcd.com/
> 
> v2sw5+8Yhw5ln4+5pr6OFPma8u6+7Lw4Tm6+7l6+7D
> i28a2Xs3MSr2e4/6+7t4TNSMb6HTOp5en5g6RAHCP  http://hackerkey.com/




More information about the Digitalmars-d mailing list