Interview Questions

Microsoft Interview Question about Multithreading

Microsoft Interview Questions and Answers


(Continued from previous question...)

8. Microsoft Interview Question about Multithreading

Question:
Implement barrier synchronization using semaphores. That is, suppose you have n threads which should wait on a barrier until all of them arrive.


maybe an answer:
V(s1,1);
P(s2,1);
if (rank == 0)
{
P(s1, n);
}
V(s2, 1);

(Continued on next question...)

Other Interview Questions