The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Mutex in Perl superuser84 Shell Programming and Scripting 6 11-12-2007 08:55 PM
what is diff b/w semaphore and mutex amitpansuria UNIX for Dummies Questions & Answers 1 08-20-2007 10:45 PM
mutex in shell programing zz_xm Shell Programming and Scripting 1 03-09-2005 06:53 PM
mutex sagar UNIX for Dummies Questions & Answers 2 02-04-2002 02:00 PM
Threads and Mutex vthasan High Level Programming 2 11-02-2001 03:34 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-08-2007
Registered User
 

Join Date: Jan 2007
Posts: 30
Stumble this Post!
difference between Mutex and semaphores

Hi,

can someone explain me the difference between mutex and semaphores?

Thanks
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 02-08-2007
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 3,844
Stumble this Post!
They are the same data type, and both work as locks or in-memory flags to control access to some object like shared memory or protected code segments.

semaphores may have values 0 -> n where n is an arbitrary number, like 10, or 4.
A mutex has two values either set = 1 or not set = 0. mutexes are typically acted upon by special functions, particularly in the pthreads library.

Local event flags are the most common example of sempahore use. Mutexes are used extensively in threads programming, for example.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 08:12 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0