ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
difference between semaphores and mutex?
 Question Submitted By :: Venkat1435
I also faced this Question!!     Rank Answer Posted By  
 
  Re: difference between semaphores and mutex?
Answer
# 1
"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 ?    7 Yes 2 No
Selvakumar
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
who is the founder of c HP9
What is the memory allocated by the following definition ? int (*x)(); ADITI2
void main() {int a[5],i,b=16; for(i=0;i<5;i++) a[i]=2*i; f(a,5,b); for(i=0;i<5;i++) printf("\n %d",a[i]); printf("\n %d",b); } f(int *x,int n,int y) { int i; for(i=0;i<n;i++) *(x+i)+=2; y=y+2; }wat r the errors in the prg.and improvise the prg to get o/p.?  2
What is memmove? Oracle1
what is the output of the following program? main() { int c[]={2,8,3,4,4,6,7,5}; int j,*p=c,*q=c; for(j=0;j<5;j++) { printf("%d",*c); ++q; } for(j=0;j<5;j++) { printf("%d",*p); ++p; } }  4
any string of bits of length 'n' represents a unique non- negative integer between.............?  2
a.One Cannot Take the address of a Bit Field b.bit fields cannot be arrayed c.Bit-Fields are machine Dependant d.Bit-fields cannot be declared as static Which of the Following Statements are true w.r.t Bit-Fields A)a,b&c B)Only a & b C)Only c D)All Accenture2
write a program to search for an element in a given array. If the array was found then display its position otherwise display appropriate message in c language  3
What ios diff. Between %e & %f? Honeywell1
4.A function 'q' that accepts a pointer to a character as argument and returns a pointer to an array of integer can be declared as: A)int (*q(char*)) [] B)int *q(char*) [] C)int(*q)(char*) [] D)None of the Above Accenture4
4.weight conversion: Write a program that will read weight in pounds and convert it into grams.print both the original weight and the converted value.There are 454 grams in a pound.design and carry out a test plan for this program. Wipro1
Write a program to remove the C comments(/* */) and C++ comments(//) from a file. The file should be declared in command line. Subex2
difference between semaphores and mutex?  1
write a program to generate 1st n fibonacci prime number  1
Write a program in c to input a 5 digit number and print it in words.  1
What will be the result of the following program? main() { char p[]="String"; int x=0; if(p=="String") { printf("Pass 1"); if(p[sizeof(p)-2]=='g') printf("Pass 2"); else printf("Fail 2"); } else { printf("Fail 1"); if(p[sizeof(p)-2]=='g') printf("Pass 2"); else printf("Fail 2"); } } a) Pass 1, Pass 2 b) Fail 1, Fail 2 c) Pass 1, Fail 2 d) Fail 1, Pass 2 e) syntax error during compilation IBM10
Find Index of least significant bit set in an Integer. ex. int value is say 10001000 results should be 4.  1
how to display 2-D array elements in spiral  1
How can I call a function, given its name as a string? ABC-Telecom2
#define MAX(x,y) (x) > (y) ? (x) : (y) main() { int i = 10, j = 5, k = 0; k = MAX(i++, ++j); printf("%d %d %d", i,j,k); } what will the values of i , j and k? } NDS9
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com