File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes What is the advantage of using monitors over using semaphores? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "What is the advantage of using monitors over using semaphores?" Watch "What is the advantage of using monitors over using semaphores?" New topic
Author

What is the advantage of using monitors over using semaphores?

azuki ooh
Greenhorn

Joined: Nov 07, 2008
Posts: 20
What is one advantage of using monitors over using semaphores?

(a) Mutual exclusion in monitor is automatic while mutual exclusion in semaphore needs to be coded explicitly.
(b) Shared variables are global to all processes in the monitor while shared variables are hidden in semaphores.
(c) Synchronisation in monitors is provided by condition variables while there are no condition variables in semaphores.
(d) Access to the monitor is through protected shared variables while access to shared variables in semaphores is not protected.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is the advantage of using monitors over using semaphores?
 
Similar Threads
Question related to Thread synchronization.
semaphores
wait & notify
What is the monitor in Java multi-thread programming?
Thread question