On Fri, 15 Mar 2002, Tzahi Fadida wrote:
> Well, i am not so savy about threads as most people here, its ok, neither are most people here, to bgin with ;) > but i think my opionion is middle ground. I think that threads should > not be used on C user applications as is, because of the > low level implementation of threads and mutexs there. Instead if you > realy need threads you should use some library that simplifies things. in many situations it indeed makes sense. that's why i mentioned ACE, as such a library (http://www.cs.wustl.edu/~schmidt/ACE.html). > A textbook solution would suggest using "Monitor" objects. In essence, > the cost for performance using low level impelementations is indeed to > high. err, what? what kind of performance are you refering to? performance of the code (can't be - it'll be a high cost of the program writes bad code, but that is the case when writing non-threaded code as well)? or are you refering to the performance of the _programmer_? :) > If performance is not your main requirement, i suggest you use > JAVA 2.0 code, which handles threads very well, using behind the scene > objects locks and calls to notify() as a variation to the > singal-wait/signal-continue scheme. This would prevent any deadlocks how? what if one 'syncronized' method calls another in a different class, and that other object is also synchronized, and calls the first one? how does java handle this? in theory, it should deadlock. if java recognizes this and throws an exception - the deadlock is not 'prevented'. it is 'reported' (which is good). and its the kind of exception that cannot be dealt with in runtime - if you could, you'd write the code without introducing deadlocks in the first place ;) > (but not eliminate starvation completely, actually thats your only > concern :) and would simplify debugging, java - simplify debbuging? these things don't go well together. java environments are noturious for having slow and annoying debuggers, to the level that many people prefer using println-s instead of launching te debugger. > not to mention the safe environment you are using. But again, you will > loose performance. there's a price for everything. but that said, indeed, threading in java seems to come up pretty cheap. ofcourse, that's relevant if you can afford using java. -- guy "For world domination - press 1, or dial 0, and please hold, for the creator." -- nob o. dy ================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]