samar
Java Exception
1 Answer(s)      5 years and 9 months ago
Posted in : Java Interview Questions
What are monitors?
Advertisement
View Answers

October 28, 2010 at 4:16 PM


Hi,

Here is the answer,

A monitor is associated with a specific data item (a condition variable) and functions as a lock on that data. When a thread holds the monitor for some data item, other threads are locked out and cannot inspect or modify the data.

The code segments within a program that access the same data from within separate, concurrent threads are known as critical sections. In the Java language, you mark critical sections in your program with the synchronized keyword.

Monitors provide greater security from system breakdown than Java does.Compilers for languages that support monitors can assure that all fields that can be accessed by more than one thread are protected by monitors. They can also assure mutual exclusion to those fields. They can check for the possibility of deadlock due to cycles in the graph of monitor calls. The implementation of these compilers can guarantee that a thread waiting for a condition will gain access to the monitor immediately, so the condition will still be true.

Thanks.










Related Tutorials/Questions & Answers:
Exception Java
Exception Java  Hi, What are the Exception Java? Thanks   Hi, Read it at Java Exception. Thanks
Java Exception
Java Exception  Which is superclass of Exception
Advertisements
Java exception
Java exception  Can an exception be rethrown
Java exception
Java exception  What happens if an exception is not caught
java exception
java exception   define an exception called no match exception tat z... { public static void main(String[] args) throws Exception { String z="Hello"; if(!z.equals("India")){ throw new Exception
Java exception
Java exception  What is the difference between exception and error
Java exception
Java exception  What is the difference between Checked and Unchecked exception
Java Exception
Java Exception  Explain about checked and unchecked Exceptions... this exception will be caught by a well-written application and will also prompt... to the constructor. Well in this case the exception could be caught by the application
Java Exception
Java Exception  What are monitors
Java Exception
Java Exception  Why Errors are Not Checked
Java Exception
Java Exception  Why Runtime Exceptions are Not Checked
Java Exception
Java Exception  What is ?Resource leak
Java Exception
Java Exception  What is the purpose of finalization
Java exception
Java exception  Can try statements be nested
Java exception
Java exception  What is NullPointerException and how to handle
Java Exception
Java Exception  What are Chained Exceptions
exception in java - Java Beginners
exception in java  exception in java
Java Exception
Java Exception  Can a catch block exist without a try block
Java Exception
Java Exception  If I write System.exit (0); at the end of the try block, will the finally block still execute
exception in java
exception in java  StringIndexOutOfBounds Exception in flames program   Hi Friend, We have providing you a program. Try it: import java.util.*; public class FlamesProgram{ static String name1 = ""; static
Java exception handling
Java exception handling  what are the constraints imposed by overriding on exception handling
null pointer exception in java
null pointer exception in java  What is null pointer exception in Java and when it occurs? Show it with an example.Thanks!   Java Null Pointer Exception
java exception handle
java exception handle  How error can be handled in the exception class?? can we handle fatal error in java
Java Exception - Java Beginners
Java Exception  Why we are using throws in the java program even if we have try...catch block? If throws will throw the exception then who will catch... links: http://www.roseindia.net/java/exceptions/how-to-throw-exceptions.shtml
exception in java - Java Beginners
exception in java  exception in java  Hi Friend, Exceptions are the errors that occur during the execution of the program. Exceptions...: http://www.roseindia.net/java/exceptions/ Thanks
Java exception handling
Java exception handling  How does a try statement determine which catch clause should be used to handle an exception
Exception - Java Beginners
What is Exception in Java  What is the Exception that occurs while running the application in Java
Java exception handling
Java exception handling  How does a try statement determine which catch clause should be used to handle an exception
Java exception handling
Java exception handling  What is the difference between throw and throws keywords
Java exception handling
Java exception handling  What is the catch or declare rule for method declarations
Exception - Java Beginners
Chained Exception in Java  What is the Chained Exception in Java?  Chained Exception in JavaChained Exception in Java, this is a new... of exceptions, and these exception can be caused by another exception.Exceptions in Java
Advertisement