aspose file tools*
The moose likes Threads and Synchronization and the fly likes Help needed in Threads !!!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Help needed in Threads !!!!!" Watch "Help needed in Threads !!!!!" New topic
Author

Help needed in Threads !!!!!

Siddharth Bhargava
Ranch Hand

Joined: Feb 23, 2007
Posts: 266
Hi all,
I need Help in Threads.... I am very weak in threads......i am not able to understand the concepts...... theory wise i am a little ok ...but practically i am not able to understand the concepts from the ground up ..... Please help me in understanding threads practically .... please provide me with simple practical examples by which i can learn the basic concepts of threads..... I am not able to find any good example of threads on net .....Thanks in advance .....
Nicholas Jordan
Ranch Hand

Joined: Sep 17, 2006
Posts: 1282
Threads can be a difficult topic to work.

I have come to realize that threads are the machine in operation.

Say if you write:

Thread t = new Thread(object);
t.start();

it becomes extremely difficult to people to get the idea that the code you have written is not the thread it's self, a Thread has two things to think about:

  • The code you wrote.
  • The machine in execution.

  • You write some code, then the machine will execute the run() method for you - one time - separately from where you started it - then that thread has "run". In so doing, you can accomplish work in "two places at once" as though there were two computers running. Each thread of execution, while running, may be thought of as a computer running. Keeping track of what is where becomes the subject of much discussion, but ofen overlooks the "computational machinery running as a machine" side of the discussion.

    Say you had two calculators in class, or two wristwatches or two soccer game video devices or whatever, side by side, but would only write the code one time.

    What would happen, how would one write the code ?

    See:
  • A question from Java Concurrency in Practice
  • Threads and Synchronization -> practical applications of threads/synchronization
  • Failure mode of two reference calls to one thread in which I ultimately went back and admitted I had the question wrong.



  • Don't feel lonely, Read Henry's book - it uses understandable language and gives numerous points that are of great utility in grasping the concept.


    "The differential equations that describe dynamic interactions of power generators are similar to that of the gravitational interplay among celestial bodies, which is chaotic in nature."
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Help needed in Threads !!!!!