Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

difference between semaphore and mutex

Status
Not open for further replies.

avssunil

Junior Member level 1
Joined
Nov 13, 2006
Messages
19
Helped
2
Reputation
4
Reaction score
0
Trophy points
1,281
Activity points
1,416
Hi,
I would like to know the correct and exact differences between semaphore and mutex??
When is a SEMAPHORE used and when is a MUTEX used????
 

differences between semaphore and mutex

A semaphore is an extension of a mutex. A mutex allows one thread inside the critical section, a semaphore allows n threads in a critical section (when the number n is given as a parameter on the initialization). A semaphore is useful when a resource has more than one instance, and a mutex can be implemented by initializing a semaphore with the value 1.

"Mutex and Semaphores"
**broken link removed**

https://www.embeddedrelated.com/usenet/embedded/show/33282-1.php
https://geekswithblogs.net/shahed/archive/2006/06/09/81268.aspx

Regards,
IanP
 

what is difference between semaphore and mutex

In linux device driver chap 5, there is a description about semaphore and mutex:"When semaphores are used for mutual exclusion—keeping multiple processes from running within a critical section simultaneously—their value will be initially set to 1. Such a semaphore can be held only by a single process or thread at any given time. A semaphore used in this mode is sometimes called a mutex, which is, of course, an abbreviation for "mutual exclusion." Almost all semaphores found in the Linux kernel are used for mutual exclusion."
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top