Results 1 to 3 of 3
  1. #1
    simorgh is offline Member
    Join Date
    Jan 2010
    Rep Power

    Default When to use threads

    I read this from this tutorial :Introduction to Java threads

    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.
    It makes no sense for me. May you explain more?

  2. #2
    Lil_Aziz1's Avatar
    Lil_Aziz1 is offline Senior Member
    Join Date
    Dec 2009
    United States
    Rep Power


    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)

  3. #3
    toadaly is offline Senior Member
    Join Date
    Jan 2009
    Rep Power


    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

  1. GUI and Threads
    By rp181 in forum Threads and Synchronization
    Replies: 1
    Last Post: 10-10-2009, 08:39 PM
  2. Threads!
    By rameshraj in forum Advanced Java
    Replies: 1
    Last Post: 05-04-2008, 04:11 PM
  3. Using threads
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-11-2007, 10:25 AM
  4. Threads
    By one198 in forum Threads and Synchronization
    Replies: 1
    Last Post: 11-20-2007, 06:15 PM
  5. Server n threads
    By ferosh in forum Networking
    Replies: 2
    Last Post: 04-28-2007, 10:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts