Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Give a man a fish, he'll eat for one day. Teach a man to fish, he'll drink all your beer.
Cheers, Jeff (SCJP 1.4 all those years ago...)
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Originally posted by Ali Pope:
Hmmm... what IDE are you using Lasse? In case you are using IntelliJ IDEA or Netbeans you're seeing everyday threads on a Java Swing application .
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Francis Siu
SCJP, MCDBA
Originally posted by Ali Pope:
I am not quite sure if C++ and Java thread management are in the same direction
It is quite obvious that the theory is the same, don't know about practical side.
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
SCJP<br />SCWCD <br />ICSD(286)<br />MCP 70-216
Francis Siu
SCJP, MCDBA
Originally posted by Lasse Koskela:
I've written just one very simple "chat server" type of threaded application in C/C++ (using pthreads) and I have to say it was pure hell compared to Java's Thread and Runnable. Well, I guess the biggest part of the difference was actually the language and GC, not necessarily the threading API itself.
In theory, a compiled language such as C or C++ is indeed faster than an interpreted language like Java (bytecode). However, in practice, for most application domains the difference is negligible.Originally posted by siu chung man:
Which programming language thread is faster?
C>C++>Java
As I know, java thread seems to be encapsulated much layers, isn't it?
The GC collects thread objects just like any other object within the JVM.Originally posted by siu chung man:
Will the GC collect the thread after the thread have finished to run the program in Java?
Originally posted by siu chung man:
Comparing with C++, does java implement the thread easiler than c++?
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Originally posted by Paul Sturrock:
I can see why its essential to Swing/AWT programmers, but not for anyone who works in the J2EE world (let me qualify that, by "not essential", I mean "don't need to use directly" rather than "don't need to know").
SCJP 1.4 / 5.0 - SCBCD 1.3 - SCWCD 1.4 - IBM 484
SCJP<br />SCWCD <br />ICSD(286)<br />MCP 70-216
Originally posted by David Ulicny:
I think you should know about threading issues, if you are accessing the database and there is a long running query, you should know that this place could be a bottleneck if synchronize it.
Originally posted by siu chung man:
Which programming language thread is faster?
C>C++>Java
Originally posted by Ali Pope:
Indeed, but as some of us already told there are specific indication not not to use thread management inside the container (thread management includes the synchronization)
./pope
SCJP 1.4 / 5.0 - SCBCD 1.3 - SCWCD 1.4 - IBM 484
Francis Siu
SCJP, MCDBA
Could you give me an example of an improvement of an application if the programmer knows some things of thread ?
Originally posted by Paul Sturrock:
I didn't say that a knowledge of threading in Java would somehow make a J2EE application in anyway better. What I meant was programmers shouldn't not learn Java's threading stuff simply because containers render the knowledge very infrequently applied.
SCJP 1.4 / 5.0 - SCBCD 1.3 - SCWCD 1.4 - IBM 484
Originally posted by Vinicius Boson:
Actually, my point was not if you are right or wrong. The point is if you or anyone else can give me an example of the knowledge of thread could be applied to improve the quality of the applition.
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Originally posted by Ali Pope:
Very interesting problem Lasse. How do you really solve it?
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Originally posted by Lasse Koskela:
One rather easy way to do this would be something like this...
Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Originally posted by Stan James:
But life is not all EJB, thank goodness.
SCJP 1.4 / 5.0 - SCBCD 1.3 - SCWCD 1.4 - IBM 484
Consider Paul's rocket mass heater. |