File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

What is the advantage of using monitors over using semaphores?

 
azuki ooh
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic