difference between semaphores and mutex?



difference between semaphores and mutex?..

Answer / selvakumar

"Mutexes are typically used to serialise access to a
section of re-entrant code that cannot be executed
concurrently by more than one thread. A mutex object only
allows one thread into a controlled section, forcing other
threads which attempt to gain access to that section to
wait until the first thread has exited from that section."

"A semaphore restricts the number of simultaneous users of
a shared resource up to a maximum number. Threads can
request access to the resource (decrementing the
semaphore), and can signal that they have finished using
the resource (incrementing the semaphore)."

Is This Answer Correct ?    15 Yes 2 No

Post New Answer

More C Interview Questions

What will be the output of x++ + ++x?

20 Answers   MBT, Religare,


code for selection sort?

1 Answers  


Explain what is the difference between declaring a variable and defining a variable?

1 Answers  


What is the exact difference between '\0' and ""

3 Answers  


difference between spiral and waterfall model

1 Answers  






What are the different pointer models in c?

4 Answers  


What is the scope of local variable in c?

0 Answers  


What is the difference between realloc() and free()

1 Answers  


What is spark map function?

0 Answers  


what is the stackpointer

2 Answers  


count the numbers between 100 and 300, that star with 2 and ends with 2

5 Answers   Mind Tree,


What is a constant?

0 Answers  


Categories