Results 1 to 3 of 3
Thread: When to use threads
- 01-31-2010, 03:32 AM #1
Member
- Join Date
- Jan 2010
- Posts
- 25
- Rep Power
- 0
When to use threads
I read this from this tutorial :Introduction to Java threads
It makes no sense for me. May you explain more?Consider a simulation application, where you simulate the interaction
between multiple entities. Giving each entity its own thread can greatly simplify many
simulation and modeling applications.
- 01-31-2010, 03:51 AM #2
It means you can do more than one thing at the same time.
"Experience is what you get when you don't get what you want" (Dan Stanford)
"Rise and rise again until lambs become lions" (Robin Hood)
- 02-12-2010, 07:43 AM #3
Senior Member
- Join Date
- Jan 2009
- Posts
- 671
- Rep Power
- 5
Suppose that right now, you are on one computer and I'm on another. We are both executing different code at the exact same time. We are operating in different 'threads' - simultaneous CPU usage.
You can do the same thing on 1 computer. For example, you can chat on your browser while a movie is playing. These are different threads.
But, you can also chat in your browser while an annoying flash ad is playing in the same program. These are different threads too.
Threads are what allow your program to execute multiple sections of code at the exact same time (...nevermind what happens on a single core). Your code can handle mouse and keyboard events while also rendering graphics and sound...for example, if you use multiple threads.
Similar Threads
-
GUI and Threads
By rp181 in forum Threads and SynchronizationReplies: 1Last Post: 10-10-2009, 08:39 PM -
Threads!
By rameshraj in forum Advanced JavaReplies: 1Last Post: 05-04-2008, 04:11 PM -
Using threads
By Java Tip in forum Java TipReplies: 0Last Post: 12-11-2007, 10:25 AM -
Threads
By one198 in forum Threads and SynchronizationReplies: 1Last Post: 11-20-2007, 06:15 PM -
Server n threads
By ferosh in forum NetworkingReplies: 2Last Post: 04-28-2007, 10:42 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks