Share on Google+Share on Google+

Java Multithreading

Advertisement
Multithreading allows two parts of the same program to run concurrently. In Java, the Java Virtual Machine (JVM) allows an application to have multiple threads of execution running concurrently independently.

Java Multithreading

     

Multithreading allows two parts of the same program to run concurrently. In Java, the Java Virtual Machine (JVM) allows an application to have multiple threads of execution running concurrently independently. When a program contains multiple threads then the CPU can switch between the two threads to execute them at the same time.  In case of Multithreading, if more than one thread manipulates shared variables or objects at the same time, corruption may result. Instance variables are shared between threads. If one is modified by a thread, the change affects the other threads.
 
Java enables you to synchronize threads by defining a synchronized method. A thread that is inside a synchronized method prevents any other thread from calling another synchronized method on the same object.

Read more at:

http:/www.roseindia.net/java/thread/SynchronizedThreads.shtml

 

Advertisements

Advertisement

Posted on: December 15, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Discuss: Java Multithreading   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0