Answer Posted / john noah
In a single threaded system program executes in a sequence
line by line. Multithreaded system can allow multiple
threads to execute a program parallel in multiple instances.
If there is any part of code dealing with the object data
modification, there is no guarantee that it will not be
attempted any more than one thread at a time.
there's a need to make sure that such kind of code should be
executed exclusively. To achieve this in Java we a concept
of LOCK. Using Lock mechanism thread holds complete hold on
an object and object is also can not be access any other
thread except the thread holding that lock. Lock is an
object level control and one thread only can hold it at a time.
| Is This Answer Correct ? | 8 Yes | 0 No |
Post New Answer View All Answers
Explain the use of volatile field modifier?
What is internal variable?
Explain the public class modifier?
what is predefined function in java?
What is the primary benefit of encapsulation?
When is an object subject to garbage collection?
Can we make the abstract methods static in java?
Is string serializable in java?
Why char array is preferred over string for storing password?
When can we say that threads are not lightweight process in java?
Why can't we make a class private in java?
How can constructor chaining be done by using the super keyword?
What does percent mean in java?
Is minecraft java edition free?
What is a static method in java?