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

Stimulate calculator using Switch-case-default statement for two numbers

0 Answers   Wipro,


What will be your course of action for a push operation?

0 Answers  


which do you prefer C or Pascal?

1 Answers  


what are bitwise shift operators?

4 Answers  


#include main() { int i=1,j=2; switch(i) { case 1: printf("GOOD"); break; case j: printf("BAD"); break; } }

6 Answers   ME,






what is the c source code for the below output? 10 10 10 10 10 10 10 10 10 10 9 9 7 6 6 6 6 6 6 9 7 5 9 7 3 2 2 5 9 7 3 1 5 9 7 3 5 9 7 4 4 4 4 5 9 7 8 8 8 8 8 8 8 8 9

0 Answers  


When do you say that a digraph is acyclic A)if and only if its first search does not have back arcs B)a digraph is acyclic if and only if its first search does not have back vertices C)if and only if its first search does not have same dfnumber D)None of these

1 Answers   Accenture, IBM,


int main(){ float f=8.0; if(f==8.0) printf("good"); else printf("bad"); } what is the answere and explain it?

3 Answers  


Go through the following code sinippet char a[20]; a="Hello Orcale Test"; will this compile?

4 Answers   Oracle,


Who is the founder of c language?

0 Answers  


to print the salary of an employee according to follwing calculation: Allowances:HRA-20% of BASIC,DA-45% of BASIC,TA-10%. Deductions:EPF-8% of BASIC,LIC-Rs.200/-Prof.Tax:Rs.200/- create c language program?

0 Answers  


what does " calloc" do?

7 Answers   Cadence, Logos,


Categories