This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Threads and Synchronization and the fly likes lock, monitor, mutex, or semaphore? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Threads and Synchronization
Reply Bookmark "lock, monitor, mutex, or semaphore?" Watch "lock, monitor, mutex, or semaphore?" New topic
Author

lock, monitor, mutex, or semaphore?

John M. Gabriele
Ranch Hand

Joined: Feb 18, 2001
Posts: 232
i've heard these 4 words bandied about as if they were
all synonyms. can someone please tell me what the differences
between them are?
when i go
synchronized ( obj ) { /*...*/ }
what am i actually "getting"?
is it proper to say i'm getting
"the lock belonging to obj" or "a lock on obj"?
thanks!
John M. Gabriele
Ranch Hand

Joined: Feb 18, 2001
Posts: 232
ok, i think i'm starting to get the picture here.
...btw, i didn't mean to imply that folks around the
ranch were misusing terms; i guess i should've said
i'm just confused about these various terms i've heard. sorry.
anyhow, i *think* mutex's and semaphores are low-level os/jvm things
that i don't need to be concerned with at the java app level. the
generic term "lock" seems to cover however the jvm does it's synchronizing
magic.
as for "getting a lock on/of/for an object" or "locking an object",
they seem to all be equivalent to mean the same thing.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: lock, monitor, mutex, or semaphore?
 
Similar Threads
Enthuware Q52342 on concurrency
Threads-Can someone reply to this que?
Wait method invoked while two locks are held
Thread Question
lock/unlock & synchronized