I have a question regarding the synchronization of method..
can a thread access the non-synchronized method of an instance of class when the other thread have the lock on the same instance of class?
because as i know the lock is for object , so if a class contains both synchronized and non synchronized methods , and if one thread has a lock on object(instance) , is that possible for other thread to call the non synchronized method using the same instance?
Originally posted by vianyrajnish rajnish: ....can it be possible to access that non-synchronized method from other thread? ....
The problem, if any, is keeping the data in in instance in a consistent state while two or more threads are active in the instance. I just went through a very convoluted discussion in which I figured all this Thread stuff out. Look at it this way:
It may seem odd, but on a multiple processor machine, the two threads can actually be at the same point at the same time. If that is the case, a variable on the left of the assignment operator can be changed by Thread_1 before Thread_2 can read it. Sounds incorrect, but on a Hydra with a theoretical peak performance of 4.8 Teraflops, total memory of 1.2 Terabytes, and a 21 Terabyte DDN disk array, keeping up with Who's on First can resemble Titanic in 30 seconds, re-enacted by bunnies.
"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."
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database