File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes What is a mutex? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "What is a mutex? " Watch "What is a mutex? " New topic
Author

What is a mutex?

Dave Alkire
Greenhorn

Joined: Jun 25, 2004
Posts: 10
Seen the term here but nowhere else yet.


-Dave A.
K Riaz
Ranch Hand

Joined: Jan 08, 2005
Posts: 375
Mutual Exclusion. See google for more info.
Mike Gershman
Ranch Hand

Joined: Mar 13, 2004
Posts: 1272
Mutex is a Computer Science term for what Java 2 calls a lock. Since only one thread can hold the lock on an object at one time, a section of code synchronized on an object cannot be entered by a thread while another thread holds the lock on that object. The mechanism for enforcing this rule is called a mutex.


Mike Gershman
SCJP 1.4, SCWCD in process
David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
Definitely look up mutex on Google to get a deeper answer, but one example of a mutex is Java's built-in object locking via synchronization. Mutually exclusive when X "has access", Y and Z cannot "gain access." In Java, when a block of code synchronizes on an object, it obtains a mutually exclusive lock on that object. Any other block of code in another thread cannot obtain a lock on the same object until the first block releases the lock.
Dave Alkire
Greenhorn

Joined: Jun 25, 2004
Posts: 10
Originally posted by Kashif Riaz:
Mutual Exclusion. See google for more info.

Perfect; thanks everyone for the replies! Usually I google for terms instead of posting, but in this case I just wanted to know what y'all, specifically, would say..
Ya see I'm re-reading a section in Sierra's _Sun Certified programmer & Developer for Java 2_, Chapter 9, "Threads", re-doing Exercise 9-2, "Synchronizing a Block of Code".. There was a bit I didn't grok, so I was searching through these JavaRanch forums and kept finding undefined references to that term. But anyway thanks again; all better now.
 
Consider Paul's rocket mass heater.
 
subject: What is a mutex?