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 does printf does?

0 Answers  


ATM machine and railway reservation class/object diagram

0 Answers   Zycus Infotech,


a<<1 is equivalent to a) multiplying by 2 b) dividing by 2 c) adding 2 d)none of the above

2 Answers   HCL, NBN,


What are the languages are portable and platform independent?Why they are like that?

1 Answers   Excel, Satyam,


What is the time and space complexities of merge sort and when is it preferred over quick sort?

0 Answers   Amazon,






in C-programming language without using printf statement can we get output r not ? if yes how and if no also how ?

11 Answers   IBM,


what is a void pointer?

2 Answers  


Why c is called a mid level programming language?

0 Answers  


How will you delete a node in DLL?

0 Answers   GrapeCity,


Write a program to reverse a string.

0 Answers   Global Logic, iNautix, TCS, Wipro,


How can you restore a redirected standard stream?

0 Answers  


Can U write a C-program to print the size of a data type without using the sizeof() operator? Explain how it works inside ?

3 Answers   HCL, TCS,


Categories