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

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

1 Answers  


Which is best linux os?

0 Answers  


wt is diference between int and int pointer as same as float and float pointer and char and char pointer

8 Answers   CTS, Infosys,


number of times a digit is present in a number

0 Answers  


How do you sort filenames in a directory?

0 Answers  






what is a non volatile key word in c language?

1 Answers  


develop algorithms to add polynomials (i) in one variable

0 Answers   Ignou, TCS,


disadvantages of realloc ?

1 Answers   HCL,


Write a program to compare two strings without using the strcmp() function

42 Answers   Accenture, Arba Minch University,


When should a type cast not be used?

0 Answers  


what is the difference between : func (int list[], ...) or func (int *list , ....) - what is the difference if list is an array and if also if list is a pointer

2 Answers  


how can i get the string which is having two spaces at the end.suppose the string is "Hello World ".Now at the end i have two spaces.i need to print with that spaces .

1 Answers  


Categories