Question & Additional Information
 
What is a semaphore?
Add to My IQ
 

 | 
Inappropriate
Answer Title
Answer
A resource management, synchronization, and locking tool.
Question Tag Title
Tags
Question Asked At Title
Asked At
None
Question Job Title
Job Titles


Check out our newest job listings!

Post a Job! $49 for 60 days



Your Name:
Add your comment text
 
Related Questions
Related Questions
Flag this interview question as inappropriate Inappropriate
See Answer
If a process in a monitor signal and no task is waiting on the condition variable, the signal is lost. So this allows easier program design. Whereas in semaphores, every operation affects the value of the semaphore, so the wait and signal operations should be perfectly balanced in the program.
Create Date
:
Tuesday, May 13, 2008
Asked At
:
None
Job Positions
:
Click here to improve the Interview Question, Answer and other fields.
Comments (0) :
Goto add your comment on the Question 
Flag this interview question as inappropriate Inappropriate
See Answer
A binary semaphore is one, which takes only 0 and 1 as values. They are used to implement mutual exclusion and synchronize concurrent processes.
Create Date
:
Tuesday, May 13, 2008
Asked At
:
None
Job Positions
:
Click here to improve the Interview Question, Answer and other fields.
Comments (0) :
Goto add your comment on the Question 
Flag this interview question as inappropriate Inappropriate
See Answer
In a multi threaded application each thread must coordinate its actions with other threads in the application. If two or more threads access a same resource then that resource needs to be synchronized so that all threads don't try to modify it at the same time. Windows supports four types of synchronization objects that can be used to synchronize the actions performed by concurrently running multiple threads.  -         Critical Sections -         Mutexes -         Events -         Semaphores Critical Section: These are used to serialize access to resources that are accessed by multiple threads. All the threads must belong to same process because critical sections won't work across process boundaries. CCriticalSection is a class and CCriticalSection::Lock locks a critical section and CCriticalSection::UnLock unlocks it.  E.g. CCriticalSection cs; //Thread T1 cs.Lock (); //access the shared resource cs.UnLock ();  /Thread T2 cs.Lock (); /access the shared resource Cs.Unlock (); Mutexes: Serves the same purpose as critical sections but can be used to synchronize threads running in same process or across processes. CMutex is its corresponding class.  Semaphores: They maintain resource counts representing the number of resources available. Locking a semaphore decrements resource count and unlocking increments it. A thread that tries to lock a semaphore with resource count 0 gets blocked until another thread unlocks the semaphore and increases the resource count. CSemaphore is a class representing semaphores.
Create Date
:
Saturday, May 10, 2008
Tags
:
Asked At
:
None
Job Positions
:
Click here to improve the Interview Question, Answer and other fields.
Comments (0) :
Goto add your comment on the Question 
Flag this interview question as inappropriate Inappropriate
See Answer

 

 

Create Date
:
Monday, September 24, 2007
Tags
:
Job Positions
:
Click here to improve the Interview Question, Answer and other fields.
Comments (2) :
1.
dk123
Wednesday, March 19, 2008 6:27 AM
nice comment
2.
thingMaster
Tuesday, October 23, 2007 1:52 PM
you are overconfident. you will probably kill many patients, but drive a nice car.
 
• More Related Questions: 
Suggestions & Comments




Share Your Interview Questions
Ask Interview Questions
View Unanswered Questions





Advertise on this site