This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Threads and Synchronization and the fly likes What exactly is the Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "What exactly is the "monitor"" Watch "What exactly is the "monitor"" New topic
Author

What exactly is the "monitor"

Joshua White
Ranch Hand

Joined: Jun 04, 2001
Posts: 97
Hello All,
I am beginning with threads. I have read about the monitor. I know that a thread wishing to execute a synhcronized method/block must enter the objects monitor. What exactly is the monitor? Where is it located?

[This message has been edited by Joshua White (edited June 05, 2001).]
Ryan Langley
Ranch Hand

Joined: May 10, 2001
Posts: 46
Hello,
Monitoring and locking an object are essentially the same thing. I think of monitor as the process by which a thread determines if it can gain a lock on an object. In other words, you can use the lock variable as a way to monitor an object to see if it is available to your thread. The Object class has a lock instance variable. The lock variable is ignored by default for overhead reasons, but once the synchronized keyword is used it indicates that the object should now pay attention to the lock variable and use it for controlling access to it. Hope this helps!
Cheers,
RL


Cheers,<P>RL
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: What exactly is the "monitor"
 
Similar Threads
Jboss Monitoring Tools
Static variable Question?
Profiler tool for distributed application
What does monitor mean?
Help! Can i open a frame to fit the dimensions of the monitor