Microsoft
3.6 of 5 7,479 reviews
www.microsoft.com Redmond, WA 5000+ Employees

Microsoft Senior Software Development Engineer In Test (SDET) Interview Question

I interviewed in Redmond, WA and was asked:
"Implement a counting semaphore using only binary mutexes"
Tags: programming, c++
Add Tags [?]
Answer Flag Question

Part of a Senior Software Development Engineer In Test (SDET) Interview Review - one of 3,342 Microsoft Interview Reviews

Answers & Comments

1
of 1
vote
int counter = 0;
mutex m;

sempahore_increase()
{
lock(m);
counter++;
unlock(m);
}

semaphore_decrease()
{
while (true)
{
lock(m);
if (counter)
{
counter--;
unlock(m);
sleep(1000);
return;
}
unlock(m);
}
}
- Azh on Sep 9, 2010 Flag Response

To comment on this question, Sign In with Facebook or Sign Up


Tags are like keywords that help categorize interview questions that have something in common.

Glassdoor is your free inside look at Microsoft interview questions and advice. All interview reviews posted anonymously by Microsoft employees and interview candidates.